CDATA in Script and Style Elements Recovered in Parsed XML with Ajax
1. I have one Main.HTML document (is a "modular" chemistry calculator) which does Ajax requests to load in XHMTL documents (each has a single external JS file too) which are parsed in the xmlResponse property of the XML HTTP request object.
2. Each XHTML document (as a module) is also a valid loadable document on its own: the Main.HTML is just incorporating multiple functionalities with Main.HTML as an interface.
3. Some XHTML modules/documents have dynamically configured content at load time, through the onload attribute of the body element
4. These XHTML documents also contain in their head elements: one script element and one style element.
When the Ajax request completes and the xmlResponse contains the DOM tree, the onload handler is executed, which is nice. It is supposed call a function in the script element contained in the head element, but there is an error that the function finishDocument() is not defined.
In other words, the CDATA in the script element of the document tree returned by Ajax and parsed for XML is not converted to source in the global execution scope.
What am I missing?