diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c0570ad83cc..f279c2c279b 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1543,6 +1543,10 @@ impl ElementMethods for Element { // https://dom.spec.whatwg.org/#dom-element-setattributenode fn SetAttributeNode(&self, attr: &Attr) -> Fallible>> { + // Workaround for https://github.com/servo/servo/issues/17366 + // This ensures that if this is an "id" attr, its value is an Atom + attr.swap_value(&mut self.parse_plain_attribute(attr.local_name(), attr.Value())); + // Step 1. if let Some(owner) = attr.GetOwnerElement() { if &*owner != self { diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index a00f24adf92..01813e5779b 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -13024,6 +13024,12 @@ {} ] ], + "mozilla/element_setAttributeNode.html": [ + [ + "/_mozilla/mozilla/element_setAttributeNode.html", + {} + ] + ], "mozilla/empty_clientrect.html": [ [ "/_mozilla/mozilla/empty_clientrect.html", @@ -25731,6 +25737,10 @@ "9ddf84332ca6efa6390315f20d59be2964a69dc7", "testharness" ], + "mozilla/element_setAttributeNode.html": [ + "4159931c8fc73a2305fa3d3bfe988132f38b4975", + "testharness" + ], "mozilla/empty_clientrect.html": [ "0860a059be4885f2b48de1aa7d87b8d0a7058195", "testharness" diff --git a/tests/wpt/mozilla/tests/mozilla/element_setAttributeNode.html b/tests/wpt/mozilla/tests/mozilla/element_setAttributeNode.html new file mode 100644 index 00000000000..b7c4964a135 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/element_setAttributeNode.html @@ -0,0 +1,16 @@ + + +Element setAttributeNode + + +
+