WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
39699
Implement DOM Level 3 Node::getUserData/setUserData
https://bugs.webkit.org/show_bug.cgi?id=39699
Summary
Implement DOM Level 3 Node::getUserData/setUserData
kangax
Reported
2010-05-25 16:36:08 PDT
DOM Level 3 is currently draft, but `Node::getUserData` (
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-getUserData
)/`Node::setUserData` (
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-setUserData
) are already implemented in Mozilla and are a convenient way to store user data for node (instead of assigning expandos).
Attachments
Add attachment
proposed patch, testcase, etc.
Sam Weinig
Comment 1
2010-11-11 08:05:51 PST
How does using userData differ from using expandos? Why would one want to use use it rather than an expando?
kangax
Comment 2
2010-11-11 08:22:08 PST
The problem with expandos is collisions with members of any interfaces implemented by a node in question. How can you have a data under a key of "nodeName", "appendChild", etc. In implementations that make DOM objects inherit from Object.prototype or Function.prototype (such as webkit) there's additional set of candidates for collisions (toString, constructor, call, etc.).
Anne van Kesteren
Comment 3
2010-11-11 08:31:41 PST
If the problem is collisions we should do something much simpler than UserData imo. (Note that UserData is tentatively removed from Web DOM Core.)
kangax
Comment 4
2010-11-11 08:59:00 PST
(In reply to
comment #3
)
> If the problem is collisions we should do something much simpler than UserData imo. (Note that UserData is tentatively removed from Web DOM Core.)
Ok. But simpler how? I can imagine something like `Node::userData` (shorter name + no function call) where `userData` would need to be explicitly specified to have [[Prototype]] of null. Or did you mean something else?
John-David Dalton
Comment 5
2010-11-11 09:31:53 PST
I know there are also issues with expando's and cloneNode() in IE (IE copies non-object value expandos to the clone, and also issues with some Java Applets barfing when devs attempt to set expando's on them.
Lucas Forschler
Comment 6
2019-02-06 09:03:36 PST
Mass moving XML DOM bugs to the "DOM" Component.
Anne van Kesteren
Comment 7
2023-08-26 01:08:50 PDT
This feature is no longer standardized. The alternative is using WeakMap.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug