mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
auto merge of #1533 : metajack/servo/unsafe-get-attr, r=jdm
The old code was used by both layout and script, but was erroneously borrowing for the layout case (which causes parallelism problems). script now uses only `value_ref()` or `get_attribute()`, and layout now has its own unsafe version that dances around the borrows of `@mut Attr`.
This commit is contained in:
commit
d11e431887
9 changed files with 50 additions and 34 deletions
|
@ -381,7 +381,7 @@ impl Document {
|
|||
|
||||
pub fn GetElementsByName(&self, name: DOMString) -> @mut HTMLCollection {
|
||||
self.createHTMLCollection(|elem|
|
||||
elem.get_attr(Null, "name").is_some() && eq_slice(elem.get_attr(Null, "name").unwrap(), name))
|
||||
elem.get_attribute(Null, "name").is_some() && eq_slice(elem.get_attribute(Null, "name").unwrap().value_ref(), name))
|
||||
}
|
||||
|
||||
pub fn createHTMLCollection(&self, callback: |elem: &Element| -> bool) -> @mut HTMLCollection {
|
||||
|
@ -471,9 +471,9 @@ fn foreach_ided_elements(root: &AbstractNode, callback: |&DOMString, &AbstractNo
|
|||
}
|
||||
|
||||
node.with_imm_element(|element| {
|
||||
match element.get_attr(Null, "id") {
|
||||
match element.get_attribute(Null, "id") {
|
||||
Some(id) => {
|
||||
callback(&id.to_str(), &node);
|
||||
callback(&id.Value(), &node);
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue