diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-04-18 16:58:17 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-04-18 17:51:03 +0200 |
commit | 0042f78aa71d20914ee29b077510b9944401aaef (patch) | |
tree | e9b7bc761bbaa471a6b894cc86de8d69ec19d561 /components/script/dom | |
parent | 21d3ddabbf1ad51492d730bac3a838b78c1f6f17 (diff) | |
download | servo-0042f78aa71d20914ee29b077510b9944401aaef.tar.gz servo-0042f78aa71d20914ee29b077510b9944401aaef.zip |
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.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/element.rs | 9 |
1 files changed, 2 insertions, 7 deletions
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<Attr>| { - 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() }) } |