Closed Bug 10292 Opened 25 years ago Closed 24 years ago

[FEATURE] XML IDs need to be recognized for ID selectors

Categories

(Core :: XML, defect, P1)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: nisheeth_mozilla)

References

()

Details

(Keywords: testcase, Whiteboard: [nsbeta2-] [nsbeta3+] [fixinhand] hit during nsbeta2 standards compliance testing)

XML IDs should be recognized by ID selectors in CSS, when defined as ID in the
DTD.  peterl said to file this against XML, because he didn't think expat
handles IDs yet.

Expected: above test ( http://www.fas.harvard.edu/~dbaron/css/test/xmlid )
should be displayed as described (with the lines three colors).

Tested on: Apprunner, 1999-07-20-10-M9 (mozilla.org opt), Linux.
The style system already has all the logic to make ID selector work for
anything. The XML content needs to reflect the ID value through the
nsIStyledContent interface.
Status: NEW → ASSIGNED
ccing James Clark.

James, will it be possible to inform embedders of expat that a particular
attribute name is of type ID without making expat XML-non-conformant?  Please
see the bug report for more context.

We don't need to validate that the attribute obeys the semantics of ID, so maybe
we can get away with doing this and still say that expat is a non-validating
parser.

Accepting bug.
Expat could report to applications which attribute, if any, was the ID
attribute. This would be a good thing (it's needed for XSLT too).  However, one
problem is that there's no way to represent this in the XML DOM, as far as I
know.  If you can deal with this, I can certainly add it to expat.

Given the Note at the end of the section 5.9 of the CSS Level 2 Rec I would give
this a fairly low priority.
I had a conversation regarding this with Vidur.  I'm adding him to the cc
list...
Target Milestone: M11
Setting milestone to M11...
Target Milestone: M11 → M14
This isn't a beta blocker.  Setting milestone to M14...
Bulk moving all M14 non-beta stopper bugs to M17...
Adding myself to the Cc list.

The nsIStyledContent that peterl mentioned above is also the gateway for getting
the support of "style", "id", and "class"... which are very much needed for 
MathML. As I mentioned in an email to nisheeth, vidur, and pierre, it is
presently impossible to do things like, e.g., <mytag color="any-color">, because
this requires the impossible task of enumerating all the colors in the .css
file. Whereas if "style" was supported, one could just do
<mytag style="color: any-color">...

XUL folks have been enjoying this for a long time since nsIStyledContent
is implemented by nsXULElement. It would be nice to enable this for all
XML elements to enrich the support of XML+CSS within Mozilla.
I seem to remember that GetElementById was moved to the DOMDocument even in DOM
1, but can't see a mention of this at W3C now. However, GetElementById certainly
is in DOMDocument in DOM 2 Candidate Rec, see:

http://www.w3.org/TR/DOM-Level-2/core.html#i-Document

So I think there is nothing in the DOM now that would be hindering this
implementation. This will also help in implementing XLink/XPointer, and
ID/IDREF(S) linking.
Adding "blocks" for bugs that also need to know about IDs.
Blocks: xpointer
OS: Linux → All
Hardware: PC → All
There's at least one remaining problem with ID/IDREF links, expat doesn't tell
the content sink which attribute is the ID/IDREF attribute...
Moving bugs out by one milestone...
Target Milestone: M17 → M18
Move back into M17...
Target Milestone: M18 → M17
Bringing in to M16...

James, do you think it will be possible for you to provide us with a patch that 
to expat that supports notification of ID attributes?
Target Milestone: M17 → M16
Please mark nsbeta2+[5/16-]. We need this feature in so that XML documents can
be formatted with CSS with specificity down to the unique-element level.
Keywords: nsbeta2
Summary: XML IDs need to be recognized for ID selectors → [FEATURE] XML IDs need to be recognized for ID selectors
Pasting an email update from James Clark...

> Nisheeth Ranjan wrote:
> If so, would it be possible for you to provide us with a patch to
> expat that reports entity declarations to the embedding application.  I know
> that you've already implemented notification of ID/IDREF attributes.  Do you
> have any plans for implementing notification of whether an attribute is
> "specified"?

You can already tell whether an attribute is specified by using
XML_GetSpecifiedAttributeCount.

At

  http://www.thaiopensource.com/dist/expat/test/expat-20000512.zip

you will find a test version of expat that adds support for notification
of ID attributes (not IDREF attributes) using XML_GetIdAttributeIndex,
and for notification of parsed general entity declarations via
XML_SetExternalParsedEntityDeclHandler and
XML_SetInternalParsedEntityDeclHandler.
Updating status whiteboard...
Whiteboard: Expected to land: 5/26/00
Putting on [nsbeta2-] radar. Not critical to beta2.
Whiteboard: Expected to land: 5/26/00 → [nsbeta2-]Expected to land: 5/26/00
In conjunction with this bug, it will be essential to be able to use 
document.getElementById on XML documents (DOM Level 2 extension).  Hopefully 
once this bug is fixed, it will be simple to get getElementById working.
Marking nsbeta3...
Keywords: nsbeta3
Whiteboard: [nsbeta2-]Expected to land: 5/26/00 → [nsbeta2-]
Setting milestone to M18...
Target Milestone: M16 → M18
Whiteboard: [nsbeta2-] → [nsbeta2-] hit during nsbeta2 standards compliance testing
nsbeta3+, lower priority
Priority: P3 → P4
Whiteboard: [nsbeta2-] hit during nsbeta2 standards compliance testing → [nsbeta2-] [nsbeta3+] hit during nsbeta2 standards compliance testing
Marking P1 because this is an important standards compliance issue
Priority: P4 → P1
QA Contact: chrisd → petersen
I have a fix in hand for this.  Will check it in post review and more testing.  
The expat release pointed to by James Clark's comment in this bug report is 
integrated into my local build.  ID attribute information is passed up from the 
parser to the content sink and into the node info objects associated with 
content objects.  nsIXMLContent now inherits from nsIStyledContent which allows 
authors to use ID selectors to target elements in an XML document.
Whiteboard: [nsbeta2-] [nsbeta3+] hit during nsbeta2 standards compliance testing → [nsbeta2-] [nsbeta3+] [fixinhand] hit during nsbeta2 standards compliance testing
The fix for this is checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Fixed in the Aug 31 build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.