diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-09-12 17:17:22 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-09-13 23:40:24 +0200 |
commit | 650afc9d3e0d351df493e11831b1c072f79e8889 (patch) | |
tree | 5331507cce86913a1f77d331a45e515ae85ca58d /components/script/dom/node.rs | |
parent | d5ee58caf269779e86b2efc50ddf37d3e4eba9b9 (diff) | |
download | servo-650afc9d3e0d351df493e11831b1c072f79e8889.tar.gz servo-650afc9d3e0d351df493e11831b1c072f79e8889.zip |
Fix cloning of Element's attributes
No virtual method was invoked when copies of attributes were appended to
newly-cloned elements.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index ae725d3d856..c9e78200c99 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1768,15 +1768,12 @@ impl Node { let node_elem = ElementCast::to_ref(node).unwrap(); let copy_elem = ElementCast::to_ref(copy.r()).unwrap(); - let window = document.r().window(); - for ref attr in &*node_elem.attrs() { - let attr = attr.root(); - let newattr = - Attr::new(window.r(), - attr.r().local_name().clone(), attr.r().value().clone(), - attr.r().name().clone(), attr.r().namespace().clone(), - attr.r().prefix().clone(), Some(copy_elem)); - copy_elem.attrs_mut().push(JS::from_rooted(&newattr)); + for attr in node_elem.attrs().iter().map(JS::root) { + copy_elem.push_new_attribute(attr.local_name().clone(), + attr.value().clone(), + attr.name().clone(), + attr.namespace().clone(), + attr.prefix().clone()); } }, _ => () |