Closed Bug 255610 Opened 20 years ago Closed 20 years ago

document.implementation.hasFeature('XHTML', '2.0') should return true

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: martin.honnen, Assigned: vhaarr+bmo)

Details

(Whiteboard: [good first bug])

Attachments

(2 files)

The DOM Level 2 HTML specification in its introduction at
  http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-1176245063
says the following about feature strings:

  A DOM application may use the hasFeature(feature, version) method of the
DOMImplementation interface with parameter values "HTML" and "2.0"
(respectively) to determine whether or not this module is supported by the
implementation. In addition to the feature string "HTML", the feature string
"XHTML" (version string "2.0") can be used to check if the implementation
supports XHTML (this is equivalent to checking the features "XML" and "HTML").

As Mozilla supports XHTML and furthermore returns true for the feature/version
'HTML'/'2.0' and 'XML'/'2.0' it should return true from
  document.implementation.hasFeature('XHTML', '2.0') 
but returns false.

Tested with Mozilla 1.8a3
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040813.

I will upload a test case which demonstrates the results Mozilla returns for the
relevant DOM feature/version combinations.
The hasFeature method is implemented here:
http://lxr.mozilla.org/seamonkey/source/content/base/src/nsDocument.cpp#331
and calls the InternalIsSupported method implemented here:
http://lxr.mozilla.org/seamonkey/source/content/base/src/nsGenericElement.cpp#1134
so all that probably needs to changed is some hard-coded check for XHTML, 2.0 as
follows

} else if (PL_strcasecmp(f, "Views") == 0 ||
              PL_strcasecmp(f, "StyleSheets") == 0 ||
              PL_strcasecmp(f, "Core") == 0 ||
              PL_strcasecmp(f, "CSS") == 0 ||
              PL_strcasecmp(f, "CSS2") == 0 ||
              PL_strcasecmp(f, "Events") == 0 ||
 //           PL_strcasecmp(f, "UIEvents") == 0 ||
              PL_strcasecmp(f, "MouseEvents") == 0 ||
              PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
              PL_strcasecmp(f, "HTMLEvents") == 0 ||
              PL_strcasecmp(f, "Range") == 0 ||
              PL_strcasecmp(F, "XHTML") == 0) {
     if (aVersion.IsEmpty() ||
         PL_strcmp(v, "2.0") == 0) {
       *aReturn = PR_TRUE;
     }
   } 
I made a typo in the previous comment, code should be

} else if (PL_strcasecmp(f, "Views") == 0 ||
              PL_strcasecmp(f, "StyleSheets") == 0 ||
              PL_strcasecmp(f, "Core") == 0 ||
              PL_strcasecmp(f, "CSS") == 0 ||
              PL_strcasecmp(f, "CSS2") == 0 ||
              PL_strcasecmp(f, "Events") == 0 ||
 //           PL_strcasecmp(f, "UIEvents") == 0 ||
              PL_strcasecmp(f, "MouseEvents") == 0 ||
              PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
              PL_strcasecmp(f, "HTMLEvents") == 0 ||
              PL_strcasecmp(f, "Range") == 0 ||
              PL_strcasecmp(f, "XHTML") == 0) {
     if (aVersion.IsEmpty() ||
         PL_strcmp(v, "2.0") == 0) {
       *aReturn = PR_TRUE;
     }
   } 
Mozilla doesn't support XHTML 2.0. XHTML 2.0 isn't anywhere near recommendation
yet, I suspect this is invalid.
OS: Windows XP → All
Hardware: PC → All
This has nothing to do with XHTML 2.0.
The bug is not about XHTML 2.0 support but about DOM support for the defined DOM
feature XHTML for the DOM Level 2.0.
Anne, care to test and post the patch?
Whiteboard: [good first bug]
Patches nsGenericElement.cpp to include XHTML check.

The testcase in this bug returns true in the last check on Firefox trunk with
this patch.
Attachment #169238 - Flags: review?(bzbarsky)
Comment on attachment 169238 [details] [diff] [review]
patch to that effect

r=bzbarsky.  jst, could you sr?
Attachment #169238 - Flags: superreview?(jst)
Attachment #169238 - Flags: review?(bzbarsky)
Attachment #169238 - Flags: review+
Comment on attachment 169238 [details] [diff] [review]
patch to that effect

sr=jst
Attachment #169238 - Flags: superreview?(jst) → superreview+
Assignee: general → bugmail
Thanks for the reviews.
Attachment 169238 [details] [diff] checked in to seamonkey trunk by bernd.
-> FIXED.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: