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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

Show comment
Hide comment
@bzbarsky

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

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

This comment has been minimized.

Show comment
Hide comment
@shans

shans Apr 3, 2017

Contributor

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

Contributor

shans commented Apr 3, 2017

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

@css-meeting-bot

This comment has been minimized.

Show comment
Hide comment
@css-meeting-bot

css-meeting-bot Apr 18, 2017

Member

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
Member

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

@shans shans added css-typed-om-2 and removed css-typed-om-1 labels Apr 18, 2017

nainar added a commit that referenced this issue Oct 17, 2017

Merge pull request #481 from darrnshn/issue/310
[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