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:
Simon Sapin 2013-10-01 23:59:00 +01:00
parent 226ccf7e72
commit 20089e4bea
6 changed files with 312 additions and 51 deletions

View file

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