mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix cloning of Element's attributes
No virtual method was invoked when copies of attributes were appended to newly-cloned elements.
This commit is contained in:
parent
d5ee58caf2
commit
650afc9d3e
4 changed files with 10 additions and 56 deletions
|
@ -83,7 +83,7 @@ use url::UrlParser;
|
|||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
use std::cell::{Ref, RefMut};
|
||||
use std::cell::Ref;
|
||||
use std::default::Default;
|
||||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
|
@ -597,10 +597,6 @@ impl Element {
|
|||
self.attrs.borrow()
|
||||
}
|
||||
|
||||
pub fn attrs_mut(&self) -> RefMut<Vec<JS<Attr>>> {
|
||||
self.attrs.borrow_mut()
|
||||
}
|
||||
|
||||
pub fn style_attribute(&self) -> &DOMRefCell<Option<PropertyDeclarationBlock>> {
|
||||
&self.style_attribute
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
},
|
||||
_ => ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue