Skip to content

Commit 3c993fa

Browse files
committed
Reset namespace stack when processing an empty script tag.
1 parent 7fc8210 commit 3c993fa

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

xml5ever/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "xml5ever"
4-
version = "0.11.0"
4+
version = "0.11.1"
55
authors = ["The xml5ever project developers"]
66
license = "MIT / Apache-2.0"
77
repository = "https://github.com/servo/html5ever"

xml5ever/src/tree_builder/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ impl<Handle, Sink> XmlTreeBuilder<Handle, Sink>
372372
// Finally, we dump current namespace if its unneeded.
373373
let x = mem::replace(&mut self.current_namespace, NamespaceMap::empty());
374374

375-
// Only start tag doesn't dump current namespace.
376-
if tag.kind == StartTag {
375+
// Only start tag doesn't dump current namespace. However, <script /> is treated
376+
// differently than every other empty tag, so it needs to retain the current
377+
// namespace as well.
378+
if tag.kind == StartTag || (tag.kind == EmptyTag && tag.name.local == local_name!("script")) {
377379
self.namespace_stack.push(x);
378380
}
379381

0 commit comments

Comments
 (0)