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.
This commit is contained in:
Ms2ger 2015-04-18 16:58:17 +02:00
parent 21d3ddabbf
commit 0042f78aa7
2 changed files with 2 additions and 10 deletions

View file

@ -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()
})
}