Closed Bug 128988 Opened 23 years ago Closed 23 years ago

setAttribute('href', link) on <a> tag does not work properly or at all

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
All
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: jwatt, Assigned: jst)

Details

Attachments

(1 file, 3 obsolete files)

Any attempt to assign an <a> element that has been created by document.createElement an href attribute fails to turn it into a link. Two testcases have been provided. In the first the href attribute is set on the created <a> element prior to its insertion into the document. In the second the href attribute is set after the <a> element has been inserted into the document. A more minor problem is that the cursor does not change when over a pre-existing <a> element that has been assigned an href attribute after the document has finished loading. A third testcase has been attached do demonstrate this.
Attached file setAttribute before appendChild (obsolete) —
Attached file setAttribute after appendChild (obsolete) —
Attached file setAttribute on existing <a> element (obsolete) —
The first two testcases are broken, but I get the hand cursor in the third on a fresh Linux build.
Keywords: testcase
Probably a dup of fixed bug 113310. What build were you using? Could you please re-test with a new build? Thanks in advance!
Fabian, build is 2002020406 (0.9.8). Christopher has just confirmed that the main part of this bug (setting an href attribute on a <a> element created through document.createElement) is _still_ broken on latest linux build. However, the second part is indeed a dup of fixed bug 113310.
Keywords: testcase
Attachment #72551 - Attachment is obsolete: true
Attachment #72549 - Attachment description: setAttribute before appendNode → setAttribute before appendChild
Additional information: After clicking on the text of what should be a link created through the DOM I get this warning in the JavaScript Console: Warning: reference to undefined property linkNode.href Source File: chrome://communicator/content/contentAreaClick.js Line: 153 Maybe helpful, maybe not.
changing priority to p3
Priority: -- → P3
I'm changing tabbrowser.xml so that a mouse hover over tabs will display that little close button icon but it seems that the stylesheet has been disabled after using setAttribute in onStateChange: This is how the code looks: if (this.mIcon) { this.mTab.setAttribute("image", this.mIcon); mIcon = ""; } The new code works just fine, but only if I remove setAttribute(). So the main problem is a disabled stylesheet.
I like to know if my problem is related, or that I need to file a new bug report?
CC'ed bz on request (IRC)
I have changed browser.css (cursor: grab;) to see _if_ the stylesheet was disabled, but that's a negative! The mouse pointer changed in a hand (mouse hovers) so the stylesheet is still Ok. Adding this.mTab.setAttribute("class", "tab-icon"); didn't help me either. Boris, do you know a way (css) to change the favicon/icon on the tabs on mouse hovers? This is what I use now: <snap> tab:hover, tab[busy]:hover { list-style-image: url("chrome://global/skin/icons/close.gif") !important; } </snap>
Attached file Working testcase
Working testcase.
Attachment #72549 - Attachment is obsolete: true
Attachment #72550 - Attachment is obsolete: true
We're dealing with XML here, which means if you want to create XHTML elements, you must use the DOM's createElementNS method to create elements in the XHTML namespace. document.createElement('a') will just create a vanilla 'a' element in no namespace. INVALID.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
marking verified , testcase 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.

Attachment

General

Created:
Updated:
Size: