Skip to content

Commit 5d1b161

Browse files
darrnshnshans
authored andcommitted
[css-typed-om] w3c#350 Rename styleMap and getComputedStyleMap (w3c#454)
* Move getComputedStyleMap to CSS namespace * Rename to attributeStyleMap/computedStyleMap * Rename CSSStyleRule.styleMap as well
1 parent eac7e7d commit 5d1b161

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

css-typed-om/Overview.bs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -381,21 +381,19 @@ Computed {{StylePropertyMapReadOnly}} objects {#computed-stylepropertymapreadonl
381381
--------------------------------------------------------------------------
382382

383383
<pre class='idl'>
384-
partial interface Window {
385-
StylePropertyMapReadOnly getComputedStyleMap(Element element, optional DOMString? pseudoElt);
384+
partial interface Element {
385+
StylePropertyMapReadOnly computedStyleMap();
386386
};
387387
</pre>
388388

389-
Issue(350): getComputedStyleMap needs to move to CSS
390-
391389
<dfn>Computed StylePropertyMap</dfn> objects represent the computed style of an
392390
{{Element}} or pseudo element, and are accessed by calling the
393-
{{Window/getComputedStyleMap()}} method.
391+
{{Element/computedStyleMap()}} method.
394392

395393
When constructed, the [=property model=] for [=computed StylePropertyMap=]
396394
objects is initialized to contain an entry for every valid CSS property supported by the User Agent.
397395

398-
Note: The StylePropertyMap returned by getComputedStyleMap represents computed style,
396+
Note: The StylePropertyMap returned by computedStyleMap represents computed style,
399397
not resolved style. In this regard it provides different values than those
400398
in objects returned by getComputedStyle.
401399

@@ -404,12 +402,12 @@ Declared {{StylePropertyMap}} objects {#declared-stylepropertymap-objects}
404402

405403
<pre class='idl'>
406404
partial interface CSSStyleRule {
407-
[SameObject] readonly attribute StylePropertyMap styleMap;
405+
[SameObject] readonly attribute StylePropertyMap attributeStyleMap;
408406
};
409407
</pre>
410408

411409
<dfn>Declared StylePropertyMap</dfn> objects represent style property-value pairs embedded
412-
in a style rule, and are accessed via the <dfn attribute for=CSSStyleRule>styleMap</dfn>
410+
in a style rule, and are accessed via the <dfn attribute for=CSSStyleRule>attributeStyleMap</dfn>
413411
attribute of {{CSSStyleRule}} objects.
414412

415413
When constructed, the [=property model=] for [=declared StylePropertyMap=]
@@ -424,12 +422,12 @@ Inline {{StylePropertyMap}} objects {#inline-stylepropertymap-objects}
424422

425423
<pre class='idl'>
426424
partial interface Element {
427-
[SameObject] readonly attribute StylePropertyMap styleMap;
425+
[SameObject] readonly attribute StylePropertyMap attributeStyleMap;
428426
};
429427
</pre>
430428

431429
<dfn>Inline StylePropertyMap</dfn> objects represent inline style declarations attached
432-
directly to {{Element}}s. They are accessed via the <dfn attribute for=Element>styleMap</dfn>
430+
directly to {{Element}}s. They are accessed via the <dfn attribute for=Element>attributeStyleMap</dfn>
433431
attribute of {{Element}} objects.
434432

435433
When constructed, the [=property model=] for [=inline StylePropertyMap=] objects
@@ -578,13 +576,13 @@ Instead, clamping and/or rounding will occur during computation of style.
578576
The following code is valid
579577

580578
<pre class=lang-js>
581-
myElement.styleMap.set("opacity", CSS.number(3));
582-
myElement.styleMap.set("z-index", CSS.number(15.4));
579+
myElement.attributeStyleMap.set("opacity", CSS.number(3));
580+
myElement.attributeStyleMap.set("z-index", CSS.number(15.4));
583581

584-
console.log(myElement.styleMap.get("opacity").value); // 3
585-
console.log(myElement.styleMap.get("z-index").value); // 15.4
582+
console.log(myElement.attributeStyleMap.get("opacity").value); // 3
583+
console.log(myElement.attributeStyleMap.get("z-index").value); // 15.4
586584

587-
var computedStyle = getComputedStyleMap(myElement);
585+
var computedStyle = myElement.computedStyleMap();
588586
var opacity = computedStyle.get("opacity");
589587
var zIndex = computedStyle.get("z-index");
590588
</pre>
@@ -2172,7 +2170,7 @@ The {{CSSPositionValue/x}} attribute expresses the offset from the left edge of
21722170
Will produce the following behavior:
21732171

21742172
<pre class='lang-javascript'>
2175-
let map = document.querySelector('.example').styleMap;
2173+
let map = document.querySelector('.example').attributeStyleMap;
21762174

21772175
map.get('object-position').x;
21782176
// CSS.percent(50)
@@ -2752,7 +2750,7 @@ var length2 = CSSNumericValue.from(42.0, "px");
27522750
length2.toString(); // "42px";
27532751

27542752
element.style.width = "42.0px";
2755-
var length3 = element.styleMap.get('width');
2753+
var length3 = element.attributeStyleMap.get('width');
27562754
length3.toString(); // "42px";
27572755
</pre>
27582756

0 commit comments

Comments
 (0)