Last Comment Bug 309182 - getElementById does not return matching elements from other namespaces
: getElementById does not return matching elements from other namespaces
Status: RESOLVED INVALID
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: x86 Windows XP
: -- major (vote)
: ---
Assigned To: General SVG Bugs
: Hixie (not reading bugmail)
:
Mentors:
http://svg-whiz.com/svg/mozilla/getEl...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-19 11:03 PDT by Doug Schepers
Modified: 2005-09-21 01:41 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
getElementById bug (3.37 KB, image/svg+xml)
2005-09-19 11:21 PDT, Doug Schepers
no flags Details
getElementById bug in a non-XForms context (1.29 KB, image/svg+xml)
2005-09-19 11:36 PDT, Doug Schepers
no flags Details

Description Doug Schepers 2005-09-19 11:03:40 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4

The ecmascript method getElementById does not return matching elements in the
document that do not have the SVG namespace. In my example file, modelled on [
http://www.w3.org/TR/2003/REC-xforms-20031014/sliceG.html#id2645506 ], MozSVG
will not find the element with id="form1":

<svg xmlns:s="http://example.com/survey"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns="http://www.w3.org/2000/svg">
    <xforms:model id="form1" schema="surveyschema.xsd">
    </xforms:model>
</svg>

Reproducible: Always

Steps to Reproduce:
1. Load the sample file.
2. Click on the Submit "button"
3. Observe if the element is found.

Actual Results:  
The element was not found.

Expected Results:  
The element should have been returned.

There is some question whether this is a bug or just a misfeature. It is unclear
if getElementById should technically work on all namespaces. My intuition is
that it should.

Prefixing the id as "xml:id" doesn't work in either FF1.5b1 or ASV3 (whereas
simply "id" does work in ASV3).

The justification for getting this to work is that Mozilla is in all other ways
a good environment for multi-ns docs, and this bug would deeply hamper efforts
to use best practices in that regard.
Comment 1 tor 2005-09-19 11:10:11 PDT
Can you reproduce this for non-xforms content?
Comment 2 Anne (:annevk) 2005-09-19 11:11:36 PDT
It should only do this when the XForms plugin is enabled and even then it is
dubious as the XForms specification is not particularly clear on this.

Mozilla only supports IDs at the moment either because of namespace specific
knowledge or because of an inline DTD. As there is no inline DTD here and
Mozilla has by default no knowledge of XForms this should not work.
Comment 3 Doug Schepers 2005-09-19 11:18:33 PDT
A minimal test file is at:

http://svg-whiz.com/svg/mozilla/getElementById.svg
Comment 4 Doug Schepers 2005-09-19 11:21:40 PDT
Created attachment 196675 [details]
getElementById bug
Comment 5 Doron Rosenberg (IBM) 2005-09-19 11:22:28 PDT
Sorry, this is an invalid bug.  XML document need to have their ID attribute
specified as per spec.  html gets it by default.

You want this:

  <!DOCTYPE rootelementname [
    <!ATTLIST elementname id ID #IMPLIED>
  ]>
Comment 6 Doug Schepers 2005-09-19 11:29:09 PDT
(In reply to comment #5)
> Sorry, this is an invalid bug.  XML document need to have their ID attribute
> specified as per spec.  html gets it by default.
> 
> You want this:
> 
>   <!DOCTYPE rootelementname [
>     <!ATTLIST elementname id ID #IMPLIED>
>   ]>

No, I most definitely don't want that. DOCTYPE declarations are being deprecated
in upcaming SVG, and are dissuaded in the current SVG spec.

That is not to say that this is definitely a valid bug, but that is not the
proper resolution.
Comment 7 Anne (:annevk) 2005-09-19 11:33:08 PDT
This bug is invalid. Mozilla does not have namespace specific knowledge about
the XForms namespace and therefore does not recognize the 'id' attribute as type ID.

You will have to wait till support for the 'xml:id' attribute is there or
download the XForms plugin. (If that does not work, it is either a bug in that
plugin or an oversight in the XForms specification.)
Comment 8 Doug Schepers 2005-09-19 11:36:19 PDT
Created attachment 196677 [details]
getElementById bug in a non-XForms context
Comment 9 Jonathan Watt [:jwatt] (back in October - email directly if necessary) 2005-09-19 11:43:47 PDT
See bug 275196 for implementing xml:id.
Comment 10 aaronr 2005-09-19 12:16:56 PDT
(In reply to comment #7)
> This bug is invalid. Mozilla does not have namespace specific knowledge about
> the XForms namespace and therefore does not recognize the 'id' attribute as
type ID.
> 
> You will have to wait till support for the 'xml:id' attribute is there or
> download the XForms plugin. (If that does not work, it is either a bug in that
> plugin or an oversight in the XForms specification.)

XForms doesn't define the 'id' attribute.  We rely on the hosting language (like
XHTML) or the document author (like in a XML document, as mentioned by doron) to
define the 'id' attribute.
Comment 11 Doug Schepers 2005-09-19 12:19:24 PDT
(In reply to comment #7)
> This bug is invalid. Mozilla does not have namespace specific knowledge about
> the XForms namespace and therefore does not recognize the 'id' attribute as
type ID.
> 
> You will have to wait till support for the 'xml:id' attribute is there 

Thanks, Anne, I suppose that this is the proper resolution (though I don't like
it, from a pragmatic standpoint).

> or
> download the XForms plugin. (If that does not work, it is either a bug in that
> plugin or an oversight in the XForms specification.)

I don't believe there is an id attribute in XForms. I think it relies on the
host language to provide one. 

I don't want to use an XForms plugin, however, since I want to render the XForms
myself.

Note You need to log in before you can comment on or make changes to this bug.