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

External scripts in an XML document mess up the namespace map #19087

Closed
jdm opened this issue Nov 1, 2017 · 1 comment
Closed

External scripts in an XML document mess up the namespace map #19087

jdm opened this issue Nov 1, 2017 · 1 comment

Comments

@jdm
Copy link
Member

@jdm jdm commented Nov 1, 2017

foo.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src='foo.js' />
</head>
<body>
<script>console.log('inline script')</script>
</body>
</html>

foo.js:

console.log('external script')

When loaded from a server that provides the application/xhtml+xml, this yields the output:

external script

because the inline script element receives an empty namespace when it's being created by the parser, so we only create an Element instead of an HTMLScriptElement.

bors-servo added a commit to servo/html5ever that referenced this issue Nov 2, 2017
Reset namespace stack when processing an empty script tag

This addresses the problem from servo/servo#19087. Non-script empty tags go through the `append_tag` code path which does not pop anything from the namespace stack. Empty script tags go through insert_tag/close_tag instead, which does pop an element from the namespace stack.
@jdm
Copy link
Member Author

@jdm jdm commented Feb 5, 2018

@jdm jdm closed this Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.