Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

special handling of <script> #125

Open
gagern opened this issue May 18, 2015 · 0 comments
Open

special handling of <script> #125

gagern opened this issue May 18, 2015 · 0 comments

Comments

@gagern
Copy link

gagern commented May 18, 2015

When parsing application/xml, then there should be no special case for the HTML <script> tag. In particular,

new xmldom.DOMParser().parseFromString(
  '<html xmlns="http://www.w3.org/1999/xhtml"><head><script> a < b </script></head></html>',
  'application/xml');

should report an error and

var doc = new xmldom.DOMParser().parseFromString(
  '<html xmlns="http://www.w3.org/1999/xhtml">'+
  '<head><script><![CDATA[ text="]]]><![CDATA[]>"; ]]></script></head>'+
  '<body><p><![CDATA[ text ]]></p></body></html>', 'application/xml');

should result in doc.textContent === ' text="]]>"; text '. The serializer should not make the assumption that a <script> tag will contain at most single child which is a text node.

I know you probably had all the best intentions in mind with this, but it breaks interoperability with other tools, since the result will not be well-formed XML. There are situations where you want to embed XHTML into other stuff, to be processed by some later stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant