From e835f04c13a928ca5aa665e43bbb524a50aa590b Mon Sep 17 00:00:00 2001 From: Darren Shen Date: Mon, 19 Feb 2018 12:43:36 +1100 Subject: [PATCH 1/2] computedStyleMap() must return same object --- css-typed-om/Overview.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 2d828990..76197382 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -552,6 +552,8 @@ partial interface Element { Computed StylePropertyMap objects represent the [=computed values=] of an {{Element}}, and are accessed by calling the {{Element/computedStyleMap()}} method. +An {{Element}} must return the same {{StylePropertyMapReadOnly}} object +for every call of the {{Element/computedStyleMap()}} method.
The computedStyleMap() method must, From e72f693b68ce127e0589dc8f862fb6e1ba5e0b65 Mon Sep 17 00:00:00 2001 From: Darren Shen Date: Wed, 21 Feb 2018 09:16:54 +1100 Subject: [PATCH 2/2] Add explicit caching logic to computedStyleMap() --- css-typed-om/Overview.bs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/css-typed-om/Overview.bs b/css-typed-om/Overview.bs index 76197382..758dfc72 100644 --- a/css-typed-om/Overview.bs +++ b/css-typed-om/Overview.bs @@ -552,15 +552,19 @@ partial interface Element { Computed StylePropertyMap objects represent the [=computed values=] of an {{Element}}, and are accessed by calling the {{Element/computedStyleMap()}} method. -An {{Element}} must return the same {{StylePropertyMapReadOnly}} object -for every call of the {{Element/computedStyleMap()}} method. + +Every {{Element}} has a \[[computedStyleMapCache]] internal slot, +initially set to `null`, +which caches the result of the {{Element/computedStyleMap()}} method +when it is first called.
The computedStyleMap() method must, when called on an {{Element}} |this|, perform the following steps: - 1. Return a live {{StylePropertyMapReadOnly}} object, + 1. If |this|'s {{Element/[[computedStyleMapCache]]}} internal slot is set to `null`, + set its value to a live {{StylePropertyMapReadOnly}} object, whose {{[[declarations]]}} internal slot internal slot are the name and [=computed value=] of every longhand CSS property supported by the User Agent, every registered [=custom property=], @@ -568,6 +572,8 @@ for every call of the {{Element/computedStyleMap()}} method. on |this|, ordered by putting CSS-defined properties before custom properties, then sorting by code-point order of property name within those two categories. + + 2. Return |this|'s {{Element/[[computedStyleMapCache]]}} internal slot.
Note: like {{Window/getComputedStyle()|Window.getComputedStyle()}},