Hello! Something with a recent update has broken a number of pages with custom code that have been up for years. I’ve narrowed it down that it is something to do with having a second “fail gracefully” section that displays a picture for users who are on mobile. When this section exists, for some reason WordPress replaces square brackets in the custom code with their HTML entities. Example below:
When the “fail gracefully” section exists (see this page) it throws an Uncaught SyntaxError: Unexpected token '&'
error because wordpress replaces square brackets in this line:
> var x2 = d3.scaleTime()
> .domain([new Date(2017,9,1), new Date(2018,8,29)])
> .rangeRound([0, width]);
When the “fail gracefully” section is removed (see this test page)
) the custom code works as intended because WordPress does not replace the brackets in the same line:
> var x2 = d3.scaleTime()
> .domain([new Date(2017,9,1), new Date(2018,8,29)])
> .rangeRound([0, width]);
Any ideas on why having a second section would be doing this replacement? Ideally I would like to keep the “fail gracefully” section, and they have worked together without issues in the past. I understand if custom code is outside of scope for support, but I appreciate any insight you might have!
Thank you!