この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
この記事を English (US) で読むこともできます。

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The Node.getUserData() method returns any user DOMUserData set previously on the given node by Node.setUserData().

The Node.setUserData and Node.getUserData methods are no longer available from Web content. Element.dataset or WeakMap can be used instead.

Syntax

userData = someNode.getUserData(userKey);

Parameters

  • userKey is the key to choose the specific data sought for the given node. More than one key may have been assigned on a given node, containing its own value.

Example

var d = document.setUserData('key', 15, null);
console.log(document.getUserData('key')); // 15

Specifications

Specification Status Comment
DOM
The definition of 'Node' in that specification.
Living Standard Removed from the specification.
Document Object Model (DOM) Level 3 Core Specification
The definition of 'Node.getUserData()' in that specification.
Obsolete Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support 1.0 (1)
No support 22.0
? No support No support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support 1.0 (1.7 or earlier)
No support 22.0
(Yes) No support No support

See also

ドキュメントのタグと貢献者

最終更新者: chrisdavidmills,