Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions css-typed-om/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,23 @@ The <dfn method for=StylePropertyMap>append(DOMString <var>property</var>,

5. Let |values to append| be the empty list.

6. For each |value| in |values|:
6. For each |value| in |values| if the [=algorithm that coerces value into an appropriate type for a given property=] does not throw an error, append the returned object to |values to append|.

7. Append |values to append| to the end of |entry|’s list.
</div>

<div algorithm>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this algorithm coerces |value| into an appropriate type, as it attempts to convert DOMStrings. Also describe how it fails (i.e. by throwing a TypeError)

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.

This section describes the <dfn>algorithm that coerces value into an appropriate type for a given property</dfn>, or fails and throws a {{TypeError}}:
: If |value| is a {{CSSStyleValue}},
:: If |value| does not match the grammar of a [=list-valued property iteration=] of |property|,
[=throw=] a {{TypeError}} and exit this algorithm.
Otherwise, append |value| to the end of |values to append|.
Otherwise, return the |value|.
: If |value| is a {{DOMString}},
:: [=Parse a CSSStyleValue=] with property |property| and value |value|.
:: [=Parse a CSSStyleValue=] with property |property| and value |value| and return the resulting |value|.
If the result is null,
[=throw=] a {{TypeError}} and exit this algorithm.
Otherwise, append each [=list-valued property iteration=] in the result to the end of |values to append|.

7. Append |values to append| to the end of |entry|’s list.
Otherwise, append each [=list-valued property iteration=] in the result to a |values to append| object
and return |values to append|.
</div>

<div algorithm>
Expand Down Expand Up @@ -309,8 +314,6 @@ the [=property model=]. This list of properties is sorted in the following manne

[=computed StylePropertyMap=], [=declared StylePropertyMap=] and [=inline StylePropertyMap=] are all live objects: the attributes and methods on these objects must operate on the actual underlying data, not a snapshot of the data.

Issue(145): should refactor out value type-checking, as it'll be needed by the rest of the setters too

Issue(148): add detailed descriptions of the rest of the methods on {{StylePropertyMap}}

Issue(268): stringification
Expand Down