This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14765 - ownerDocument of document cannot be a document (for web compat)
Summary: ownerDocument of document cannot be a document (for web compat)
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ms2ger
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-10 18:44 UTC by Travis Leithead [MSFT]
Modified: 2011-11-10 19:13 UTC (History)
5 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2011-11-10 18:44:59 UTC
DOM4 currently states that:
--
The ownerDocument attribute must return the node document.
The node document of a document is that document itself.
All nodes have a document at all times.
--
It turns out that this behavior is totally different than all existing browsers, and in fact sends jQuery into an infinite loop (in the "do/while" loop inside its "trigger" function, when its event propagation advances to the ownerDocument of a Document).

IE and Chrome both return "null" for the ownerDocument of a Document, which is clearly what jQuery expects.  

Seems like this was a nice attempt to get some consistency, but it's just not going to work in practice :(

Please change this to be nullable and return null when the node type is a document.
Comment 1 Olli Pettay 2011-11-10 18:48:38 UTC
This is surprising. There has been some discussion about whether this
kind of change would be possible, but I didn't know it was actually changed
in the spec.


(docType.ownerDocument handling change is ok though)
Comment 2 Aryeh Gregor 2011-11-10 19:02:48 UTC
Maybe the spec should flag things that are proposed changes and known not to agree with existing browsers.  We all knew that this change might have compat issues.  It would be nice to implementers if there were a warning saying "This might not work, be on the lookout for compat issues and report them if you find any so we can change the spec back."  (As opposed to most of the spec, which at least tries to match browsers, even if sometimes it has mistakes.)
Comment 3 Ms2ger 2011-11-10 19:13:55 UTC
Not really unexpected...

http://dvcs.w3.org/hg/domcore/rev/78608f47f3ad