Closed
Bug 76039
Opened 25 years ago
Closed 23 years ago
XML doc's getElementById does not match element in XUL namespace
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
VERIFIED
WORKSFORME
Future
People
(Reporter: pwilson, Assigned: hjtoi-bugzilla)
Details
(Keywords: testcase)
Attachments
(1 file)
|
3.81 KB,
application/x-javascript
|
Details |
getElementById always returns null on a DOM returned from nsDOMParser.
getElementsByTabName and XMLSerializer both work fine.
| Reporter | ||
Comment 1•25 years ago
|
||
| Reporter | ||
Comment 2•25 years ago
|
||
Have attached an amended utility.js file to show this bug.
Otherwise, use same files attached to bug # 75844
Comment 4•25 years ago
|
||
Marking NEW.
| Assignee | ||
Comment 5•25 years ago
|
||
I guess this one needs a simplified testcase. But I am wondering if there is in
fact some misunderstanding in here. Are you sure you are loading an XML document
that has an internal subset that defines the attribute as type ID? If you do not
do that, there is no way getElementById() will work.
So, the file you load, does it look something like:
<!DOCTYPE doc [
<!ATTLIST p id ID #IMPLIED>
]>
<doc>
<p>Foobar</p>
<p id="myid1">You can get this with getElementById("myid1")</p>
</doc>
?
Using the XHTML namespace will also work, i.e. if you have XHTML element with
attribute named "id", getElementById() will locate it. Other namespaces are not
supported in this way.
| Reporter | ||
Comment 6•25 years ago
|
||
The xml being loaded is the test.xul file which runs the test. Btw the
getElementById's in test.js should have "button1" as the parameter and not
"label1".
See also Bug # 78622
| Assignee | ||
Comment 7•25 years ago
|
||
I am changing the summary as I know believe the problem is that we are not
finding the XUL element with an id attribute. The XUL file does not explicitly
state the type of the ID attribute, and XML document's getElementById() only
matches attributes of type ID and XHTML id.
I am not sure if we even want to add special support for XUL namespace in normal
XML document. The probable workaround would be to explicitly state in the XUL
file which attributes are of type ID.
Moving to 1.0 for fix or re-evaluation.
Summary: getElementById returns null when document loaded by nsIDOMParser → XML doc's getElementById does not match element in XUL namespace
Target Milestone: --- → mozilla1.0
| Assignee | ||
Updated•25 years ago
|
Target Milestone: mozilla1.0 → mozilla0.9.9
| Assignee | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.9 → Future
Updated•24 years ago
|
Priority: -- → P5
Comment 9•23 years ago
|
||
From looking at the code, this is worksforme.
I tried a
doc=document.implementation.createDocument('','',null); // XMLDocument
doc.load("foo.xul");
doc.getElementById('bar');
which gave the same results as loading foo.xul in DOM inspector.
Same for aDOMParser.parseFromString('<?xml version="1.0"?>\n<window
id="WindowWithViews"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><vbox
id="shell"/></window>','text/xml')
[object XMLDocument]
js> dd.getElementById("junk")
js> dd.getElementById("shell")
[object XULElement]
code is
http://lxr.mozilla.org/seamonkey/source/content/xul/content/src/nsXULElement.cpp#3574
Please reopen with a testcase if I suck.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
| Assignee | ||
Comment 10•23 years ago
|
||
Dunno when this changed, but I can verify this now works.
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•