Initial support for custom properties in CSSStyleDeclaration

This commit is contained in:
Simon Sapin 2015-09-11 17:44:53 +02:00
parent d56ea10770
commit feaf6f4c3f
9 changed files with 471 additions and 27 deletions

View file

@ -650,7 +650,7 @@ impl Element {
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
let index = declarations.normal
.iter()
.position(|decl| decl.name() == property);
.position(|decl| decl.matches(property));
if let Some(index) = index {
Arc::make_mut(&mut declarations.normal).remove(index);
return;
@ -658,7 +658,7 @@ impl Element {
let index = declarations.important
.iter()
.position(|decl| decl.name() == property);
.position(|decl| decl.matches(property));
if let Some(index) = index {
Arc::make_mut(&mut declarations.important).remove(index);
return;
@ -715,7 +715,8 @@ impl Element {
let to = Arc::make_mut(to);
let mut new_from = Vec::new();
for declaration in from.drain(..) {
if properties.contains(&declaration.name()) {
let name = declaration.name();
if properties.iter().any(|p| name == **p) {
to.push(declaration)
} else {
new_from.push(declaration)