From 263ad233b285dfd2b9b8e0dd11881a0ac46d6997 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Tue, 25 Jul 2017 11:43:18 +1000 Subject: [PATCH 1/3] refactor out value type-checking logic from CSSStyleValue.append to fix issue #145 --- css-typed-om/Overview.bs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 551a0dd5..39e5ff15 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -250,18 +250,24 @@ The append(DOMString property, 5. Let |values to append| be the empty list. - 6. For each |value| in |values|: + 6. For each |value| in |values| if the [=algorithm to check if any given value is of a certain type=] described below exits + gracefully append the returned object to |values to append| + + 7. Append |values to append| to the end of |entry|’s list. + + +
+ This section describes the algorithm to check if any given |value| is of a certain type: : 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|.
From add576dc1a79ce96c08bf396dc9a0fa13853ffc8 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Tue, 25 Jul 2017 11:56:58 +1000 Subject: [PATCH 2/3] Remove issue from spec --- css-typed-om/Overview.bs | 2 -- 1 file changed, 2 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 39e5ff15..2fbe0181 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -313,8 +313,6 @@ the [=property model=]. This list of properties is sorted in the following manne * custom properties are sorted by increasing code point order. * custom properties are sorted after normal properties. -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(149): describe that these are not live objects From 89374a62da57faca16a7df68121d1b07912450b0 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Tue, 25 Jul 2017 13:26:52 +1000 Subject: [PATCH 3/3] Fix up algorithm referencing --- css-typed-om/Overview.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 2fbe0181..61c25b35 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -250,14 +250,13 @@ The append(DOMString property, 5. Let |values to append| be the empty list. - 6. For each |value| in |values| if the [=algorithm to check if any given value is of a certain type=] described below exits - gracefully append the returned object to |values to append| + 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.
- This section describes the algorithm to check if any given |value| is of a certain type: + This section describes the algorithm that coerces value into an appropriate type for a given property, por 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.