Skip to content

Commit

Permalink
Feat: add regionCode attribute and member
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Jan 24, 2018
1 parent f057ba7 commit ab1ba80
Showing 1 changed file with 101 additions and 36 deletions.
137 changes: 101 additions & 36 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ <h2>
localities.
</dd>
<dt>
<dfn>Postal code</dfn>
<dfn data-lt="Postal codes">Postal code</dfn>
</dt>
<dd>
The postal code or ZIP code, also known as PIN code in India.
Expand Down Expand Up @@ -1990,6 +1990,7 @@ <h2>
readonly attribute DOMString postalCode;
readonly attribute DOMString recipient;
readonly attribute DOMString region;
readonly attribute DOMString regionCode;
readonly attribute DOMString sortingCode;
readonly attribute FrozenArray&lt;DOMString&gt; addressLine;
};
Expand All @@ -2010,10 +2011,11 @@ <h2>
</p>
<ol data-link-for="AddressInit">
<li>Let <var>address</var> be a new instance of
<a>PaymentAddress</a>.
</li>Set <var>address</var>.<a>[[\addressLine]]</a>to the empty
frozen array, and all other <a data-lt=
"PaymentAddress slots">internal slots</a>set to the empty string.
<a>PaymentAddress</a>.Set
<var>address</var>.<a>[[\addressLine]]</a>to the empty frozen
array, and all other <a data-lt="PaymentAddress slots">internal
slots</a>set to the empty string.
</li>
<li>If <var>details</var> was not passed to the constructor, return
<var>address</var> and terminate this algorithm.
</li>
Expand All @@ -2023,14 +2025,28 @@ <h2>
"!INFRA#ascii-uppercase">ASCII uppercasing</a>
<var>details</var>["<a>country</a>"].
</li>
<li>If <var>country</var> is not a valid [[!ISO3166]] alpha-2
<li>If <var>country</var> is not a valid [[!ISO3166-1]] alpha-2
code, throw a <a>RangeError</a> exception.
</li>
<li>Set <var>address</var>.<a>[[\country]]</a> to
<var>country</var>.
</li>
</ol>
</li>
<li>If <var>details</var>["<a>regionCode</a>"] is present:
<ol>
<li>Let <var>regionCode</var> be the result of <a data-cite=
"!INFRA#ascii-uppercase">ASCII uppercasing</a>
<var>details</var>["<a>regionCode</a>"].
</li>
<li>If <var>regionCode</var> is not a valid [[!ISO3166-2]]
subdivision code, throw a <a>RangeError</a> exception.

This comment has been minimized.

Copy link
@stpeter

stpeter Jan 25, 2018

If the empty string counts as "is present" from line 2036 above, then we will throw a RangeError exception on an empty string.

This comment has been minimized.

Copy link
@marcoscaceres

marcoscaceres Jan 29, 2018

Author Member

Good catch, will fix.

</li>
<li>Set <var>address</var>.<a>[[\regionCode]]</a> to
<var>regionCode</var>.
</li>
</ol>
</li>
<li>If <var>details</var>["<a>phone</a>"] is present:
<ol>
<li>If <var>details</var>["<a>phone</a>"] is not a
Expand Down Expand Up @@ -2127,7 +2143,8 @@ <h2>
<dfn>addressLine</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>address line</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\addressLine]]</a> internal slot.
</p>
</section>
Expand All @@ -2136,25 +2153,38 @@ <h2>
<dfn>region</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
<a>[[\region]]</a> internal slot.
Represents the <a>region</a> of the address. When getting, returns
the value of the <a>PaymentAddress</a>'s <a>[[\region]]</a>
internal slot.
</p>
</section>
<section>
<h2>
<dfn>regionCode</dfn> attribute
</h2>
<p>
Represents the <a>region</a> of the address as an [[!ISO3166-2]]
code. When getting, returns the value of the
<a>PaymentAddress</a>'s <a>[[\regionCode]]</a> internal slot.
</p>
</section>
<section>
<h2>
<dfn>city</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
<a>[[\city]]</a> internal slot.
Represents the <a>city</a> of the address. When getting, returns
the value of the <a>PaymentAddress</a>'s <a>[[\city]]</a> internal
slot.
</p>
</section>
<section>
<h2>
<dfn>dependentLocality</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>dependent locality</a> of the address. When
getting, returns the value of the <a>PaymentAddress</a>'s
<a>[[\dependentLocality]]</a> internal slot.
</p>
</section>
Expand All @@ -2163,7 +2193,8 @@ <h2>
<dfn>postalCode</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>postal code</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\postalCode]]</a> internal slot.
</p>
</section>
Expand All @@ -2172,7 +2203,8 @@ <h2>
<dfn>sortingCode</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>sorting code</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\sortingCode]]</a> internal slot.
</p>
</section>
Expand All @@ -2181,7 +2213,8 @@ <h2>
<dfn>languageCode</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>language code</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\languageCode]]</a> internal slot.
</p>
</section>
Expand All @@ -2190,7 +2223,8 @@ <h2>
<dfn>organization</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>organization</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\organization]]</a> internal slot.
</p>
</section>
Expand All @@ -2199,7 +2233,8 @@ <h2>
<dfn>recipient</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
Represents the <a>recipient</a> of the address. When getting,
returns the value of the <a>PaymentAddress</a>'s
<a>[[\recipient]]</a> internal slot.
</p>
</section>
Expand All @@ -2208,8 +2243,9 @@ <h2>
<dfn>phone</dfn> attribute
</h2>
<p>
When getting, returns the value of the <a>PaymentAddress</a>'s
<a>[[\phone]]</a> internal slot.
Represents the <a>phone</a> of the address. When getting, returns
the value of the <a>PaymentAddress</a>'s <a>[[\phone]]</a> internal
slot.
</p>
</section>
<section data-link-for="">
Expand All @@ -2231,7 +2267,7 @@ <h2>
<dfn>[[\country]]</dfn>
</td>
<td>
A <a>country</a> as an [[!ISO3166]] alpha-2 code or the empty
A <a>country</a> as an [[!ISO3166-1]] alpha-2 code or the empty
string stored in its canonical uppercase form. For example,
"JP".
</td>
Expand All @@ -2250,7 +2286,20 @@ <h2>
<dfn>[[\region]]</dfn>
</td>
<td>
A <a>region</a> or the empty string.
A <a>region</a> as a country subdivision name or the empty
string, such as "Victoria", representing the state of Victoria
in Australia.
</td>
</tr>
<tr>
<td>
<dfn>[[\regionCode]]</dfn>
</td>
<td>
A <a>region</a> as a [[!ISO3166-2]] subdivision code or the

This comment has been minimized.

Copy link
@stpeter

stpeter Jan 25, 2018

^ Should this be regionCode not region here?

This comment has been minimized.

Copy link
@marcoscaceres

marcoscaceres Jan 29, 2018

Author Member

This links to the "region" concept - so I'll clarify that it is a "region represented as a [[!ISO3166-2]] code".

empty string stored in its canonical uppercase form. For
example, "<code>PT-11</code>" represents the Lisbon district of
Portugal.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -2330,6 +2379,7 @@ <h2>
DOMString country;
sequence&lt;DOMString&gt; addressLine;
DOMString region;
DOMString regionCode;
DOMString city;
DOMString dependentLocality;
DOMString postalCode;
Expand All @@ -2350,7 +2400,7 @@ <h2>
<dfn>country</dfn> member
</dt>
<dd>
A <a>country</a>.
An [[!ISO3166-1]] country code, representing the <a>country</a>.
</dd>
<dt>
<dfn>addressLine</dfn> member
Expand All @@ -2364,6 +2414,12 @@ <h2>
<dd>
A <a>region</a>.
</dd>
<dt>
<dfn>regionCode</dfn> member
</dt>
<dd>
An [[!ISO3166-2]] subdivision code representing the <a>region</a>.
</dd>
<dt>
<dfn>city</dfn> member
</dt>
Expand Down Expand Up @@ -2431,6 +2487,7 @@ <h2>
"postalCode",
"recipient",
"region",
"regionCode",
"sortingCode"
};
</pre>
Expand All @@ -2439,9 +2496,9 @@ <h2>
"<dfn>country</dfn>", "<dfn>dependentLocality</dfn>",
"<dfn>languageCode</dfn>", "<dfn>organization</dfn>",
"<dfn>phone</dfn>", "<dfn>postalCode</dfn>", "<dfn>recipient</dfn>",
"<dfn>region</dfn>", and "<dfn>sortingCode</dfn>" enum values
correspond to attributes with the same identifiers in the
<a>PaymentAddress</a> interface.
"<dfn>region</dfn>", "<dfn>regionCode</dfn>" and
"<dfn>sortingCode</dfn>" enum values correspond to attributes with
the same identifiers in the <a>PaymentAddress</a> interface.
</p>
</section>
<section>
Expand Down Expand Up @@ -2470,7 +2527,7 @@ <h2>
</li>
<li>If "<a data-link-for="AddressField">country</a>" is not in <var>
excludeList</var>, set <var>details</var>["<a>country</a>"] to the
user-provided country as an upper case [[!ISO3166]] alpha-2 code,
user-provided country as an upper case [[!ISO3166-1]] alpha-2 code,
or to the empty string if none was provided.
</li>
<li>If "<a data-link-for="AddressField">phone</a>" is not in
Expand Down Expand Up @@ -2515,13 +2572,14 @@ <h2>
<var>details</var>["<a>postalCode</a>"].
<div class="note" title="Privacy of Postal Codes">
<p>
<a>Postal codes</a> in certain countries can be so specific as to
uniquely identify an individual. This being a privacy concern,
some user agents only return the part of a postal code that they
deem sufficient for a merchant to calculate shipping costs. This
varies across countries and regions, and so the choice to redact
part, or all, of the postal code is left to the discretion of
implementers in the interest of protecting users' privacy.
<a>Postal codes</a> in certain countries can be so specific as
to uniquely identify an individual. This being a privacy
concern, some user agents only return the part of a postal code
that they deem sufficient for a merchant to calculate shipping
costs. This varies across countries and regions, and so the
choice to redact part, or all, of the postal code is left to
the discretion of implementers in the interest of protecting
users' privacy.
</p>
</div>
</li>
Expand All @@ -2531,9 +2589,16 @@ <h2>
string if none was provided.
</li>
<li>If "<a data-link-for="AddressField">region</a>" is not in
<var>excludeList</var>, set <var>details</var>["<a>region</a>"] to
the user-provided region, or to the empty string if none was
provided.
<var>excludeList</var>:
<ol>
<li>Set <var>details</var>["<a>region</a>"] to the user-provided
region, or to the empty string if none was provided.
</li>
<li>If <var>details</var>["<a>region</a>"] maps to a
[[!ISO3166-2]] subdivision code, set
<var>details</var>["<a>regionCode</a>"] to that subdivision code.
</li>
</ol>
</li>
<li>If "<a data-link-for="AddressField">sortingCode</a>" is not in
<var>excludeList</var>, set <var>details</var>["<a>sortingCode</a>"]
Expand Down

0 comments on commit ab1ba80

Please sign in to comment.