prefix
Summary
Sets or retrieves the prefix of the fully qualified XML declaration for a node.
Syntax
Note: This property is read-only.
var prefix = node.prefix;
Return Value
Returns an object of type StringString
The prefix portion of the qualified name of the node.
Examples
This example 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.
<x:div onclick="alert(this.prefix)"/>
Usage
In XML documents, elements can be declared using qualified names, which consist of a prefix and a localName. This property returns the former value.
For more information, see W3C Namespaces in XML.
Notes
Prior to Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), this property was read-write; the specification says it should be read only, and now it is.
Related specifications
- DOM Level 3 Core
- Recommendation
Attributions
Mozilla Developer Network : [Node.prefix Article]
Microsoft Developer Network: [prefix Property Article]