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] Describe how the StylePropertyMaps should interact with custom properties #276

Closed
wilddamon opened this Issue Aug 10, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@wilddamon
Contributor

wilddamon commented Aug 10, 2016

Especially when using getProperties() and when using the iterators, and whether you should be able to set/get custom properties.

@shans shans self-assigned this Aug 11, 2016

@shans

This comment has been minimized.

Show comment
Hide comment
@shans

shans Apr 3, 2017

Contributor

strawperson suggestion:

You should be able to get/set custom properties on inline and specified styles. You should be able to get custom properties on computed style.

getProperties:

  • For inline style, should return the custom properties that are set on the inline style of the current node
  • For specified style, should return the custom properties defined in the current rule
  • For computed style, should return all defined custom properties on the current node (including inheritance)
Contributor

shans commented Apr 3, 2017

strawperson suggestion:

You should be able to get/set custom properties on inline and specified styles. You should be able to get custom properties on computed style.

getProperties:

  • For inline style, should return the custom properties that are set on the inline style of the current node
  • For specified style, should return the custom properties defined in the current rule
  • For computed style, should return all defined custom properties on the current node (including inheritance)

@shans shans changed the title from [css-typed-om] Describe how the StylePropertyMaps should interact with custom properties and @apply to [css-typed-om] Describe how the StylePropertyMaps should interact with custom properties Apr 3, 2017

@shans

This comment has been minimized.

Show comment
Hide comment
@shans

shans Apr 3, 2017

Contributor

(removing @apply because that isn't likely to happen any time soon)

Contributor

shans commented Apr 3, 2017

(removing @apply because that isn't likely to happen any time soon)

@tabatkins

This comment has been minimized.

Show comment
Hide comment
@tabatkins

tabatkins Apr 3, 2017

Member

+1 to all three of those getProperties lines

Member

tabatkins commented Apr 3, 2017

+1 to all three of those getProperties lines

@tabatkins

This comment has been minimized.

Show comment
Hide comment
@tabatkins

tabatkins Apr 18, 2017

Member

For typed custom properties with an initial value, they should show up in the computed style map.

Member

tabatkins commented Apr 18, 2017

For typed custom properties with an initial value, they should show up in the computed style map.

@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 #276, and agreed to the following resolutions:

RESOLVED: custom properties that have an initial value show up in computed style, warn authors about perf issues if they type everything all the time
RESOLVED: For inline style, should return the custom properties that are set on the inline style of the current node
RESOLVED: For specified style, should return the custom properties defined in the current rule
RESOLVED: For computed style, should return all defined custom properties on the current node (including inheritance)
The full IRC log of that discussion
<shane> Topic: https://github.com/w3c/css-houdini-drafts/issues/276
<fantasai> TabAtkins: We need to clarify how stye map works with custom properties
<shane> For inline style, should return the custom properties that are set on the inline style of the current node
<shane> For specified style, should return the custom properties defined in the current rule
<shane> For computed style, should return all defined custom properties on the current node (including inheritance)
<Rossen> s/inline style map/inline style attribute map/
<fantasai> TabAtkins: Suggestion from shane is that for style attribues, custom properties set in style attr should be included
<fantasai> TabAtkins: For style rule, include those custom properties in that style rule
<fantasai> TabAtkins: [what shane [posted]
<fantasai> iank_: If you register a custom property, it won't show up automatically?
<fantasai> TabAtkins: no
<fantasai> shane: What if you registered it with an initial value?
<fantasai> iank_: That's what I meant
<fantasai> TabAtkins: That's a good question
<fantasai> iank_: ...
<fantasai> dbaron: That has a computed value then, so it should show up
<fantasai> shane: Just in computed value then, not in specified/inline
<fantasai> shane: I wonder if we want to allow having an invalid initial value?
<fantasai> TabAtkins: You can, have an unregistered property with grammar of *
<fantasai> SimonSapin: What happens in old style CSSOM?
<fantasai> TabAtkins: Undefined, but hopefully consistent
<fantasai> iank_: It would make sense that all registered properties appear in computed style maps
<fantasai> TabAtkins: [...]
<fantasai> shane: One pattern we've seen with untyped custom properties is that people use them like macros
<fantasai> shane: They put a lot of them at the root node
<fantasai> shane: to represent colors that might be use don the page, etc.
<fantasai> shane: Not uncommon to see pages iwth one or more custom properties defined
<fantasai> shane: Relatively easy to keep performant if not referenced much
<fantasai> shane: But coudl be an issue for typed properties if the same pattern used, because significantly increases size of ocmptued value map
<fantasai> shane: It would be bad if ppl typed their untyped custom properties
<fantasai> shane: At the very least, should provide suggestion that ppl don't do that
<fantasai> shane: But might want to look into CSS API for that
<fantasai> TabAtkins: currently only JS api for registering, somost of these cases likely won't do that...
<fantasai> shane: So, should typed custom properties show up in computed style?
<fantasai> RESOLVED: custom properties that have an initial value show up in computed style, warn authors about perf issues if they type everything all the time
<fantasai> RESOLVED: For inline style, should return the custom properties that are set on the inline style of the current node
<fantasai> RESOLVED: For specified style, should return the custom properties defined in the current rule
<fantasai> RESOLVED: For computed style, should return all defined custom properties on the current node (including inheritance)
<fantasai> iank_: We also may come back later with impl experince to say this was a terrible idea, but we'll see
Member

css-meeting-bot commented Apr 18, 2017

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

RESOLVED: custom properties that have an initial value show up in computed style, warn authors about perf issues if they type everything all the time
RESOLVED: For inline style, should return the custom properties that are set on the inline style of the current node
RESOLVED: For specified style, should return the custom properties defined in the current rule
RESOLVED: For computed style, should return all defined custom properties on the current node (including inheritance)
The full IRC log of that discussion
<shane> Topic: https://github.com/w3c/css-houdini-drafts/issues/276
<fantasai> TabAtkins: We need to clarify how stye map works with custom properties
<shane> For inline style, should return the custom properties that are set on the inline style of the current node
<shane> For specified style, should return the custom properties defined in the current rule
<shane> For computed style, should return all defined custom properties on the current node (including inheritance)
<Rossen> s/inline style map/inline style attribute map/
<fantasai> TabAtkins: Suggestion from shane is that for style attribues, custom properties set in style attr should be included
<fantasai> TabAtkins: For style rule, include those custom properties in that style rule
<fantasai> TabAtkins: [what shane [posted]
<fantasai> iank_: If you register a custom property, it won't show up automatically?
<fantasai> TabAtkins: no
<fantasai> shane: What if you registered it with an initial value?
<fantasai> iank_: That's what I meant
<fantasai> TabAtkins: That's a good question
<fantasai> iank_: ...
<fantasai> dbaron: That has a computed value then, so it should show up
<fantasai> shane: Just in computed value then, not in specified/inline
<fantasai> shane: I wonder if we want to allow having an invalid initial value?
<fantasai> TabAtkins: You can, have an unregistered property with grammar of *
<fantasai> SimonSapin: What happens in old style CSSOM?
<fantasai> TabAtkins: Undefined, but hopefully consistent
<fantasai> iank_: It would make sense that all registered properties appear in computed style maps
<fantasai> TabAtkins: [...]
<fantasai> shane: One pattern we've seen with untyped custom properties is that people use them like macros
<fantasai> shane: They put a lot of them at the root node
<fantasai> shane: to represent colors that might be use don the page, etc.
<fantasai> shane: Not uncommon to see pages iwth one or more custom properties defined
<fantasai> shane: Relatively easy to keep performant if not referenced much
<fantasai> shane: But coudl be an issue for typed properties if the same pattern used, because significantly increases size of ocmptued value map
<fantasai> shane: It would be bad if ppl typed their untyped custom properties
<fantasai> shane: At the very least, should provide suggestion that ppl don't do that
<fantasai> shane: But might want to look into CSS API for that
<fantasai> TabAtkins: currently only JS api for registering, somost of these cases likely won't do that...
<fantasai> shane: So, should typed custom properties show up in computed style?
<fantasai> RESOLVED: custom properties that have an initial value show up in computed style, warn authors about perf issues if they type everything all the time
<fantasai> RESOLVED: For inline style, should return the custom properties that are set on the inline style of the current node
<fantasai> RESOLVED: For specified style, should return the custom properties defined in the current rule
<fantasai> RESOLVED: For computed style, should return all defined custom properties on the current node (including inheritance)
<fantasai> iank_: We also may come back later with impl experince to say this was a terrible idea, but we'll see
@tabatkins

This comment has been minimized.

Show comment
Hide comment
@tabatkins

tabatkins Feb 1, 2018

Member

I went into more detail with this in 2519d4b and a preceding commit about the computed style.

Member

tabatkins commented Feb 1, 2018

I went into more detail with this in 2519d4b and a preceding commit about the computed style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment