[w3c/payment-request] ShippingAddressChange replaces address every time (#659)

In the spec, when `shippingaddresschange` fires, the spec queues a task to create a new `PaymentAddress` and replace the old `PaymentAddress` on `request`.

I'm wondering if we should instead have the task update the `request`'s `shippingAddress`'s `PaymentAddress`'s internal slots instead (i.e., don't trash the `PaymentAddress` instance, just update it)?   

The problem I see is a developer holding a reference to `request.shippingAddress`, and then not realizing that it's actually changed with the event.

```JS
var address;
// First "onshippingaddresschange"
request.request.addEventListener("shippingaddresschange", () => {
    address = request.shippingAddress;
  },
  { once: true }
);

// later
request.addEventListener("oshippingaddresschange", () => {
  // ooops! this is now an obsolete reference
  validate(address);
});
``` 

@domenic, thoughts? 

-- 
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/issues/659

Received on Friday, 8 December 2017 05:27:01 UTC