Re: [cssom] CSSRule.parentRule and CSSRule.parentStyleSheet should return a "CSSRule?"

On Sat, Sep 1, 2012 at 9:41 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 8/31/12 8:41 PM, Glenn Adams wrote:
>
>> Please check. If CSSOM defined constructors for CSSRule concrete
>> subclasses, then I could see this happening. But it doesn't at present,
>> and I'm not sure it appropriate to spec if the spec doesn't otherwise
>> define a context in which it could be null.
>>
>
> I think the issue here might be one of lifetime management.  I believe
> that if you're holding on to a rule and the rule's stylesheet is not
> attached to a document and you're not holding on to the stylesheet itself
> we will garbage-collect the stylesheet and null out the rule's
> parentStyleSheet.  Could be wrong, though.
>

At present, CSSOM doesn't provide a way to construct stylesheets or
add/remove them from document.styleSheets, so this seems like an
implementation issue.

Do you think we should add full ability to construct rule instances,
stylesheet instances, etc.? In such case, we would certainly need to
support having parentStyleSheet nullable. I believe some browsers may
already support such mechanisms as extensions over the original DOM-2 Style
APIs.

Received on Saturday, 1 September 2012 02:03:23 UTC