Closed Bug 352655 Opened 18 years ago Closed 18 years ago

document.write doesn't work in XHTML served as application/xhtml+xml

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 68193

People

(Reporter: voo, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 document.write doesn't work in XHTML documents served as application/xhtml+xml. XHTML document has HTMLDocument object, why there's no support for document.write? DOM1 (http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html) has write() method in HTMLDocument interface. DOM2 (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-26809268) has write() method in HTMLDocument interface. Reproducible: Always Steps to Reproduce: 1. serve XHTML document as application/xhtml+xml 2. try using document.write() 3. look at javascript console and see the following exception: Error: uncaught exception: [Exception... "Object cannot be created in this context" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://nix.vlz.ru/d.php Line: 11"] Actual Results: document.write doesn't work at all Expected Results: working document.write in both cases - when document is being parsed it should append data and when document is already parsed it should replace data. Let it work the same way as it works for text/html. If it is used to create invalid xml, the parser should stop, otherwise it should work.
Please read bug 68193 comment 20 for why this is invalid and can't be used in XHTML. *** This bug has been marked as a duplicate of 68193 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
I don't agree at all. Firefox creates HTMLDocument object for XHTML pages served as application/xhtml+xml. I look at HTMLDocument interface (both DOM1 and DOM2 specs), I see document.write() method. I look at object instantiated from this interface's implementation, I see document.write() method but I can't use it! Where's the logic? What's the point of having not working function? That's strange, but it's not the subject of the bug. But the main question is - why does Firefox create HTMLDocument object and does not implement all its methods?
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
(In reply to comment #2) > I don't agree at all. Firefox creates HTMLDocument object for XHTML pages > served as application/xhtml+xml. I look at HTMLDocument interface (both DOM1 > and DOM2 specs), I see document.write() method. I look at object instantiated > from this interface's implementation, I see document.write() method but I can't > use it! Where's the logic? What's the point of having not working function? > That's strange, but it's not the subject of the bug. But the main question is - > why does Firefox create HTMLDocument object and does not implement all its > methods? http://w3.org/MarkUp/2004/xhtml-faq#docwrite > Does document.write work in XHTML? > No. Because of the way XML is defined, it is not possible to do tricks like this, where markup is generated by scripting while the parser is still parsing the markup. W3C says this is not valid so its not going to be supported - thus re-marking as a dupe. -- Ryan *** This bug has been marked as a duplicate of 68193 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.