This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

prefix

Summary

Sets or retrieves the prefix of the fully qualified XML declaration for a node.

Property of dom/Nodedom/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