auto merge of #1557 : Ms2ger/servo/fix-attr, r=SimonSapin

This commit is contained in:
bors-servo 2014-01-25 10:40:08 -08:00
commit c234132841
4 changed files with 18 additions and 4 deletions

View file

@ -157,16 +157,15 @@ impl Element {
}).map(|&x| x)
}
#[inline]
pub unsafe fn get_attr_val_for_layout(&self, namespace: Namespace, name: &str)
-> Option<&'static str> {
// FIXME: only case-insensitive in the HTML namespace (as opposed to SVG, etc.)
let name = name.to_ascii_lower();
self.attrs.iter().find(|attr: & &@mut Attr| {
// unsafely avoid a borrow because this is accessed by many tasks
// during parallel layout
// FIXME: only case-insensitive in the HTML namespace (as opposed to SVG, etc.)
let attr: ***Box<Attr> = cast::transmute(attr);
name.eq_ignore_ascii_case((***attr).data.local_name) &&
(***attr).data.namespace == namespace
name == (***attr).data.local_name && (***attr).data.namespace == namespace
}).map(|attr| {
let attr: **Box<Attr> = cast::transmute(attr);
cast::transmute((**attr).data.value.as_slice())

View file

@ -23,3 +23,4 @@
== font_size_percentage.html font_size_em_ref.html
== position_fixed_a.html position_fixed_b.html
== img_size_a.html img_size_b.html
== upper_id_attr.html upper_id_attr_ref.html

View file

@ -0,0 +1,9 @@
<!doctype html>
<style>
div { height: 2em; background: green; }
#id { background: red; }
</style>
<div></div>
<script>
document.body.firstChild.setAttributeNS("", "ID", "id");
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
<style>
div { height: 2em; background: green; }
</style>
<div></div>