Re: [w3c/payment-request] Add regionCode attribute (#690)

marcoscaceres commented on this pull request.



> +                subdivision name</a> for <var>regionCode</var>. Where
+                [[!ISO3166-2]] defines multiple <a>country subdivision
+                names</a> for a <var>regionCode</var>, it is RECOMMENDED the
+                user agent select one by matching on:
+                  <ol>
+                    <li>The <a data-cite="!HTML#language">language</a> of
+                    <a data-cite="HTML#the-body-element-2">the body
+                    element</a>.
+                    </li>
+                    <li>The user's preferred languages.
+                    </li>
+                    <li>Any other criteria the user agent deems suitable.
+                    </li>
+                  </ol>
+                </li>
+                <li>Set <var>address</var>.<a>[[\region]]</a> to

@domenic, stop reading this! get back to vacation! 🍹

But when you are back... by design, `address.region` is overridable by the developer.  So, eventually:

```JS
const dict = {
   country: "PT",
   regionCode: "PT-11",
}
const address = new PaymentAddress(dict);
address.region; // "Lisboa", per ISO ISO3166-2

// And... then.. 
const dict = {
   country: "PT",
   regionCode: "PT-11",
   region: "Lisbon",
}
const address = new PaymentAddress(dict);
address.region; // Lisbon, per developer override.
```

Hmm.... now I'm wondering if we should allow nullable on the AddressInit dictionary:

```JS
const dict = {
   country: "PT",
   regionCode: "PT-11",
   region: null, // or undefined, means "derive it for me" 
}
``` 

While:
```JS
const dict = {
   country: "PT",
   regionCode: "PT-11",
   region: "", // trash it ... I'll handle it
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/pull/690#pullrequestreview-105992015

Received on Thursday, 22 March 2018 05:36:44 UTC