Bug 9280 - Quirksmode: Trailing ]> from internal DTD subset is rendered as body text
Summary: Quirksmode: Trailing ]> from internal DTD subset is rendered as body text
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: PC OS X 10.4
: P2 Normal
Assignee: Nobody
: 23673 94149 (view as bug list)
Depends on:
Blocks: 9610
  Show dependency treegraph
Reported: 2006-06-02 15:10 PDT by Adele Peterson
Modified: 2012-08-15 19:20 PDT (History)
7 users (show)

See Also:

html test case (298 bytes, text/html)
2006-07-08 10:41 PDT, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adele Peterson 2006-06-02 15:10:15 PDT

"When creating custom DTDs like the one below, all browsers except Opera see the end of the ATTLIST as the end of the DOCTYPE. The result is that they print "]>" on the screen.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

Test page. http://www.quirksmode.org/oddsandends/dtd.html
Workaround is not included
Reported by ppk."
Comment 1 Joost de Valk (AlthA) 2006-06-24 14:17:58 PDT
Moving this into component XML, though i'm not quite sure it's the correct one..
Comment 2 Joost de Valk (AlthA) 2006-06-24 14:27:42 PDT
Changing to correct component.
Comment 3 Alexey Proskuryakov 2006-07-08 10:41:17 PDT
Created attachment 9274 [details]
html test case

The original test case is served as text/html, but has a DTD based on XHTML 1.0 Transitional, which has caused some concerns about its correctness (see the comments at quirksmode.org). The attached test case has a DTD based on HTML 4.01 Strict; it exposes the same behavior - the validator accepts it (and parses as expected, which can be seen in its outline view), while major browsers don't.

I am not sure whether this document really is valid HTML - its DTD is not HTML 4.01 Strict, since it has an internal subset. HTML 4.01 explicitly lists the three DTDs used in HTML documents, and this is not one of them.

I have found discussions of this issue from as early as 1995 <http://1997.webhistory.org/www.lists/www-html.1995q2/0379.html>, but nothing authoritative enough to ignore the results of the W3C validator. Mozilla documentation seems to imply that they do handle internal subsets in HTML <http://developer.mozilla.org/en/docs/Mozilla's_DOCTYPE_sniffing>, but I'm not seeing this.
Comment 4 Oleg Oshmyan 2009-02-01 08:58:43 PST
*** Bug 23673 has been marked as a duplicate of this bug. ***
Comment 5 Oleg Oshmyan 2009-02-01 09:06:21 PST
This bug is still there. Both HTML and XHTML are affected.

Besides, I think a better summary would be what I wrote in my bug report (before finding this one):
Trailing ]> from internal DTD subset is rendered as body text
Comment 6 Alexey Proskuryakov 2009-02-01 10:00:37 PST
Good suggestion, renaming.

We need to check what HTML5 has to say about this issue. Note however that I cannot reproduce this with XHTML (and the document at URL given in bug 23673 is plain HTML, see <http://hixie.ch/advocacy/xhtml> for more detail).
Comment 7 Oleg Oshmyan 2009-02-01 10:32:10 PST
My fault. Sorry about that, should be fixed now.

Actually... I have to admit that the bug indeed does not appear when the page is XHTML.
Comment 8 Adam Barth 2010-09-20 00:35:49 PDT
We're parsing this correct w.r.t. HTML5.
Comment 9 Alexey Proskuryakov 2012-08-15 19:20:15 PDT
*** Bug 94149 has been marked as a duplicate of this bug. ***