Closed Bug 309182 Opened 19 years ago Closed 19 years ago

getElementById does not return matching elements from other namespaces

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: doug, Unassigned)

References

()

Details

Attachments

(2 files)

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.
Can you reproduce this for non-xforms content?
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.
A minimal test file is at:

http://svg-whiz.com/svg/mozilla/getElementById.svg
Attached image getElementById bug
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>
  ]>
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
(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.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
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.)
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → INVALID
See bug 275196 for implementing xml:id.
(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.
(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.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: