Closed Bug 185498 Opened 22 years ago Closed 22 years ago

Don't rely on the ::CreateElement creates HTML elements

Categories

(Core :: XSLT, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: sicking, Assigned: sicking)

References

Details

(Keywords: regression, Whiteboard: fixed1.3)

Attachments

(1 file)

txMozillaXMLOutput::startElement relies on that mDocument->CreateElement creates an HTML element. This is only true if mDocument is an nsHTMLDocument, which isn't always the case. Unfortunatly i can't find any other way to create HTML elements. So the only way of fixing this bug that i can think of is to check if mDocument is an HTML-Document and if it isn't create a separate HTML-document (mHTMLFactoryDocument) and use that to create the elements. Thoughts?
I had that idea of keeping the element factories in our output handler for quite some time, so if we use nsIDocument::GetAndIncrementContentID we should be able to just use the right factory, set the ID on the content and leave the dom creation methods alone. Those are slow anyway, as we go thru the namespacemanager twice (once from ID to URI, and the document goes the same way back)
Note that IMHO we should create XHTML for html output method and xml output document. (That's different casing, and xhtml namespace ID instead of 0 for the nodeinfo, IIRC.)
my vote goes towards sticking normal HTML-elements in the document even if it's an XML document since mozilla is able to deal with that. Do what people ask for even if it happens to be a bad thing. peterv?
Attached patch patch to fixSplinter Review
This makes us create XHTML elements if the document we're transforming into isn't HTML. This was the easiest way to go, and I don't really care too much since this is only an issue for users of the deprecated js-interface. I also fixed the fact that we were always wrapping table-contents in an XHTML-<tbody>s. Now we'll create a normal HTML-<tbody> except when ::CreateElement won't give us what we need. (We still won't wrap tables in xml-output though)
Attachment #114342 - Flags: superreview?(peterv)
Attachment #114342 - Flags: review?(axel)
*** Bug 187977 has been marked as a duplicate of this bug. ***
-> me
Assignee: peterv → bugmail
Keywords: regression
Comment on attachment 114342 [details] [diff] [review] patch to fix >Index: source/xslt/txMozillaXMLOutput.cpp >=================================================================== > else { > mDocument = aResultDocument; > doc = do_QueryInterface(aResultDocument); >+ >+ nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aResultDocument); >+ mDocumentIsHTML = !!htmlDoc; > } > mCurrentNode = mDocument; >- >+ Don't add whitespace.
Attachment #114342 - Flags: superreview?(peterv) → superreview+
Attachment #114342 - Flags: review?(axel) → review+
Comment on attachment 114342 [details] [diff] [review] patch to fix I'd like to land this on the 1.3 branch if possible. The big interface rewrite we did recently broke users of the old XSLT-js-interface so that they got XML rather then HTML. This patch fixes this as well a small glitch where we insert some XHTML <tbody>s in XSLT-generated HTML-pages. We've got one bug filed because of this regression. The patch is simple and should be safe thanks to that. It only affects pages that uses XSLT.
Attachment #114342 - Flags: approval1.3?
this bug might be what is breaking P3P as well
Status: NEW → ASSIGNED
checked in on trunk, keeping open for the 1.3 branch
Comment on attachment 114342 [details] [diff] [review] patch to fix a=asa (on behalf of drivers) for checkin to the 1.3 branch.
Attachment #114342 - Flags: approval1.3? → approval1.3+
checked in on branch as well
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Whiteboard: fixed1.3
mass verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: