aboutsummaryrefslogtreecommitdiff
path: root/files/fr/orphaned/web/api/element/currentstyle/index.html
blob: fdc866673152482f8196c57b0ab892f9e63cd3bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: Element.currentStyle
slug: orphaned/Web/API/Element/currentStyle
tags:
  - API
  - NeedsExample
  - Non-standard
  - Property
translation_of: Web/API/Element/currentStyle
original_slug: Web/API/Element/currentStyle
---
<div>{{APIRef("DOM")}}{{Non-standard_header}}</div>

<p class="summary"><strong><code>Element.currentStyle</code></strong> est une propriété propriétaire qui est similaire à la méthode normalisée {{DOMxRef("window.getComputedStyle()")}}. Elle est disponible dans les anciennes versions de Microsoft Internet Explorer. Cependant, elle renvoie les unités définies dans CSS alors que <code>window.getComputedStyle()</code> renvoie les valeurs en pixels.</p>

<h2 id="Polyfill">Prothèse d'émulation</h2>

<div class="notecard note">
  <p>Cette prothèse d'émulation retourne les valeurs en pixels et risque d'être plutôt lent, car il doit appeler {{domxref("window.getComputedStyle()")}} chaque fois que sa valeur est lue.</p>
</div>

<pre class="brush: js">/* Tout droit d'auteur est dédié au domaine public.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

if (!("currentStyle" in Element.prototype)) {
  Object.defineProperty(Element.prototype, "currentStyle", {
    get: function() {
      return window.getComputedStyle(this);
    }
  });
}
</pre>

<h2 id="Specifications">Spécifications</h2>

<p>Ne fait partie d'aucune spécification.</p>

<p>Microsoft <a href="https://web.archive.org/web/20150629144515/https://msdn.microsoft.com/en-us/library/ms535231(v=vs.85).aspx">a une description MSDN</a>.</p>

<h2 id="Browser_compatibility">Compatibilité des navigateurs</h2>

<p>{{Compat("api.Element.currentStyle")}}</p>

<h2 id="See_also">Voir aussi</h2>

<ul>
  <li>{{DOMxRef("Element.runtimeStyle")}}</li>
  <li>{{DOMxRef("window.getComputedStyle()")}}</li>
</ul>