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.prefix
read-only property returns the namespace prefix of the specified node, or null
if no prefix is specified.
string = node.prefix
The following logs "x" to the console.
<x:div onclick="console.log(this.prefix)"/>
This will only work when a namespace-aware parser is used, i.e. when a document is served with an XML MIME type. This will not work for HTML documents.
Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 3 Core Specification The definition of 'Node.prefix' in that specification. | Obsolete | Specifies the behavior when it's set to null . |
Document Object Model (DOM) Level 2 Core Specification The definition of 'Initial definition' in that specification. | Obsolete | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | No | 12 | 1 — 48
|
Yes
|
No | Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | No | No | Yes | 9 | No | ? | No |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Node/prefix