W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2016

Re: [csswg-drafts] [cssom] Should make it clear that static functions on CSS are Window-scoped

From: Domenic Denicola via GitHub <sysbot+gh@w3.org>
Date: Thu, 23 Jun 2016 14:54:19 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-228075960-1466693658-sysbot+gh@w3.org>
You have two choices here, basically depending on whether you think of
 `CSS` as a state-carrying registry, or a namespace object full of 
functions.

The distinguishing code is 
`window1.CSS.registerProperty.call(window2.CSS, ...)`.

- If `CSS` is a state-carrying registry, then this should register the
 property on `window2`.
- If `CSS` is just a bag of functions, it doesn't matter what the 
`this` value you call them with is, so this should register the 
property on `window1`.

To access `window1` you'd use "this `CSS` interface object's [relevant
 global 
object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global)".
 (Alternately you could store the state on the `CSS` interface object 
itself, instead of grabbing a window.)

To access `window2` you'd use "the [current global 
object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)".

In both cases you could add "...'s [associated 
`Document`](https://html.spec.whatwg.org/multipage/browsers.html#concept-document-window)"
 if you wanted things to go away during `document.open()`, which 
replaces the `Document` but keeps the `Window`.

-- 
GitHub Notification of comment by domenic
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/180#issuecomment-228075960 
using your GitHub account
Received on Thursday, 23 June 2016 14:54:31 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:40:59 UTC