Create README.md for css-typed-om#622
Conversation
darrnshn
left a comment
There was a problem hiding this comment.
Cool, looks good overall. Just some small suggestions and typos.
| @@ -0,0 +1,117 @@ | |||
| # CSS Typed OM Explained | |||
|
|
|||
| CSS Typed OM is the extensable API for the CSSOM that reduces the burden of manipulating a CSS propeerty's value via string manipulation. It does so by exposing CSS values as typed JavaScript objects which help you circumvent the browser's CSS parser. | |||
There was a problem hiding this comment.
not just the browser's CSS parser, but also JavaScript CSS parsers. Maybe something like "typed JavaScript objects to avoid string parsing", or even just "typed JavaScript objects rather than strings".
|
|
||
| ## Motivation | ||
|
|
||
| The benefits of CSS Typed OM are as follows: |
There was a problem hiding this comment.
s/are as follows/include :P
There was a problem hiding this comment.
Done. Sorry forgot to send this before.
|
|
||
| The benefits of CSS Typed OM are as follows: | ||
| * Allows the performant manipulation of values assigned to CSS properties. | ||
| * Being able to write more maintainable code: |
There was a problem hiding this comment.
Maybe collapse this into two top level bullet points so it looks like there's more? :P
|
|
||
| ### Getting a property's value | ||
|
|
||
| To get specified and computed values for CSS properties of an element in CSSOM we get them via accessing them of the `.style` attribute on an element and the `getComputedStyle()` object respectively. |
There was a problem hiding this comment.
Maybe somehow indicate that this is the old way?
|
|
||
| To get specified and computed values for CSS properties of an element in CSSOM we get them via accessing them of the `.style` attribute on an element and the `getComputedStyle()` object respectively. | ||
|
|
||
| In Typed OM we get them of `StylePropertyMaps` on elements. |
| ## Future Capabilities | ||
|
|
||
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, |
There was a problem hiding this comment.
I think we're gonna get shorthand for Level 1
|
|
||
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, | ||
| * Support for gradients, |
There was a problem hiding this comment.
I'm planning to do gradients for level 1.
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, | ||
| * Support for gradients, | ||
| * Corresponding FontFaceValue for `@font-face` rules, |
There was a problem hiding this comment.
I would just put this as part of the next list as Fonts. I don't know if we're going to represent actual CSS rules as objects.
| * Corresponding FontFaceValue for `@font-face` rules, | ||
| * Support for the following: | ||
| * Colors | ||
| * URLs |
There was a problem hiding this comment.
URLs that are not images, since those are CSSImageValues.
| * Counters, | ||
| * etc. | ||
|
|
||
| ## Conclusion |
There was a problem hiding this comment.
Maybe name this "Try it out!" or something exciting 🎉
|
FWIW, if you name the file "README.md" instead of "EXPLAINER.md" you get an icon on the drafts home page linking to it (the "ⓘ"). |
nainar
left a comment
There was a problem hiding this comment.
darrnshn@ made the changes you asked for.
| @@ -0,0 +1,117 @@ | |||
| # CSS Typed OM Explained | |||
|
|
|||
| CSS Typed OM is the extensable API for the CSSOM that reduces the burden of manipulating a CSS propeerty's value via string manipulation. It does so by exposing CSS values as typed JavaScript objects which help you circumvent the browser's CSS parser. | |||
|
|
||
| The benefits of CSS Typed OM are as follows: | ||
| * Allows the performant manipulation of values assigned to CSS properties. | ||
| * Being able to write more maintainable code: |
|
|
||
| ### Getting a property's value | ||
|
|
||
| To get specified and computed values for CSS properties of an element in CSSOM we get them via accessing the 6D5E m of the `.style` attribute on an element and the `getComputedStyle()` object respectively. |
|
|
||
| To get specified and computed values for CSS properties of an element in CSSOM we get them via accessing them of the `.style` attribute on an element and the `getComputedStyle()` object respectively. | ||
|
|
||
| In Typed OM we get them of `StylePropertyMaps` on elements. |
|
|
||
| To get the specified height of an element we would use the following JS: | ||
| ``` | ||
| element.attributeStyleMap.get('height'); |
| ## Future Capabilities | ||
|
|
||
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, |
|
|
||
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, | ||
| * Support for gradients, |
| The current specification doesn't have support for the following, however they are under consideration for Typed OM Level 2: | ||
| * Support for shorthand properties, | ||
| * Support for gradients, | ||
| * Corresponding FontFaceValue for `@font-face` rules, |
| * Corresponding FontFaceValue for `@font-face` rules, | ||
| * Support for the following: | ||
| * Colors | ||
| * URLs |
| * Counters, | ||
| * etc. | ||
|
|
||
| ## Conclusion |
|
@plinss thanks - will change the name! |
darrnshn
left a comment
There was a problem hiding this comment.
LGTM, but get Tab to take a look.
| @@ -0,0 +1,116 @@ | |||
| # CSS Typed OM Explained | |||
|
|
|||
| CSS Typed OM is the extensible API for the CSSOM that reduces the burden of manipulating a CSS property's value via string manipulation. It does so by exposing CSS values as typed JavaScript objects rather than strings. | |||
There was a problem hiding this comment.
nit: maybe s/the/an? It's probably not the extensible API.
| ### Getting a property's value | ||
|
|
||
| In CSSOM land: | ||
| To get specified and computed values for CSS properties of an element in CSSOM we get them via accessing them of the `.style` attribute on an element and the `getComputedStyle()` object respectively. |
There was a problem hiding this comment.
maybe a comma between "in CSSOM" and "we get them"?
| element.computedStyleMap().get('height'); // returns a CSSUnitValue | ||
| ``` | ||
|
|
||
| ### Changing a propert's value |
| #### CSSResourceValue | ||
|
|
||
| [CSSResourceValue](https://drafts.css-houdini.org/css-typed-om-1/#resourcevalue-objects) objects represent CSS values that require an asynchronous network fetch. Hence, they also describe the status the resource is in. Properties with image values (e.g. `background-image`), are represented by [CSSImageValues](https://drafts.css-houdini.org/css-typed-om-1/#cssimagevalue) | ||
|
|
@darrnshn PTAL? Thanks!