- From: Jonas Sicking <jonas@sicking.cc>
- Date: Thu, 1 Sep 2011 19:33:01 -0700
On Thu, Sep 1, 2011 at 6:56 PM, James Robinson <jamesr at google.com> wrote: > On Thu, Sep 1, 2011 at 1:39 AM, Anne van Kesteren <annevk at opera.com> wrote: > >> On Thu, 01 Sep 2011 00:18:26 +0200, Erik Arvidsson <arv at chromium.org> >> wrote: >> >>> After thinking more about this we believe that moving contains to Node >>> is a better alternative. The problem with Node inDocument is that it >>> does not say which document it is in so code would need to also check >>> ownerDocument to be robust in the presence of frames and multiple >>> windows. >>> >> >> You got it. Now everyone please implement :-) >> >> http://dvcs.w3.org/hg/domcore/**raw-file/tip/Overview.html#** >> dom-node-contains<http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-contains> > > > What is the expected behavior for nodes in iframes? ?IOW, with this sort of > DOM: > > <body> > ?<iframe id="a"> > ? ?<iframe id="b"> > ? ? ?<div id="node"> > > what is the return value for: > b.contentDocument.contains(node); ?// I'd expect true, the spec seems to say > true > a.contentDocument.contains(node); ?// I'd expect false, the spec seems to > say true > document.contains(node); // I'd expect false, the spec seems to say true It's a little unclear what exactly you mean by the markup hierarchy you have drawn. Is the "inner" iframe in the outer iframe's .childList? Or in the outer iframe's .contentDocument? If two nodes X and Y have different .ownerDocument, then X.contains(Y) and Y.contains(X) always returns false. The definition of "descendant" or "child" has no special magic for any types of frames. / Jonas
Received on Thursday, 1 September 2011 19:33:01 UTC