In Plone 5.0.7 I have some JS on a page that is loading content from another site. Here is an example:
Notice the url has
& to separate the parameters instead of just
&. This is a change that Diazo is making, and it's preventing the JS from working properly.
How can I prevent this change from happening?
I tried your example in 5.1rc1 and added your example to
- a theme template
- the site settings JS
and both scripts are showing up perfectly fine without a rewrite of the
Thanks for checking, Thomas. I tried using the versions of Diazo and plone.app.theming from 5.1rc1, but still get
I was already planning to test an upgrade to 5.1rc1, I'll see if that fixes the issue.
Do you see the same behavior with the default Barceloneta theme? And also with content coming from the JS site settings?
Yes, it also happens in Barceloneta. I did not test the site settings JS. This particular code will appear in the body text of pages, but I did also test from the index.html and a browser view template, and still got
It appears as
& with no Diazo theme enabled.
You fall into an HTML versus XHTML discrepancy. The behaviour you observe is correct for an XML document (such as an XHTML document); it is problematic for HTML. The reason: HTML defines "script" as an element with "CDATA" content (therein markup is not recognized); XML does not know such elements - all element content is parsed for markup and therefore "&" should be coded as "&". Part C4 of the XHTML specification suggests to use external scripts in those cases to avoid the problem.