ObsoleteThis 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.
Syntax
string = node.prefix
Examples
The following logs "x" to the console.
<x:div onclick="console.log(this.prefix)"/>
Notes
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.
Specifications
Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.prefix' in that specification. | Obsolete | Specifies the behavior when it's set to null .
|
Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Initial definition' in that specification. | Obsolete | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
No support No |
Edge
No support 12 — 79 |
Firefox No support 1 — 48 No support 1 — 48 Notes' This API was moved to the Notes' this property was read-write; starting with Firefox 5.0 it is read-only, following the specification. |
IE Full support Yes Full support Yes Notes' Only supported on |
Opera
No support No |
Safari
Full support Yes |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
Full support 9 |
Opera Android
No support No |
Safari iOS
? |
Samsung Internet Android
No support No |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.'
- Deprecated. Not for use in new websites.
- See implementation notes.'
- See implementation notes.
See also
Node.prefix by Mozilla Contributors is licensed under CC-BY-SA 2.5.