Okay
  Public Ticket #4536301
Salient 18.0.2 init.js invalid selector causes JS exception
Open

Comments

  • ecotechworldinc started the conversation

    On Salient v18.0.2 I’m getting a JavaScript SyntaxError on page load caused by an invalid CSS selector in the theme’s frontend init script. This appears to break/interrupt initialization and was causing a brief issue on my end. Error (console):

    SyntaxError: '.slide-out-widget-area-toggle:not(.std-menu) a.open:not(.animating), .nectar-ocm-trigger-open a.open, #slide-out-widget-area .slide_out_area_close, > .slide_out_area_close__wrap .slide_out_area_close, #slide-out-widget-area-bg.slide-out-from-right, .material-ocm-open #ajax-content-wrap, #ajax-content-wrap.ios-ocm-style-open' is not a valid selector.    at .../wp-content/themes/salient/js/build/init.js?ver=18.0.2:1:188131

    The selector string contains this fragment:

    > .slide_out_area_close__wrap .slide_out_area_close

    A selector cannot start with > (child combinator) without a left-hand parent selector, so querySelectorAll throws.

    Hotfix that resolves the issue:

    Changing that fragment to an anchored selector fixes the exception:

    Replace:

    > .slide_out_area_close__wrap .slide_out_area_close

    With:

    body > .slide_out_area_close__wrap .slide_out_area_close

    (Alternatively, anchoring to #slide-out-widget-area also works depending on intended structure.)

    Where:

    /wp-content/themes/salient/js/build/init.js (frontend init), around the line referenced above.

    Repro:

    Load any page with the off-canvas/slide-out widget area/OCM enabled; the error triggers on load.

    Could you confirm and patch this selector in the next Salient update?

    Thanks!