Skip to content

Commit cb4a549

Browse files
darrnshntabatkins
authored andcommitted
computedStyleMap() must return same object (#688)
* computedStyleMap() must return same object * Add explicit caching logic to computedStyleMap()
1 parent 82f0891 commit cb4a549

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

css-typed-om/Overview.bs

+9-1
Original file line numberDiff line numberDiff line change
@@ -534,19 +534,27 @@ partial interface Element {
534534
represent the [=computed values=] of an {{Element}},
535535
and are accessed by calling the {{Element/computedStyleMap()}} method.
536536

537+
Every {{Element}} has a <dfn attribute for=Element>\[[computedStyleMapCache]]</dfn> internal slot,
538+
initially set to `null`,
539+
which caches the result of the {{Element/computedStyleMap()}} method
540+
when it is first called.
541+
537542
<div algorithm>
538543
The <dfn method for="Element">computedStyleMap()</dfn> method must,
539544
when called on an {{Element}} |this|,
540545
perform the following steps:
541546

542-
1. Return a live {{StylePropertyMapReadOnly}} object,
547+
1. If |this|'s {{Element/[[computedStyleMapCache]]}} internal slot is set to `null`,
548+
set its value to a live {{StylePropertyMapReadOnly}} object,
543549
whose {{[[declarations]]}} internal slot internal slot are the name and [=computed value=] of
544550
every longhand CSS property supported by the User Agent,
545551
every registered [=custom property=],
546552
and every non-registered [=custom property=] which is not set to its initial value
547553
on |this|,
548554
ordered by putting CSS-defined properties before custom properties,
549555
then sorting by code-point order of property name within those two categories.
556+
557+
2. Return |this|'s {{Element/[[computedStyleMapCache]]}} internal slot.
550558
</div>
551559

552560
Note: like {{Window/getComputedStyle()|Window.getComputedStyle()}},

0 commit comments

Comments
 (0)