Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1058134 of Attr.localName

  • Revision slug: Web/API/Attr/localName
  • Revision title: Attr.localName
  • Revision id: 1058134
  • Created:
  • Creator: Sebastianz
  • Is current revision? No
  • Comment Initial description of 'Attr.localName'DOM/Attr/Attr.localName Web/API/Attr/localName

Revision Content

{{APIRef("DOM")}}

The Attr.localName read-only property returns the local part of the qualified name of an element.

Before DOM4 this API was defined within the {{domxref("Node")}} interface.

Syntax

name = attribute.localName

Return value

A {{domxref("DOMString")}} representing the local part of the attribute's qualified name.

Notes

The local name of an attribute is the part of the attribute's qualified name that comes after the colon. Qualified names are typically used in XML as part of the namespace(s) of the particular XML documents.

Note: In {{Gecko("1.9.2")}} and earlier, the property returns the upper-cased version of the local name for HTML attributes in HTML DOMs (as opposed to XHTML attributes in XML DOMs). In later versions, in compliance with HTML5, the property returns in the case of the internal DOM storage, which is lower case for both HTML attributes in HTML DOMs and XHTML attributes in XML DOMs.

Specifications

Specification Status Comment
{{SpecName('DOM4', '#interface-attr', 'Attr.localName')}} {{Spec2('DOM4')}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 46.0[1] {{CompatGeckoDesktop("48.0")}}[1] {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatGeckoMobile("48.0")}}[1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] This API was previously availabe on the {{domxref("Node")}} API.

See also

  • {{domxref("Element.localName")}}
  • {{domxref("Node.localName")}}

Revision Source

<div>{{APIRef("DOM")}}</div>

<p>The <code><strong>Attr.localName</strong></code> read-only property returns the local part of the qualified name of an element.</p>

<div class="note">
<p>Before DOM4 this API was defined within the {{domxref("Node")}} interface.</p>
</div>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">
<var>name</var> = <var>attribute</var>.localName
</pre>

<h3 id="Return_value">Return value</h3>

<p>A {{domxref("DOMString")}} representing the local part of the attribute's qualified name.</p>

<h2 id="Notes" name="Notes">Notes</h2>

<p>The local name of an attribute is the part of the attribute's qualified name that comes after the colon. Qualified names are typically used in XML as part of the namespace(s) of the particular XML documents.</p>

<div class="note">
<p><strong>Note:</strong> In {{Gecko("1.9.2")}} and earlier, the property returns the upper-cased version of the local name for HTML attributes in HTML DOMs (as opposed to XHTML attributes in XML DOMs). In later versions, in compliance with HTML5, the property returns in the case of the internal DOM storage, which is lower case for both HTML attributes in HTML DOMs and XHTML attributes in XML DOMs.</p>
</div>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('DOM4', '#interface-attr', 'Attr.localName')}}</td>
   <td>{{Spec2('DOM4')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>46.0<sup>[1]</sup></td>
   <td>{{CompatGeckoDesktop("48.0")}}<sup>[1]</sup></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("48.0")}}<sup>[1]</sup></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] This API was previously availabe on the {{domxref("Node")}} API.</p>

<h2 id="See_also" name="See_also">See also</h2>

<ul>
 <li>{{domxref("Element.localName")}}</li>
 <li>{{domxref("Node.localName")}}</li>
</ul>
Revert to this revision