Closed
Bug 42278
Opened 26 years ago
Closed 26 years ago
REC-html40 incorrectly returned as a result of reverse mapping XHTML identifier
Categories
(Core :: XML, defect, P3)
Tracking
()
VERIFIED
FIXED
People
(Reporter: vidur, Assigned: vidur)
Details
(Whiteboard: [nsbeta2+])
Currently, we map both the REC-html40 and XHTML namespaces to the same internal
identifier. The internal identifier is used in layout to special case handling
of HTML elements. I believe we've decided to leave the forward mapping in place
- we don't have to modify all the places that currently use the REC-html40
namespace. Unfortunately, when we do the reverse mapping (map back from the
common identifier to a namespace URI), we get the REC-html40 namespace. This
means that this deprecated namespace will show up in operations such as
serialization of XML documents. The reverse mapping should be fixed to return
the XHTML namespace.
| Assignee | ||
Comment 1•26 years ago
|
||
Nominating for beta2 so we can start the process of deprecating the old
namespace. Also cc:ing Dave Hyatt to make sure that there's no dependency in XUL
for the reverse mapping.
A patch is included below:
Index: nsNameSpaceManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/base/src/nsNameSpaceManager.cpp,v
retrieving revision 3.12
diff -c -r3.12 nsNameSpaceManager.cpp
*** nsNameSpaceManager.cpp 2000/04/03 11:11:08 3.12
--- nsNameSpaceManager.cpp 2000/06/12 23:14:02
***************
*** 110,133 ****
nsString* xmlns = new nsString( NS_ConvertToString(kXMLNSNameSpaceURI) );
nsString* xml = new nsString( NS_ConvertToString(kXMLNameSpaceURI) );
- nsString* html = new nsString( NS_ConvertToString(kHTMLNameSpaceURI) );
nsString* xhtml = new nsString( NS_ConvertToString(kXHTMLNameSpaceURI) );
nsString* xlink = new nsString( NS_ConvertToString(kXLinkNameSpaceURI) );
gURIArray->AppendElement(xmlns); // ordering here needs to match IDs
gURIArray->AppendElement(xml);
- gURIArray->AppendElement(html);
gURIArray->AppendElement(xhtml);
gURIArray->AppendElement(xlink);
NameSpaceURIKey xmlnsKey(xmlns);
NameSpaceURIKey xmlKey(xml);
- NameSpaceURIKey htmlKey(html);
NameSpaceURIKey xhtmlKey(xhtml);
NameSpaceURIKey xlinkKey(xlink);
gURIToIDTable->Put(&xmlnsKey, (void*)kNameSpaceID_XMLNS);
gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML);
- gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML);
gURIToIDTable->Put(&xhtmlKey, (void*)kNameSpaceID_HTML);
gURIToIDTable->Put(&xlinkKey, (void*)kNameSpaceID_XLink);
}
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
NS_ASSERTION(nsnull != gURIArray, "no URI array");
--- 110,133 ----
nsString* xmlns = new nsString( NS_ConvertToString(kXMLNSNameSpaceURI) );
nsString* xml = new nsString( NS_ConvertToString(kXMLNameSpaceURI) );
nsString* xhtml = new nsString( NS_ConvertToString(kXHTMLNameSpaceURI) );
nsString* xlink = new nsString( NS_ConvertToString(kXLinkNameSpaceURI) );
+ nsString* html = new nsString( NS_ConvertToString(kHTMLNameSpaceURI) );
gURIArray->AppendElement(xmlns); // ordering here needs to match IDs
gURIArray->AppendElement(xml);
gURIArray->AppendElement(xhtml);
gURIArray->AppendElement(xlink);
+ gURIArray->AppendElement(html);
NameSpaceURIKey xmlnsKey(xmlns);
NameSpaceURIKey xmlKey(xml);
NameSpaceURIKey xhtmlKey(xhtml);
NameSpaceURIKey xlinkKey(xlink);
+ NameSpaceURIKey htmlKey(html);
gURIToIDTable->Put(&xmlnsKey, (void*)kNameSpaceID_XMLNS);
gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML);
gURIToIDTable->Put(&xhtmlKey, (void*)kNameSpaceID_HTML);
gURIToIDTable->Put(&xlinkKey, (void*)kNameSpaceID_XLink);
+ gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML);
}
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
NS_ASSERTION(nsnull != gURIArray, "no URI array");
Index: nsIElementFactory.h
===================================================================
RCS file: /cvsroot/mozilla/layout/base/public/nsIElementFactory.h,v
retrieving revision 3.2
diff -c -r3.2 nsIElementFactory.h
*** nsIElementFactory.h 2000/05/10 13:13:05 3.2
--- nsIElementFactory.h 2000/06/12 23:15:38
***************
*** 46,52 ****
#define NS_ELEMENT_FACTORY_PROGID "component://netscape/layout/elemen
t-factory"
#define NS_ELEMENT_FACTORY_PROGID_PREFIX NS_ELEMENT_FACTORY_PROGID "?namespa
ce="
! #define NS_HTML_NAMESPACE "http://www.w3.org/TR/REC-html40"
#define NS_XML_NAMESPACE "http://www.w3.org/XML/1998/namespa
ce"
#define NS_HTML_ELEMENT_FACTORY_PROGID NS_ELEMENT_FACTORY_PROGID_PREFIX NS
_HTML_NAMESPACE
--- 46,52 ----
#define NS_ELEMENT_FACTORY_PROGID "component://netscape/layout/elemen
t-factory"
#define NS_ELEMENT_FACTORY_PROGID_PREFIX NS_ELEMENT_FACTORY_PROGID "?namespa
ce="
! #define NS_HTML_NAMESPACE "http://www.w3.org/1999/xhtml"
#define NS_XML_NAMESPACE "http://www.w3.org/XML/1998/namespa
ce"
#define NS_HTML_ELEMENT_FACTORY_PROGID NS_ELEMENT_FACTORY_PROGID_PREFIX NS
_HTML_NAMESPACE
Keywords: nsbeta2
Comment 2•26 years ago
|
||
This bug should be approved for nsbeta2+. Reason: developers will be
using JavaScript to inspect XHTML elements (HTML elements in XML) to see what
their namespace URI is (i.e. figure out which namespace a given element is part
of), and we don't want them to be forced to hardcode recognition of the wrong,
deprecated namespace REC-html40. If they do, then we'll be stuck with
supporting that incorrect namespace mapping forever, and indeed it would be
extremely difficult to ever fix the bug once content and web apps became
dependent on the incorrect URI. Hence, fixing this bug is a critical requirement
for assuring correctness of our XML Namespaces implementation.
Recommend nsbeta2+[6/22].
Comment 3•26 years ago
|
||
Note discussions of related issues in bug 7834, "REC-html40 should not be an
HTML namespace".
I think rbs just fixed this by swapping the values of the constants, but that
makes the constants misnamed.
I just noticed that Vidur has checked his patch in. Consequently, this bug is
going to be there because I had already temporarily swap the 'litteral strings'
of REC-html40 and the official namespace (bug 7834). I think it would be best
to remove the REC-html40 in nsNameSpaceManager.cpp and all the references to
kXHTML_... to avoid other potential collisions.
| Assignee | ||
Comment 7•26 years ago
|
||
Ack! I didn't notice that rbs switched the values of the literal strings. I'd
like to switch them back so that my patch works. I support the idea of removing
the REC-html40 version and I know that rbs has gone through the effort of
removing it from the Mozilla codebase. I suspect that we might break a host of
demos that we've already created using the old namespace, but now's the time to
update them, right? Eric Krock, what do you think?
I'm going to switch back the values of the literal strings and wait for ekrock's
response before removing the REC-html40 namespace.
| Assignee | ||
Comment 8•26 years ago
|
||
Switched back the values of the string literals. I'm going to close this one and
leave the discussion on whether to get rid of the REC-html40 namespace in bug
7834.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•