From 0042f78aa71d20914ee29b077510b9944401aaef Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 18 Apr 2015 16:58:17 +0200 Subject: [PATCH] Use get_attr_for_layout in get_classes_for_layout. This fixes a bug with elements with multiple class attributes. In this case, the class attribute in the null namespace would only be considered if it was the first class attribute in the list. --- components/script/dom/element.rs | 9 ++------- tests/wpt/mozilla/meta/css/class-namespaces.html.ini | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 tests/wpt/mozilla/meta/css/class-namespaces.html.ini diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 06eae2592c7..88366f591d2 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -221,13 +221,8 @@ impl RawLayoutElementHelpers for Element { #[inline] unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> { - let attrs = self.attrs.borrow_for_layout(); - (*attrs).iter().find(|attr: & &JS| { - let attr = attr.to_layout().unsafe_get(); - (*attr).local_name_atom_forever() == atom!("class") - }).and_then(|attr| { - let attr = attr.to_layout().unsafe_get(); - (*attr).value_tokens_forever() + get_attr_for_layout(self, &ns!(""), &atom!("class")).map(|attr| { + (*attr.unsafe_get()).value_tokens_forever().unwrap() }) } diff --git a/tests/wpt/mozilla/meta/css/class-namespaces.html.ini b/tests/wpt/mozilla/meta/css/class-namespaces.html.ini deleted file mode 100644 index abf49ed322c..00000000000 --- a/tests/wpt/mozilla/meta/css/class-namespaces.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[class-namespaces.html] - type: reftest - expected: FAIL