Closed Bug 72045 Opened 24 years ago Closed 24 years ago

DOM unable to store references to Javascript Objects

Categories

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

defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: cosmic, Assigned: jst)

References

()

Details

Attachments

(1 file)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 0.8.1) Gecko/20010312 BuildID: 2001031204 At the URL: http://www.uq.net.au/~zzcprows/Development/mozilla_issues.html the first test should pop up an alert box showing the contents of an array that was stored as an attribute in the DOM. Reproducible: Always Steps to Reproduce: 1. Goto http://www.uq.net.au/~zzcprows/Development/mozilla_issues.html 2. Click the Test button. 3. Check the JavaScript console (in Tasks->Tools->JavaScript Console). Actual Results: Error: oTestObject.test_array has no properties Source File: http://www.uq.net.au/~zzcprows/Development/mozilla_issues.html Line: 34 Expected Results: Popped up an alert box saying: First element in Array should be "Hello World" First element in Array is "Hello World" Example code is available at: http://www.uq.net.au/~zzcprows/Development/mozilla_issues.html
Browser, not engine. Reassigning to DOM Level 0 -
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
I found this online-reference from the W3C (is it up-to-date? I don't know) setAttribute Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute. Parameters name The name of the attribute to create or alter. value Value to set in string form.
It seems to me like Mozilla is functioning according to this spec. I will attach a reduced testcase below -
Attached file Reduced testcase (deleted) —
The reduced testcase seems to show that when you use an object for the value parameter of setAttribute(), it comes back from getAttribute() as a literal string. Therefore it doesn't come back as an object; therefore it can't have properties as the reporter's testcase wants it to. Is this correct according to the W3C spec? If so, the bug may be invalid. I will leave this to the DOM experts -
Attribute values in the DOM are strings, so if you try to set the value of an attribute to something that is not a string the JS engine automatically converts the object into a string and that's what gets stored in the DOM. This is exactly per the DOM spec, thus this bug is invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
OS: Windows 2000 → All
Hardware: PC → All
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: