Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
esprehn opened this issue Sep 22, 2016 · 3 comments
Open

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

esprehn opened this issue Sep 22, 2016 · 3 comments

Comments

@esprehn
Copy link

@esprehn esprehn commented Sep 22, 2016

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. 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

@bzbarsky
Copy link

@bzbarsky bzbarsky commented Sep 22, 2016

The name collision thing can be addressed by having an extra object:

element.styleMap.makeUpNameHere.color

That doesn't do anything for the other disadvantages, though.

@shans
Copy link
Contributor

@shans shans commented Apr 3, 2017

Another disadvantage is that people might think
element.styleMap.color.red += 20;
should work.

@css-meeting-bot
Copy link
Member

@css-meeting-bot css-meeting-bot commented Apr 18, 2017

The CSS Working Group just discussed #310, and agreed to the following resolutions:

RESOLVED: using properties (issue #310) is moved to L2
The full IRC log of that discussion
<shane> Topic: https://github.com/w3c/css-houdini-drafts/issues/310
<dbaron> Github topic: https://github.com/w3c/css-houdini-drafts/issues/310
<fantasai> shane: I want to either say No or wait until level 2 to consider this
<fantasai> Rossen: I'd be fine for that
<fantasai> RESOLVED: using properties (issue #310) is moved to L2
nainar added a commit that referenced this issue Oct 17, 2017
[css-typed-om] Remove issue #310 from text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants