Closed Bug 1034858 Opened 10 years ago Closed 6 years ago

DOM attribute isId property (Attr::isId) returns undefined

Categories

(Other Applications :: DOM Inspector, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: vshalimhr, Unassigned, NeedInfo)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 SeaMonkey/2.25 (Beta/Release)
Build ID: 20140318183706

Steps to reproduce:

Open the attached test page and click the Test button.



Actual results:

The isId attribute doesn't exist:
attr: 'id'
isId: exists: false, value=[undefined]: undefined

The result doesn't depend on the rendering mode (quirks/standards).

This breaks DOM Inspector's search by ID - see the doFindElementById() function in /chrome/inspector/content/inspector/viewers/dom/dom.js, line 938 (for version 2.0.15pre). As a workaround, you can use search by attribute, with the attribute name set to "id".


Expected results:
DOM Inspector Search by id works for me (See 865008). Also this modified test works for me.

Also see:
http://help.dottoro.com/ljrgussb.php
> The isId property does not work in XML documents, only in HTML documents.
> For a cross-browser solution, use the value of the name property instead.

http://help.dottoro.com/external/examples/ljrgussb/isId_1.htm

@Neil: perhaps we should do it the way dottoro does?

It's true however that we should really really ship a new DOM Inspector

@Iann weren't you going to release a new DOM Inspector and upload it to addons.mozilla?
Flags: needinfo?(neil)
Flags: needinfo?(iann_bugzilla)
Group: core-security
Status: UNCONFIRMED → NEW
Depends on: 865008
Ever confirmed: true
Removing accidental s-g bit.
Group: core-security
(In reply to Peter B. Shalimoff)
> This breaks DOM Inspector's search by ID - see the doFindElementById()
> function in /chrome/inspector/content/inspector/viewers/dom/dom.js, line 938
> (for version 2.0.15pre). As a workaround, you can use search by attribute,
> with the attribute name set to "id".
Flags: needinfo?(neil)
(Sorry for the accidental submit)

(In reply to Peter B. Shalimoff)
> This breaks DOM Inspector's search by ID - see the doFindElementById()
> function in /chrome/inspector/content/inspector/viewers/dom/dom.js, line 938
> (for version 2.0.15pre). As a workaround, you can use search by attribute,
> with the attribute name set to "id".

(In reply to Philip Chee)
> DOM Inspector Search by id works for me (See 865008). Also this modified
> test works for me.

DOM Inspector 2.0.14 does it the "old" way using isId. Current tip DOM Inspector includes the fix to bug 865008 and is therefore able to locate the elements correctly.

> perhaps we should do it the way dottoro does?

Enumerating the attributes and choosing the one named "id" is pointless, we simply go directly to getAttribute("id") which works well enough on all supported versions of Gecko.
Component: General → DOM Inspector
Product: SeaMonkey → Other Applications
Version: SeaMonkey 2.25 Branch → Trunk
> Component: General → DOM Inspector

Undo this please. In case it's still unclear from the title, this bug is not about DOM Inspector (there's already bug 865008 for that), but about the browser itself, namely about the isId property not existing (returning undefined) for both HTML and XML documents, despite the documentation at MDN says it exists (https://developer.mozilla.org/en/docs/Web/API/Attr) and it's not in the deprecated list (https://developer.mozilla.org/en/docs/Web/API/Attr#Deprecated_properties_and_methods), and using it doesn't result in any deprecation warnings in the console - see my html test page.

Is the attribute removed? It exists in Attr.cpp (line 322 in http://dxr.mozilla.org/mozilla-central/source/content/base/src/Attr.cpp) and in nsIDOMAttr.idl (line 28 in http://dxr.mozilla.org/mozilla-central/source/dom/interfaces/core/nsIDOMAttr.idl), but doesn't exist in Attr.webidl (http://dxr.mozilla.org/mozilla-central/source/dom/webidl/Attr.webidl).
Attached file dom_attr_isId_test.xml
A test XML document that demonstrates isId doesn't exist for XML either. Just use the code from the HTML test document (single line) in the address bar:
[code]
javascript:function test(){var a = document.getElementById('p').attributes[0];alert("attr: '" + a.nodeName + "'"+ "\nisId: exists: " + ("isId" in a) + ", value=[" + typeof(a.isId) + "]: " + a.isId);} test();
[/code]
Bulk close. This component is no longer supported or maintained.

https://bugzilla.mozilla.org/show_bug.cgi?id=1499023
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Bulk close. This component is no longer supported or maintained.

https://bugzilla.mozilla.org/show_bug.cgi?id=1499023
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: