[css-houdini-drafts] [css-typed-om] Consider using properties in addition to .get/.set

esprehn has just created a new issue for 
https://github.com/w3c/css-houdini-drafts:

== [css-typed-om]  Consider using properties in addition to .get/.set 
==
Real properties are faster since we can cache the property lookup, ex.

```js
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. 
`map.get("--foo").` vs `map["--foo"]`.

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.

@bzbarsky

Please view or discuss this issue at 
https://github.com/w3c/css-houdini-drafts/issues/310 using your GitHub
 account

Received on Thursday, 22 September 2016 10:58:37 UTC