Closed
Bug 181096
Opened 22 years ago
Closed 12 years ago
document.isSupported('HTML', '2.0') returns true in XHTML document loaded as text/xml which doesn't support the HTML DOM
Categories
(Core :: DOM: Core & HTML, defect, P4)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: martin.honnen, Assigned: caillon)
Details
Attachments
(2 files, 3 obsolete files)
3.16 KB,
text/xml
|
Details | |
7.46 KB,
patch
|
bzbarsky
:
review-
|
Details | Diff | Splinter Review |
Beside the document.implementation.hasFeature check for the complete DOM
implementation the DOM Level 2 Core introduces the method
isSupported
for node objects.
When Mozilla loads XHTML documents with Content-Type text/xml then the document
object is not a HTML document meaning document.write or document.images is not
supported.
Therefore I think a check
document.isSupported('HTML', '2.0')
should return false as the document node doesn't support the HTML DOM.
However with both Netscape 7 and Mozilla 1.2b the check returns true.
I will attach a test case document demonstrating that document.write etc are not
supported but the isSupported check returns true.
Reporter | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
Yeah, we should fix this.
Severity: normal → major
OS: Windows XP → All
Hardware: PC → All
Reporter | ||
Comment 3•22 years ago
|
||
The previous test case causes a JavaScript error (although it does nevertheless
demonstrate the probelem). But I attach a new test case here that doesn't cause
the script error while demonstrating the problem.
Attachment #106908 -
Attachment is obsolete: true
Comment 4•22 years ago
|
||
Ok, that has to be changed AFAIK at
http://lxr.mozilla.org/mozilla/source/content/base/src/nsGenericElement.cpp#1226
Comment 6•22 years ago
|
||
Updated•22 years ago
|
Attachment #106932 -
Flags: review?(peterv)
Comment 8•22 years ago
|
||
ccing jst, who owns this shit and so has to see this stuff... ;)
Comment 9•22 years ago
|
||
Comment on attachment 106932 [details] [diff] [review]
Patch 1
This is wrong for the following reasons:
1) We don't support DOM HTML 1.0 in XHTML as XML either.
2) We _do_ support them both in XHTML as HTML, and your change would say we do
not.
3) You're changing nsIDOMNode::IsSupported, and non-document nodes in XHTML as
XML fully support all DOM HTML 1 and 2 methods.
Attachment #106932 -
Flags: review?(peterv) → review-
Comment 10•22 years ago
|
||
ok, sorry this is somewhat complicated to me
Reassign to default owner
Assignee: mcsmurf → jst
Status: ASSIGNED → NEW
Assignee | ||
Comment 11•22 years ago
|
||
I have other changes in my tree right now which prevent me from making a patch
here, but you want to modify nsDocument::IsSupported() to do something like this:
NS_IMETHODIMP
nsDocument::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
PRBool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
nsAutoString feature(aFeature);
if (feature.EqualsIgnoreCase("HTML") &&
!mContentType.EqualsIgnoreCase("text/html")) {
*aReturn = PR_FALSE;
return NS_OK;
}
return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn);
}
Comment 12•22 years ago
|
||
hm, ok perhaps I'll try it again
Comment 13•22 years ago
|
||
Here's patch 2, the code from Christopher (thanks!)
Attachment #106932 -
Attachment is obsolete: true
Updated•22 years ago
|
Attachment #107153 -
Flags: review?(bzbarsky)
Comment 14•22 years ago
|
||
Comment on attachment 107153 [details] [diff] [review]
Patch 2
I'd prefer not to base this on the content-type like that (since we may fix our
application/xhtml+xml bug at some point). How about returning PR_FALSE
unconditionally for the "html" feature here and implementing
"nsHTMLDocument::IsSupported" which returns PR_TRUE? Since nsHTMLDocument
subclasses nsDocument, that would do the right thing, methinks...
Updated•22 years ago
|
Attachment #107153 -
Flags: review?(bzbarsky) → review-
Assignee | ||
Comment 15•22 years ago
|
||
HTML is defined to be true if both HTML and XML return true. So the places
that return true for HTML also return true for XHTML, since we always support
XML.
Attachment #107153 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Attachment #108339 -
Flags: review?(bzbarsky)
Comment 16•22 years ago
|
||
Comment on attachment 108339 [details] [diff] [review]
Make this work, as well as support the XHTML feature
+ nsAutoString feature(aFeature);
Don't do that. In fact, fix the other places doing it. ;)
+ // XXX we don't support the HTML DOM on HTMLDocuments yet.
+ *aReturn = PR_FALSE;
This part is just confused.... ;)
Attachment #108339 -
Flags: review?(bzbarsky) → review-
Assignee | ||
Comment 17•22 years ago
|
||
Brain fart, there. Okay this is an interesting bug, now. Currently hasFeature
and isSupported share the same code path, which is similar, but they need to
return different things. I can make them do the right thing (as long as I'm
thinking clearly) but now I'm just trying to figure out the best way to do that
with minimal duplication of code....
Assignee: jst → caillon
Comment 18•22 years ago
|
||
What about HTMLEvents?
Comment 19•22 years ago
|
||
What about HTMLEvents?
Updated•21 years ago
|
QA Contact: stummala → ian
Updated•21 years ago
|
Priority: -- → P4
Comment 20•12 years ago
|
||
No longer relevant with the current implementation of isSupported
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•