Closed Bug 34458 Opened 25 years ago Closed 24 years ago

nsIHTMLContentSink needs a SetDefaultDocType() call.

Categories

(Core :: DOM: HTML Parser, defect, P1)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla0.9

People

(Reporter: rickg, Assigned: cmanske)

References

Details

(Whiteboard: FIX IN HAND need sr=)

Attachments

(2 files)

Please add the call SetDefaultDocType() to the nsIHTMLContentSink. DTD's should call this by default in their willbuildmodel() call. If a real doctype is encountered in the document, then AddDocTypeDecl() is already called.
*** Bug 34424 has been marked as a duplicate of this bug. ***
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: --- → M16
setting priority to P1.
Priority: P2 → P1
This looks reasonable to me. Just one question: Should we force inserting a <tbody> only if "strict.dtd" is found in the doctype string?
if they are using the strict.dtd -- then the tbody must be used, the table element content model is this: (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)> tbody is required
No. The tbody *element* is required, but both <tbody> start *tag* and </tbody> end *tag* are omittable. ( http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3 ) |<!ELEMENT TBODY O O (TR)+ -- table body --> |Start tag: optional, End tag: optional The tbody element is always there even if we omit the <tbody> tag. Therefore, we do not have to insert the <tbody> tag.
Harish, are we normalizing the document in the parser? If so, then the tbody element start and end tag should be included and not omitted.
Yup, TBODY is always included.
All the documents will now have a DOCTYPE associated with it. That is, for documents without DOCTYPE parser would create one ( the default is set to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> ). Also have added a static API ( CreateCompatibleDTD()), on the parser, which could be used to retrieve the appropriate DTD for a give DOCTYPE, or MimeType. MArking bug FIXED.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
using the following code: <html> <head> <title>test</title> </head> <body> <p>boo</p> </body> </html> view this in the browser, select File|Edit Page and from the composer menu select Debug|Output HTML, I do not see the doctype -- shouldn't that be there? If I add a table: <table> <tr> <td>howdy</td> </table> and repeat the process, the tbody does get inserted. Closing out the composer window and viewing the document in notepad, the tbody is not in the file -- which is correct. So, I'm confused about the doctype statement, I expected to see the doctype when dumping the HTML. Marking reopen to get this back on Harish's plate
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
updated qa contact.
QA Contact: janc → bsharma
Target Milestone: M16 → ---
I think the composer should make a decision on the TBODY, since parser always includes tbody. Also, a fabricated DOCTYPE should get inserted, by the composer, if the document doesn't contain one ( I remember talking to cmanske about this ). So, reassigning to him.
Assignee: harishd → cmanske
Status: REOPENED → NEW
Harish: I don't understand what you mean by "composer should make a decision on the TBODY" Also, how do we decide what is the proper "fabricated DOCTYPE" should be used? Do we always simply insert the "-//W3C//DTD HTML 4.01 Transitional//EN" that we use for a new document?
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
if we bring a file into Composer and edit it, at that point in time, I believe we should be dropping in a doctype if one is not present. If we use the 4.01 transitional, any deprecated elements would still be supported and we would be producing properly formed pages (by inserting the doctype). We should however, let the user know taht we put in the doctype - maybe on save ping them that the doctype is being inserted, possibly provide a checkbox to either accept that change or deny it. In any event, if there is an absence of a doctype (because we will be including one) or a doctype of 4.01, we should be using the tbody. The only time I can think of not using the tbody is if the document has a doctype of 3.2 or less.
I really don't think we should tell the user when we insert the doctype. Any "novice" user will definitely be confused. For advanced users, if there's no doctype, I don't think they will be too upset if we use 4.01 transitional. Why would one *not* want to have a doctype, especially since we don't formally support 3.2? If they really want to use 3.2, they will discover this and not use Composer at all. I agree that we should keep <tbody>, but remember that the reason this was a problem is because of the bug in 4.7 mail that moves <tbody> into <caption>, cluttering up a mail message when going back and forth between 4.7 and 6+.
Even if we leave the decision to the user, whether or not a doctype should be inserted, IMO, a novice user will always choose "NO" since she/he wouldn't know the significance of a DOCTYPE. In other words, I agree with Charles. But I'm not completely sure about choosing between 3.2 & 4.01 transitional. Though, I'm inclined towards 4.01 transitional.
well, it was just an idea :-), so if you prefer not to ping the user, cool. But we need to be producing docs with a doctype, minimally the 4.01 transitional
Do we need a doctype for an HTML mail composer page?
r=mjudge
Whiteboard: FIX IN HAND need sr=
I think it's wrong to insert a doctype into a document that doesn't have a doctype without even analyzing the document to make a proper guess at what doctype was intended. I think we should prompt users if/when we add a doctype. I think it *is* possible to come up with a prompt that novice users will click "ok" to (if that's what we want). What is the bug being fixed by forcing a doctype into ever page in Composer? Is the summary just wrong or should that issue be in another bug or ????
Kathy, if you edit in Composer, then you are using the 4.01 DTD, right? So by adding it to an old document, we are being explicitly honest about that. That, of course, is open to criticism, but the only other solution is to not edit a document if there's no existing doctype. Harish or Rick: if a doctype tag exists and it is 3.2, for example, do we really parse differently, e.g., do we NOT insert <tbody> in that case?
Parser does not make any decision based on DOCTYPE..anymore. In other words a 3.2 document would get parsed as if it was 4.01.
That's what I thought. Then I think brade's objections are moot. And I still think we shouldn't ask the user anything. It could even be argued that we should even change *existing* doctype to 4.01, since that is what we are actually doing, correct?
Any more discussion on this issue? Harish, do you want to take the "sr" responsibility?
checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago24 years ago
Resolution: --- → FIXED
Verified on: build: 2001-04-02-09-Mtrunk platform: WinNT I opened the below source file in the browser, and when did "View|Page Source", the doc type was not present. <html> <head> <title>test</title> </head> <body> <p>boo</p> </body> </html>
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
resolving this as fixed; this bug is about a missing API. Please file new bugs if you see problems for specific behaviors (like a wrong doctype or a missing doctype). BSharma--you should be testing this in Composer, not Navigator.
Status: REOPENED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
QA Contact: bsharma → moied
verified fixed with build ID 20020214 on win2k
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: