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 750943 of SVGStylable

  • Revision slug: Web/API/SVGStylable
  • Revision title: SVGStylable
  • Revision id: 750943
  • Created:
  • Creator: fscholz
  • Is current revision? Yes
  • Comment

Revision Content

{{APIRef("SVG")}}

SVG stylable interface

The SVGStylable interface is implemented on all objects corresponding to SVG elements that can have {{ SVGAttr("style") }}, {{SVGAttr("class")}} and presentation attributes specified on them.

Interface overview

Also implement None
Methods
  • {{ domxref("CSSValue") }} getPresentationAttribute(in {{ domxref("DOMString") }} name)
Properties
  • readonly {{ domxref("SVGAnimatedString") }} className
  • readonly {{ domxref("CSSStyleDeclaration") }} style
Normative document SVG 1.1 (2nd Edition)

Properties

Name Type Description
className {{ domxref("SVGAnimatedString") }} Corresponds to attribute {{ SVGAttr("class") }} on the given element.
style {{ domxref("CSSStyleDeclaration") }} Corresponds to attribute {{ SVGAttr("style") }} on the given element.

Methods

Name & Arguments Return Description
getPresentationAttribute(in {{ domxref("DOMString") }} name) {{ domxref("CSSValue") }} Returns the base (i.e., static) value of a given presentation attribute as an object of type {{ domxref("CSSValue") }}. The returned object is live; changes to the objects represent immediate changes to the objects to which the {{ domxref("CSSValue") }} is attached.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

 

Revision Source

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

<h2 id="SVG_stylable_interface">SVG stylable interface</h2>

<p>The <code>SVGStylable</code> interface is implemented on all objects corresponding to SVG elements that can have {{ SVGAttr("style") }}, {{SVGAttr("class")}} and presentation attributes specified on them.</p>

<h3 id="Interface_overview">Interface overview</h3>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">Also&nbsp;implement</th>
   <td><em>None</em></td>
  </tr>
  <tr>
   <th scope="row">Methods</th>
   <td>
    <ul>
     <li>{{ domxref("CSSValue") }} <code>getPresentationAttribute(in {{ domxref("DOMString") }} name)</code></li>
    </ul>
   </td>
  </tr>
  <tr>
   <th scope="row">Properties</th>
   <td>
    <ul>
     <li>readonly {{ domxref("SVGAnimatedString") }} <code>className</code></li>
     <li>readonly {{ domxref("CSSStyleDeclaration") }} <code>style</code></li>
    </ul>
   </td>
  </tr>
  <tr>
   <th scope="row">Normative&nbsp;document</th>
   <td><a class="external" href="https://www.w3.org/TR/SVG11/types.html#InterfaceSVGStylable" title="https://www.w3.org/TR/SVG11/types.html#InterfaceSVGStylable">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="Properties">Properties</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th>Name</th>
   <th>Type</th>
   <th>Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>className</code></td>
   <td>{{ domxref("SVGAnimatedString") }}</td>
   <td>Corresponds to attribute {{ SVGAttr("class") }} on the given element.</td>
  </tr>
  <tr>
   <td><code>style</code></td>
   <td>{{ domxref("CSSStyleDeclaration") }}</td>
   <td>Corresponds to attribute {{ SVGAttr("style") }} on the given element.</td>
  </tr>
 </tbody>
</table>

<h2 id="Methods">Methods</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th>Name &amp; Arguments</th>
   <th>Return</th>
   <th>Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code><strong>getPresentationAttribute</strong>(in {{ domxref("DOMString") }} <em>name</em>)</code></td>
   <td>{{ domxref("CSSValue") }}</td>
   <td>Returns the base (i.e., static) value of a given presentation attribute as an object of type {{ domxref("CSSValue") }}. The returned object is live; changes to the objects represent immediate changes to the objects to which the {{ domxref("CSSValue") }} is attached.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="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 (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</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>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<p>&nbsp;</p>
Revert to this revision