W3C home > Mailing lists > Public > public-webapps-bugzilla@w3.org > November 2012

[Bug 20131] [MutationObservers] Unclear whether unique record instances are required in 5.3.2 "Queuing a mutation record"

From: <bugzilla@jessica.w3.org>
Date: Wed, 28 Nov 2012 22:35:26 +0000
To: public-webapps-bugzilla@w3.org
Message-ID: <bug-20131-2532-VHxGs6GXPE@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20131

--- Comment #14 from Rafael Weinstein <rafaelw@chromium.org> ---
I don't think so, but maybe we're talking at cross purposes. To make it more
concrete:

<script>
var MutationObserver = MutationObserver || WebKitMutationObserver;
var div = document.createElement('div');
div.setAttribute('foo', 'foo');

function makeHandler(name) {
  return function handler(recs) {
    console.log('observer ' + name);
    console.log('count: ' + recs.length);
    console.log('oldValue: ' + recs[0].oldValue);
    if (recs[0].expando) {
      console.log('exando found');
    } else {
      recs[0].expando = 1;
      console.log('expando not found, and written');
    }
  };
}

var A = new MutationObserver(makeHandler('A'));
A.observe(div, { attributes: true, attributeOldValue: true });

var B = new MutationObserver(makeHandler('B'));
B.observe(div, { attributes: true });

var C = new MutationObserver(makeHandler('C'));
C.observe(div, { attributes: true, attributeOldValue: true });

var D = new MutationObserver(makeHandler('D'));
D.observe(div, { attributes: true });

div.setAttribute('foo', 'bar');
</script>

In WebKit this outputs:

observer A ---------
count: 1
oldValue: foo
expando not found, and written
observer B ---------
count: 1
oldValue: null
expando not found, and written
observer C ---------
count: 1
oldValue: foo
exando found
observer D ---------
count: 1
oldValue: null
exando found 

In Gecko this outputs:

observer A ---------
count: 1
oldValue: foo
expando not found, and written
observer B ---------
count: 1
oldValue: null
expando not found, and written
observer C ---------
count: 1
oldValue: foo
exando not found, and written
observer D ---------
count: 1
oldValue: null
exando not found, and written

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 28 November 2012 22:35:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 28 November 2012 22:35:30 GMT