Closed Bug 340429 Opened 18 years ago Closed 18 years ago

cloneNode fails to clone non-xhtml attributes

Categories

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

1.0 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 50533

People

(Reporter: digitalpacman, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

I am using HTML elements on the page as objects, assigning them custom attributes, and referencing them in my script. Such as a DIV element, I am setting an ORDER to it. So div.order = 5

This all works fine and dandy till I attempt to do cloneNode(true) to copy the element. The custom fields I created are not cloned to the new element. This works properly in MSIE.

var a = document.createElement("DIV")
a.order = 50;
alert(a.order);
b = a.cloneNode(true);
alert(b.order);

a.order is defined, but b.order is undefined

Reproducible: Always

Steps to Reproduce:
var a = document.createElement("DIV")
a.order = 50;
alert(a.order);
b = a.cloneNode(true);
alert(b.order);
Actual Results:  
The custom attributes are undefined.

Expected Results:  
The custom attributes should be defined.

cloneNode is supposed to make it clone the node, so this really should be adapted, quickly. This just totaly ruined everthing I coded for weeks using MSIE, expecting to be able to Xfer my code to FF with minor changes. But this makes it virtually impossible to do as I wanted, without MAJOR implications.

NOTE:
If you set the attributes using setAttribute and getAttribute it works as intended. But if you set it using the . operator they are not copied. So obviously this is just something that was simply overlooked.
Component: Build Config → General
QA Contact: build.config → general
Attached file Testcase
Testcase from authors comment.
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Product: Firefox → Core
Version: unspecified → 1.0 Branch

*** This bug has been marked as a duplicate of 50533 ***
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: