[Bug 27122] MutationObserver.observe(node, {}) should throw

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27122

--- Comment #13 from Jonas Sicking <jonas@sicking.cc> ---
(In reply to Olli Pettay from comment #11)
> Is there any reason to not throw early if observe() doesn't do anything sane?

The reason is that "doesn't do anything sane" is going to vary from use-case to
use-case. I.e. in some cases it might be quite sane to simply not receive
certain notifications if the browser doesn't support them, in others not.

For example if we add notifications for Shadow DOM, then not firing those in
browsers that doesn't support Shadow DOM might be just fine. In such browsers
the website might use a Shadow DOM polyfill which provides its own notification
mechanism.

The other reason is that we can't really be consistent. I.e. we can't make both
of these throw, so it might be more consistent to make neither throw:

MutationObserver.observe(node, { newFeature: true })
MutationObserver.observe(node, { newFeature: true, childList: true })

The reason we can't make both throw is that JS doesn't provide a good way to
check that "no unknown properties are provided". Things like non-enumerable
properties, properties on prototype objects, and proxies simply make checking
for lack of unknown properties too hard/complex.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 21 October 2014 23:45:25 UTC