We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

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.

In DOM4 this API was moved from Node to the Element and Attr interfaces.

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 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

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No12

1 — 481

52

Yes3 No Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No No Yes9 No ? No

1. This API was moved to the Element and Attr APIs according to the DOM4 standard.

2. this property was read-write; starting with Firefox 5.0 it is read-only, following the specification.

3. Only supported on Element.

See also

Document Tags and Contributors

Last updated by: fscholz,