W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Specs and Object.observe()

From: Mark S. Miller <erights@google.com>
Date: Mon, 17 Jun 2013 12:35:28 -0700
Message-ID: <CABHxS9g5kW2TEiFCXoQutd+LBdc8U_Rh9pBL3oJ_YP4y-OFXDA@mail.gmail.com>
To: Rick Waldron <waldron.rick@gmail.com>
Cc: François REMY <francois.remy.dev@outlook.com>, Marcos Caceres <w3c@marcosc.com>, public-script-coord <public-script-coord@w3.org>
On Mon, Jun 17, 2013 at 11:59 AM, Rick Waldron <waldron.rick@gmail.com>wrote:

>
> On Mon, Jun 17, 2013 at 5:55 AM, François REMY <
> francois.remy.dev@outlook.com> wrote:
>
>> As far as I know, Object.observe only works for "plain objects" i.e. it
>> doesn't fire when properties with getter/setter are changed. If you are
>> working on a DOM spec, it's very likely you're in this specific case.
>>
>
> Object.observe works with all objects. Some objects, such as Dates, Maps,
> Sets, WeakMaps and likely WeakSets will not trigger change events when
> their internal data is modified via methods (setTime, set, add, delete,
> etc), but defining and later modifying expando properties will trigger a
> change. (This list is not exhaustive)
>

Hi Rick, I never recall deciding that they would not. In general, mutable
abstractions should consider sending synthetic change notifications if
anyone is listening. We need to take it on a case by case basis per mutable
abstraction, and on the design of these particular synthetic change
notifications. But I see no immediate reason why the non-Weak* ones above
would be candidates. Even the Weak* ones perhaps, if we're careful enough
with the security issues.



>
> As François stated, accessors will not trigger change events; instead,
> you'd define a set accessor that will manually call an object's notifier
> function:
> https://gist.github.com/rwldrn/3453045#file-complex-observe-js-L39-L56
>
>
> Rick
>
>
>


-- 
    Cheers,
    --MarkM
Received on Monday, 17 June 2013 19:35:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC