From c06ae22227fb215fa1147dbbce00e40615bf667c Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Mon, 4 Apr 2016 13:06:34 +1000 Subject: [PATCH 1/6] Add prose regarding SyntaxError --- css-typed-om/Overview.bs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 466214e9..0d5b53b1 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -294,13 +294,13 @@ dictionary CalcDictionary { }; interface LengthValue : StyleValue { - LengthValue add(LengthValue value); // can throw - LengthValue subtract(LengthValue value); // can throw - LengthValue multiply(double value); // can throw - LengthValue divide(double value); // can throw - static LengthValue parse(DOMString cssText); - static LengthValue fromValue(double value, LengthType type); - static LengthValue fromDictionary(CalcDictionary dictionary); + LengthValue add(LengthValue value); // can throw SyntaxError + LengthValue subtract(LengthValue value); // can throw SyntaxError + LengthValue multiply(double value); // can throw SyntaxError + LengthValue divide(double value); // can throw SyntaxError + static LengthValue parse(DOMString cssText); // can throw SyntaxError + static LengthValue fromValue(double value, LengthType type); // can throw SyntaxError + static LengthValue fromDictionary(CalcDictionary dictionary); // can throw SyntaxError }; [Constructor(DOMString cssText), @@ -336,6 +336,8 @@ interface SimpleLength : LengthValue { }; +If the provided DOMString or {{LengthValue}} is invalid the relevant function throws a SyntaxError. + Issue(165): do we want an enum of length keywords too? Issue(167): write long descriptions of all of this @@ -344,8 +346,6 @@ Issue(168): There are now 3 ways of creating Length values - StyleValue.parse, CalcLength/SimpleLength constructors, and LengthValue.parse / fromValue / fromDictionary. Is this too much? -Issue(166): What happens if the provided DOMString or LengthValue for (e.g.) a SimpleLength is invalid? - {{TransformValue}} objects {#transformvalue-objects} ----------------------------------------------------------- From 830fc588791bb95a3c7b77d730fbebb78b4e464b Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Mon, 4 Apr 2016 13:23:28 +1000 Subject: [PATCH 2/6] Incorporate examples and remove SyntaxError on fromValue and fromDictionary --- css-typed-om/Overview.bs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 0d5b53b1..7a067853 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -299,8 +299,8 @@ interface LengthValue : StyleValue { LengthValue multiply(double value); // can throw SyntaxError LengthValue divide(double value); // can throw SyntaxError static LengthValue parse(DOMString cssText); // can throw SyntaxError - static LengthValue fromValue(double value, LengthType type); // can throw SyntaxError - static LengthValue fromDictionary(CalcDictionary dictionary); // can throw SyntaxError + static LengthValue fromValue(double value, LengthType type); + static LengthValue fromDictionary(CalcDictionary dictionary); }; [Constructor(DOMString cssText), @@ -336,7 +336,10 @@ interface SimpleLength : LengthValue { }; -If the provided DOMString or {{LengthValue}} is invalid the relevant function throws a SyntaxError. +If the provided DOMString or {{LengthValue}} is invalid the relevant function throws a SyntaxError. + +For e.g. add, subtract, multiply and divide will throw a SyntaxError if they are called on or passed a LengthValue that is not a SimpleLength or CalcLength. parse will throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. + Issue(165): do we want an enum of length keywords too? From c87fa87b0e067359d5964b6a6da6f6ea6f5410f5 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Mon, 4 Apr 2016 15:21:16 +1000 Subject: [PATCH 3/6] merge --- css-typed-om/Overview.bs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 7a067853..e9a6d6dc 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -294,9 +294,9 @@ dictionary CalcDictionary { }; interface LengthValue : StyleValue { - LengthValue add(LengthValue value); // can throw SyntaxError - LengthValue subtract(LengthValue value); // can throw SyntaxError - LengthValue multiply(double value); // can throw SyntaxError + LengthValue add(LengthValue value); + LengthValue subtract(LengthValue value); + LengthValue multiply(double value); LengthValue divide(double value); // can throw SyntaxError static LengthValue parse(DOMString cssText); // can throw SyntaxError static LengthValue fromValue(double value, LengthType type); @@ -337,9 +337,7 @@ interface SimpleLength : LengthValue { If the provided DOMString or {{LengthValue}} is invalid the relevant function throws a SyntaxError. - -For e.g. add, subtract, multiply and divide will throw a SyntaxError if they are called on or passed a LengthValue that is not a SimpleLength or CalcLength. parse will throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. - +For e.g. divide will throw a SyntaxError if you attempt to divide by 0, parse will throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. Issue(165): do we want an enum of length keywords too? From 3fbcafad05a0416dc971011f66d888bb2f52db8b Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Mon, 4 Apr 2016 15:39:56 +1000 Subject: [PATCH 4/6] merge --- css-typed-om/Overview.bs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index e9a6d6dc..44ebd884 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -297,8 +297,8 @@ interface LengthValue : StyleValue { LengthValue add(LengthValue value); LengthValue subtract(LengthValue value); LengthValue multiply(double value); - LengthValue divide(double value); // can throw SyntaxError - static LengthValue parse(DOMString cssText); // can throw SyntaxError + LengthValue divide(double value); + static LengthValue parse(DOMString cssText); static LengthValue fromValue(double value, LengthType type); static LengthValue fromDictionary(CalcDictionary dictionary); }; @@ -336,9 +336,6 @@ interface SimpleLength : LengthValue { }; -If the provided DOMString or {{LengthValue}} is invalid the relevant function throws a SyntaxError. -For e.g. divide will throw a SyntaxError if you attempt to divide by 0, parse will throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. - Issue(165): do we want an enum of length keywords too? Issue(167): write long descriptions of all of this From 99861ad792a251c261a1ccb1dc7218c4e52657ac Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Mon, 4 Apr 2016 15:42:51 +1000 Subject: [PATCH 5/6] add error info inline to function description --- css-typed-om/Overview.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index e2e9f4bd..1b566b11 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -383,11 +383,11 @@ The following methods are defined for {{LengthValue}} objects: :: Divides the length represented by the object by the provided value, and returns the result as a new {{LengthValue}}. This will construct a {{SimpleLength}} if the object is a {{SimpleLength}}, or a {{CalcLength}} - if the object is a {{CalcLength}}. + if the object is a {{CalcLength}}. The function can throw a DivideByZerError if value given is 0. : parse(DOMString cssText) :: Parses the provided cssText as a length value. Will return a - {{SimpleLength}} when possible, or a {{CalcLength}} otherwise. + {{SimpleLength}} when possible, or a {{CalcLength}} otherwise. The function can throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. : fromValue(double value, LengthType type) :: Constructs a {{SimpleLength}} with the given value and unit From 0c325d3da1f2c16f29223b84871e1334c1ab53f8 Mon Sep 17 00:00:00 2001 From: Naina Raisinghani Date: Tue, 5 Apr 2016 10:34:46 +1000 Subject: [PATCH 6/6] incorporate suggested changes --- css-typed-om/Overview.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 1b566b11..14775179 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -383,11 +383,11 @@ The following methods are defined for {{LengthValue}} objects: :: Divides the length represented by the object by the provided value, and returns the result as a new {{LengthValue}}. This will construct a {{SimpleLength}} if the object is a {{SimpleLength}}, or a {{CalcLength}} - if the object is a {{CalcLength}}. The function can throw a DivideByZerError if value given is 0. + if the object is a {{CalcLength}}. The function will throw a {{DivideByZeroError}} when the value given is 0. : parse(DOMString cssText) :: Parses the provided cssText as a length value. Will return a - {{SimpleLength}} when possible, or a {{CalcLength}} otherwise. The function can throw a SyntaxError if the DOMString it is passed doesn't represent a valid length. + {{SimpleLength}} when possible, or a {{CalcLength}} otherwise. The function will throw a {{SyntaxError}}, when the DOMString it is passed doesn't represent a valid length. : fromValue(double value, LengthType type) :: Constructs a {{SimpleLength}} with the given value and unit