Skip to content

Fix issue 325 by adding algo for equals() #412

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

Merged
merged 7 commits into from
Jun 30, 2017
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
25 changes: 20 additions & 5 deletions css-typed-om/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ and parseMultiple set to true.

Issue(305): appropriate failure indicators for this algorithm

Issue(325): .equals methods for CSSStyleValue subclasses

<!--
██████ ████████ ██ ██ ██ ████████ ██ ██ ███ ████████
██ ██ ██ ██ ██ ██ ██ ███ ███ ██ ██ ██ ██
Expand Down Expand Up @@ -577,7 +575,6 @@ are represented by subclasses of the {{CSSNumericValue}} interface.
CSSNumericValue sub(CSSNumberish... values);
CSSNumericValue mul(CSSNumberish... values);
CSSNumericValue div(CSSNumberish... values);

CSSNumericValue min(CSSNumberish... values);
CSSNumericValue max(CSSNumberish... values);

Expand Down Expand Up @@ -754,10 +751,28 @@ The following are the arithmetic operations you can perform on dimensions:
is set to |values|.
</div>

<div class=issue>
Define {{CSSNumericValue/equals()}}.
<div algorithm="CSSNumericValue.equals(value)">
The <dfn for=CSSNumericValue method>equals(...|values|)</dfn> method,
when called on a {{CSSNumericValue}} |this|,
must perform the following steps:

1. Replace each [=list/item=] of |values|
with the result of [=rectifying a numberish value=] for the [=list/item=].

2. Let |thisAndValues| be |this| prepended to |values|.

3. [=list/If all=] |item|s of |thisAndValues| do not belong to the same class return false. Example: all items in |thisAndValues| must be {{CSSUnitValue}}.

4. [=list/If all=] |item|s in |thisAndValues| are {{CSSUnitValue}s and have the same {{CSSUnitValue/unit}} and {{CSSUnitValue/value}} return true.

5. [=list/If all=] |item|s in |thisAndValues| are {{CSSMathValue}}s :
1. If |thisAndValues| are all either {{CSSMathSum}}, {{CSSMathProduct}}, {{CSSMathMin}} or {{CSSMathMax}}, iterate over the {{CSSNumericArray}}s on |thisAndValues|,
1. For each {{CSSNumericValue}} in each of the {{CSSNumericArray}}s go back to step 1 to check that the {{CSSUnitValue}}s on all items in |thisAndValue| are equal.
2. If |this| and |value| are both either {{CSSMathNegate}} or {{CSSMathInvert}}:
1. Go back to step 1 to check that the {{CSSUnitValue}} on all items in |thisAndValue| are equal.
</div>


<div algorithm="CSSNumericValue.to()">
The <dfn method for=CSSNumericValue>to(|unit|)</dfn> method converts an existing {{CSSNumericValue}} |this|
into another one with the specified |unit|,
Expand Down