Bug 99244 - According to DOM4, all DocType nodes should have a document
Summary: According to DOM4, all DocType nodes should have a document
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: BlinkMergeCandidate
: 120425 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-13 01:12 PDT by Adam Barth
Modified: 2019-02-06 09:02 PST (History)
10 users (show)

See Also:


Attachments
Work in progress (2.99 KB, patch)
2012-10-13 01:12 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (20.60 KB, patch)
2013-08-29 11:59 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2012-10-13 01:12:29 PDT
According to DOM4, all DocType nodes should have a document
Comment 1 Adam Barth 2012-10-13 01:12:44 PDT
Created attachment 168546 [details]
Work in progress
Comment 2 Adam Barth 2012-10-13 01:13:28 PDT
Once this lands, this will simply a ton of special cases related to DocType nodes throughout WebCore.
Comment 3 Alexey Proskuryakov 2012-10-13 12:29:34 PDT
I suggest waiting until (and if) DOM 4 gains any official capacity. This is a direct violation of each and every official specification, and a working draft cannot override that.
Comment 4 Alexey Proskuryakov 2013-08-28 11:50:09 PDT
*** Bug 120425 has been marked as a duplicate of this bug. ***
Comment 5 Chris Dumez 2013-08-28 12:50:43 PDT
Alexey, based on your comment in the duplicate bug, I assume you are still not in favor of making this change?
Comment 6 Alexey Proskuryakov 2013-08-28 12:58:58 PDT
I think that it's crazy and destructive to change specs like this. I don't have much of an opinion on whether WebKit should accept this change at this point in time.
Comment 7 Darin Adler 2013-08-28 18:15:14 PDT
We can easily remove the tons of special cases in WebCore another way. There’s no harm in having the DocumentType have a document that is not visible to the web through the ownerDocument attribute. And document() can return that document.
Comment 8 Antti Koivisto 2013-08-29 05:36:04 PDT
We should do this. It fixes a hole in platform consistency and is obscure enough that it has virtually zero probability of breaking anything.
Comment 9 Chris Dumez 2013-08-29 05:39:33 PDT
I would be happy to port my Blink patch if the approach (same as DOM4) is accepted for WebKit:
https://src.chromium.org/viewvc/blink?revision=156581&view=revision

Let me know.
I haven't done so yet because of Darin and Alexey's comments.
Comment 10 Chris Dumez 2013-08-29 05:44:13 PDT
(In reply to comment #9)
> I would be happy to port my Blink patch if the approach (same as DOM4) is accepted for WebKit:
> https://src.chromium.org/viewvc/blink?revision=156581&view=revision
> 
> Let me know.
> I haven't done so yet because of Darin and Alexey's comments.

As explained in my duplicate bug, Firefox stable already ships with the behavior specified in DOM4.
Comment 11 Andreas Kling 2013-08-29 05:44:31 PDT
I think we should make this change. The invariant of every Node always has a Document is very valuable, and like Antti, I doubt anyone relies on this quirk.

In fact, even if DOM4 hadn't changed, I *still* think we should be making the change.
Comment 12 Darin Adler 2013-08-29 10:28:22 PDT
Yes, I think fixing this DocumentType silliness is helpful and highly unlikely to be a compatibility problem despite the years of having a standard clearly stating it should work that way.
Comment 13 Darin Adler 2013-08-29 10:28:40 PDT
Don’t let my comment stand in your way!
Comment 14 Chris Dumez 2013-08-29 11:59:59 PDT
Created attachment 210010 [details]
Patch
Comment 15 Chris Dumez 2013-08-29 12:17:50 PDT
Comment on attachment 210010 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=210010&action=review

> Source/WebCore/dom/Node.h:404
>      Document* document() const

I guess it would be nice to return a reference now. I would be happy to do that in a follow-up patch unless someone knows of a reason why we shouldn't.
Comment 16 Andreas Kling 2013-08-29 12:19:38 PDT
(In reply to comment #15)
> (From update of attachment 210010 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=210010&action=review
> 
> > Source/WebCore/dom/Node.h:404
> >      Document* document() const
> 
> I guess it would be nice to return a reference now. I would be happy to do that in a follow-up patch unless someone knows of a reason why we shouldn't.

I already have a draft monster patch for doing this (it'll be >1MB) so you shouldn't waste your time doing the same thing. :)
Comment 17 Chris Dumez 2013-08-29 13:23:17 PDT
Comment on attachment 210010 [details]
Patch

Thanks for reviewing.
Comment 18 WebKit Commit Bot 2013-08-29 13:47:12 PDT
Comment on attachment 210010 [details]
Patch

Clearing flags on attachment: 210010

Committed r154840: <http://trac.webkit.org/changeset/154840>
Comment 19 WebKit Commit Bot 2013-08-29 13:47:16 PDT
All reviewed patches have been landed.  Closing bug.
Comment 20 Lucas Forschler 2019-02-06 09:02:30 PST
Mass moving XML DOM bugs to the "DOM" Component.