Closed
Bug 68193
Opened 24 years ago
Closed 23 years ago
Document.write method is not functioning in XHTML
Categories
(Core :: XML, defect)
Core
XML
Tracking
()
RESOLVED
WONTFIX
Future
People
(Reporter: chrispetersen, Assigned: hjtoi-bugzilla)
References
Details
(Keywords: xhtml)
Attachments
(4 files)
Build: 2001020804
Platform: All
Expected results: Document.write should function and a text string should appear
in browser window.
What I got: The document is empty.
Steps to reproduce:
1) Open test case.
2) Instead of text appearing, the document window is empty.
Reporter | ||
Comment 2•24 years ago
|
||
Comment 3•24 years ago
|
||
amm... it's correct that no content gets displayed because you need any element
around the text. e.g <p>
mozilla makes it right.
Comment 4•24 years ago
|
||
Assignee | ||
Comment 5•24 years ago
|
||
I agree with Martin, marking as INVALID.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 7•24 years ago
|
||
Reporter | ||
Comment 8•24 years ago
|
||
Reporter | ||
Comment 9•24 years ago
|
||
If I use the same working example but change the file extension to .xml, the
script script tag won't function.I realize N6 uses strict layout for xml
document but these documents are valid and conform to the specifications.
Status: VERIFIED → REOPENED
Resolution: INVALID → ---
Reporter | ||
Comment 10•24 years ago
|
||
If I missing something here, let me know. From my understanding, this should be
working.
Assignee | ||
Comment 11•24 years ago
|
||
Heh, this is getting interesting. I just now noticed that Martin's sample had
text/html mime type, so of course it will work.
Ok, the same document with text/xml mime type does not work, and there is a
simple explanation. The document structure is not what you expect it to be. You
have:
<script>
#text document.write('
<p>
#text This sentence was created by javascript
</p>
#text ')
</script>
i.e. the <p> inside the document.write was treated as an element, which probably
meant that document.write() got an empty string as an argument (if it was called
at all). It might be that it got the sentence without the surrounding tags as
well, but the end result is still an empty document.
With CDATA section the sample looks correct, so I think we do have a bug here,
after all.
Reporter | ||
Updated•24 years ago
|
Status: REOPENED → ASSIGNED
Comment 13•24 years ago
|
||
This usage pattern isn't XHTML. It would be more in line with the standard to
use DOM calls instead of document.write.
We have two choices - allow document.write to work, or evangelize the use of the
DOM with XHTML (XML). Or both.
Adding jst, bclary and aruner to the cc list. Does evangelism have a strong
opinion?
Marking nsbeta1-. We don't need this for beta.
Comment 14•24 years ago
|
||
I won't get into whether this should be in beta, but I do feel strongly that
this is appropriate usage for XHTML and should be supported at some point.
IANAL, but if XHTML is in essense the next generation of HTML, and if it
supports scripting, then it should be possible to use document.write to add
content to the XHMTL document at run time. To not support this common idiom
would break a technique that has been used since javascript was introduced.
It is true that for most cases there are DOM-oriented methods to do the same
thing, but a) the DOM can be difficult and time consuming to use; b)
document.write can easily generate complicated content and is more accessible
for many scripters; c) there are cases where the current implementation of the
DOM does not support a required feature (such as delayed loading of scripts)
where document.write may be more appropriate.
Comment 15•24 years ago
|
||
Supporting document.write() in XHTML (served as text/xml) as document.write() is
used on the web today will be extremely complicated w/o also writing the XML
parser, which is somthing we definitely don't wanto do. The problem is that
document.write() is used today to write out pieces of HTML that are not well
formed, not even close, today people can do things like:
<div>
<script>
document.write("<a href='" + myurl + "'>");
</script>
some text
</a>
</div>
and supporting that with a generic XML parser just won't happen, as you can see,
that piece of XML is not even well formed, and must be rejected by an XML
parser, regardless of if the XML application that parses the above data supports
scripts (and the DOM) or not.
IMO we have two choices, either not support document.write() in XHTML at all
(when served as text/xml), or support document.write() as long as the XML that's
written out is well formed, i.e. the above sample would need to look like:
<div>
<script>
<![CDATA[
document.write("<a href='" + myurl + "'>some text</a>");
]]>
</script>
</div>
Comments?
Comment 16•24 years ago
|
||
KILL IT!!! KILL IT DEAD!!! LET THE MADNESS STOP!!!
Assignee | ||
Comment 17•24 years ago
|
||
Futuring for now, if people feel stronly about this they can add comments, vote
for this etc.
Target Milestone: --- → Future
Comment 18•24 years ago
|
||
document.write() is so not XML/DOM. I'd rather see this WONTFIXed and efforts
directed at other things.
Comment 19•24 years ago
|
||
*** Bug 85685 has been marked as a duplicate of this bug. ***
Comment 20•23 years ago
|
||
I as well think this should be WONTFIX.
First of all take a look at XHTML 1.0 spec:
http://www.w3.org/TR/2001/WD-xhtml1-20011004/#h-4.8
pay specific attention to section C.4:
http://www.w3.org/TR/2001/WD-xhtml1-20011004/#guidelines
The examples you provided here are all expected not to work in XHTML as per spec.
Secondly, document.write() and document.writeln() actually *are* part of DOM.
However this is DOM HTML (see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ )
which is slightly modified DOM Core.
DOM Core is meant to be used with XML, and DOM HTML - with HTML4.
One of the differences is that DOM Core does not contain document.write() and
document.writeln() functions.
However XHTML is reformulation of HTML in XML, and it is fair to expect that DOM
Core should be used with it when it is treated as an XML document instead of DOM
HTML.
That's the main goal of XHTML - transition to XML. If you don't like XML or APIs
that apply to it - you better stick to using HTML 4.01, since it simply makes no
sense why would you want to move to XHTML, because essentially it is exactly the
same as HTML, it's just a "reformulation". :o)
Comment 21•23 years ago
|
||
I'm going to risk the wrath of TPTB and WONTFIX this. Bear in mind that this
only applies to text/xml XHTML, which has had a very low adoption rate given
IE's utter failure to support it. By the time they get that fixed up, people
start figuring out how to change the MIME-type of their webpages, etc., I think
it will be appropriate to expect them not to use this sort of hack.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago → 23 years ago
Resolution: --- → WONTFIX
Updated•22 years ago
|
QA Contact: petersen → rakeshmishra
![]() |
||
Comment 22•20 years ago
|
||
*** Bug 264302 has been marked as a duplicate of this bug. ***
![]() |
||
Comment 23•20 years ago
|
||
*** Bug 197586 has been marked as a duplicate of this bug. ***
![]() |
||
Comment 24•20 years ago
|
||
*** Bug 215904 has been marked as a duplicate of this bug. ***
![]() |
||
Comment 25•20 years ago
|
||
*** Bug 229341 has been marked as a duplicate of this bug. ***
![]() |
||
Comment 26•20 years ago
|
||
*** Bug 271237 has been marked as a duplicate of this bug. ***
![]() |
||
Comment 27•20 years ago
|
||
See discussion in bug 111514 about the document.write in XHTML issue.... In
brief, support of that is not required by any specification.
Comment 28•19 years ago
|
||
*** Bug 319214 has been marked as a duplicate of this bug. ***
Comment 29•19 years ago
|
||
*** Bug 329412 has been marked as a duplicate of this bug. ***
Comment 30•18 years ago
|
||
*** Bug 352655 has been marked as a duplicate of this bug. ***
Comment 31•18 years ago
|
||
*** Bug 352655 has been marked as a duplicate of this bug. ***
Comment 33•18 years ago
|
||
The last dup (bug 192367) has a fair amount of discussion, including comments from Hixie.
You need to log in
before you can comment on or make changes to this bug.
Description
•