Skip to content

Conversation

@nainar
Copy link
Contributor

@nainar nainar commented Feb 1, 2018

@darrnshn PTAL? Thanks!

@nainar nainar requested review from darrnshn and tabatkins February 1, 2018 09:45
Copy link
Collaborator

@darrnshn darrnshn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/extensable/extensible

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/propeerty/property

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done * 3


## Motivation

The benefits of CSS Typed OM are as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/are as follows/include :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe collapse this into two top level bullet points so it looks like there's more? :P

Copy link
Contributor Author

@nainar nainar Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol no :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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe somehow indicate that this is the old way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/of/from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

## 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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're gonna get shorthand for Level 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to do gradients for level 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Corresponding FontFaceValue for `@font-face` rules,
* Support for the following:
* Colors
* URLs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URLs that are not images, since those are CSSImageValues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Counters,
* etc.

## Conclusion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name this "Try it out!" or something exciting 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol Done

@plinss
Copy link
Member

plinss commented Feb 1, 2018

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 "ⓘ").

Copy link
Contributor Author

@nainar nainar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done * 3


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:
Copy link
Contributor Author

@nainar nainar Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol no :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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


To get the specified height of an element we would use the following JS:
```
element.attributeStyleMap.get('height');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

## 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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Corresponding FontFaceValue for `@font-face` rules,
* Support for the following:
* Colors
* URLs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Counters,
* etc.

## Conclusion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol Done

@nainar
Copy link
Contributor Author

nainar commented Feb 1, 2018

@plinss thanks - will change the name!

@nainar nainar changed the title Create EXPLAINER.md first draft Create README.md for css-typed-om Feb 1, 2018
Copy link
Collaborator

@darrnshn darrnshn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe s/the/an? It's probably not the extensible API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comma between "in CSSOM" and "we get them"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

element.computedStyleMap().get('height'); // returns a CSSUnitValue
```

### Changing a propert's value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/propert/property

#### 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)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraneous line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@nainar nainar merged commit 97820a6 into master Feb 16, 2018
@plinss plinss deleted the typedom_explainer branch February 17, 2018 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants