mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
New style sytsem: add selector matching
Also make scribt::dom::element::Element::get_attr ASCII case-insensitive on attribute names, per spec: http://dom.spec.whatwg.org/#dom-element-getattribute
This commit is contained in:
parent
226ccf7e72
commit
20089e4bea
6 changed files with 312 additions and 51 deletions
|
@ -131,7 +131,8 @@ impl<'self> Element {
|
|||
pub fn get_attr(&'self self, name: &str) -> Option<&'self str> {
|
||||
// FIXME: Need an each() that links lifetimes in Rust.
|
||||
for attr in self.attrs.iter() {
|
||||
if eq_slice(attr.name, name) {
|
||||
// FIXME: only case-insensitive in the HTML namespace (as opposed to SVG, etc.)
|
||||
if attr.name.eq_ignore_ascii_case(name) {
|
||||
let val: &str = attr.value;
|
||||
return Some(val);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue