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

On Aug 31, 2012 10:04 PM, "Glenn Adams" <glenn@skynav.com> wrote:
>
>
>
> 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.
>

Yes, please.  Creating stylesheets is done via DOM all the time and there
are actually some browser differences in various approaches.  It does seem
like it should be a standard capability with a well documented api, then as
you say, the question about null is evident and can be commonly worked
through, specified and implemented.

Received on Sunday, 2 September 2012 14:39:28 UTC