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

[Bug 20567] Change [[Prototype]] for concept-node-adopt?

From: <bugzilla@jessica.w3.org>
Date: Fri, 18 Oct 2013 16:15:22 +0000
To: public-script-coord@w3.org
Message-ID: <bug-20567-3890-QWT3oRzkwp@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20567

--- Comment #50 from Boris Zbarsky <bzbarsky@mit.edu> ---
> What about event handlers?

What Gecko does is that when a node is adopted it goes through its event
handler content attributes and recompiles those to event handlers, blowing away
whatever was there at the time.  This makes sure that event handlers compiled
from content attributes have the right owner document on the scope chain, but
leads to effects like this:

<div id="x" onclick="alert('hi');">Click me</div>
<iframe></iframe>
<script>
  window.onload = function() {
    var d = document.getElementById("x");
    d.onclick = function() { alert('bye'); }
    frames[0].document.body.appendChild(d);
  }
</script>

where clicking the div in the iframe will alert 'hi'.  In practice, I suspect
no one ever mixes event handler attributes and explicit assignment of event
handlers like this.

If there is no event handler content attribute set on the element for a given
event handler, it's left as-is.

> I was referring to the fact that nodes removed from a document but not
> adopted into another document would leak.

Only if something is still holding explicit JS references to them.  Otherwise
they just get GCed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Friday, 18 October 2013 16:15:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC