Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[css-typed-om] Consider using properties in addition to .get/.set #310
Real properties are faster since we can cache the property lookup, ex.
element.styleMap.color // => JS VM can cache the lookup for color
It also lets the getter/setter cache the "color" => engine representation conversion where most (all?) engines convert to an enum as there's a specific method for every property.
Note we'd still need .get(name) and .set(name) to deal with custom properties, since we don't want to add more named getters, ex.
The disadvantage of this approach is that it means StyleMap has 400+ properties like CSSStyleDeclaration does, and every new CSS property is implicitly adding new properties. It also means if maps get a new method called "filter", and we wanted StyleMap to be really maplike, we'd end up colliding with CSS's filter property.
The CSS Working Group just discussed #310, and agreed to the following resolutions:
The full IRC log of that discussion