Bug 16505 - getElementById fails to find xml:id identified elements (xml:id support)
Summary: getElementById fails to find xml:id identified elements (xml:id support)
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.w3.org/2004/CDF/TestSuite/...
Depends on:
Blocks: 15836
  Show dependency treegraph
Reported: 2007-12-18 12:04 PST by Eric Seidel (no email)
Modified: 2019-02-06 09:02 PST (History)
8 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2007-12-18 12:04:26 PST
getElementById fails to find xml:id identified elements

Comment 1 Eric Seidel (no email) 2007-12-25 23:38:25 PST
It looks like WebKit currently has no support for xml:id.  It looks pretty simple to add:


We'll need to build a few test cases with errors and checking for id normalization, etc.
Comment 2 Eric Seidel (no email) 2007-12-25 23:45:56 PST
Test cases I can think of that we would need:

1.  Test null:id vs. xml:id, which wins when both are defined?
2.  Test multiple xml:id's (the parser will throw an error, i'm pretty sure)
3.  Test xml:id in HTML (we should probably ignore it)
4.  Text xml:id attribute normalization
  a. get the value via js (getAttribute, getAttributeNS, other ways?), which are normalized?
  b. set the value via js, see that it's properly normalized
  c. use getElementById to find normalized names.  should getElementById normalize its args?
5.  Possibly test lookup across documents.  an HTML document embedding an XML document, calling objectElement.contentDocument.getElementById() how is normalization handled, etc.

I think that's all we need to start with.  Writing those test cases will probably take longer than adding the support into Element.cpp, and adding the attribute name into xmlnames.in. :)

It's possible that Hixie or others have already made some of the tests we might need.  Heck, the W3c might even have a test suite for xml:id (I kinda doubt it).
Comment 3 Eric Seidel (no email) 2007-12-25 23:47:17 PST
There is actually a test suite!


We'd need to import that with any implementation patch.
Comment 4 Eric Seidel (no email) 2007-12-26 00:02:54 PST
important to note that the W3C tests link to these other tests from Opera:
Comment 5 Eric Seidel (no email) 2007-12-26 00:03:46 PST
And there are these from Hixie:
Comment 6 Sam Weinig 2007-12-26 00:51:48 PST
http://annevankesteren.nl/test/xml/xml-id/ and these are form Anne!
Comment 7 Sam Weinig 2007-12-26 00:52:30 PST
I didn't see that Eric had already noted the link to Anne's tests.  Oops.
Comment 8 Alexey Proskuryakov 2007-12-26 07:25:05 PST
Please note that HTML5 doesn't even mention xml:id (unlike xml:lang). Firefox 2.0 and 3.0 nightly don't pass these tests either.

It doesn't look entirely obvious that we should implement xml:id support. And if we do, we need to analyze all the controversy around it!

See also: bug 12971.
Comment 9 Eric Seidel (no email) 2007-12-27 22:37:13 PST
The official consensus between Maciej, Alexey and I is that we're not interested in implementing xml:id in WebKit at this time.

It is unfortunate that SVG 1.2 has recommended xml:id (then again, SVG 1.2 has done lots of other unfortunate things as well).


I'll communicate our disinterest to my WICD connections.

Comment 10 Lucas Forschler 2019-02-06 09:02:57 PST
Mass moving XML DOM bugs to the "DOM" Component.