display of anchor element DOM nodes displays the href attribute instead of the node description

RESOLVED INVALID

Status

()

RESOLVED INVALID
14 years ago
10 years ago

People

(Reporter: aceop, Unassigned)

Tracking

Trunk
x86
Windows 98
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7) Gecko/20040616

I've made experiments with the DOM in order to re-arrange parts of websites.
I've tried walking through the DOM in a recursive way.
Displaying a node with alert(node) normally produces output like "object text"
or "objekt HTMLLiElement" or something.
Only if you display an anchor node this way, you get the href attributes value
instead. I find that's kind of strange and disturbing.

Reproducible: Always
Steps to Reproduce:
1. Load the testcase I'll attach with JS enabled and see.
Actual Results:  
The alert displays "[object text]" for the text nodes, "http://www.mozilla.org"
for the anchor element and "[object HTMLDivElement]" for the div element.

Expected Results:  
It should have displayed "[objekt HTMLAnchorElement]" for the anchor element.
(Reporter)

Comment 1

14 years ago
Created attachment 154471 [details]
a very minimal testcase demonstrating the problem

the testcase promised
Calling alert() on something just calls its toString() method and then alerts
the string.

Now anchor elements happen to have a nontrivial toString() method for DOM0 compat.

So everything is working as expected.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
*** Bug 361174 has been marked as a duplicate of this bug. ***

Updated

10 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.