SOLVED: Unable to use 'root' in page settings > footer scripts

If trying to use ‘root’ in Javascript in the page settings, it’s replaced with brxe-xxxx and so breaks the JS.

Example code, if adding an intersection observer to a page we’d use ‘root’ in the JS when setting up the config…

<script>
    
    let config = {
        root: null,
        rootMargin: '0% 0% 0% 0%',
        threshold: 0 
    };

    ...

</script>

But Bricks replaces the root, to replace with some element ID, so on the front end, it comes out as…

<script>
    
    let config = {
        #brxe-rwitym: null,
        rootMargin: '0% 0% 0% 0%',
        threshold: 0 
    };

    ...

</script>

Bricks v1.9 (sorry I didn’t check earlier versions so unsure if this has always been the case or if it’s a new thing.)

1 Like

Hey David,

thanks for your report.

Good catch. :slight_smile: I was able to reproduce the issue and added it to our bug tracker.

Best,

André

1 Like

Hi David,
We’ve fixed this issue in Bricks 1.9.1/1.9.1.1, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,
timmse