Re: [cssom] CSSNamespaceRule

On 19/03/2014 14:55, Boris Zbarsky wrote:

> Concretely, consider a stylesheet author who first inserts this rule:
>
>    foo|bar { color: green; }
>
> and then inserts this rule:
>
>    @namespace bar url("something");
>
> During the first step, parsing of the rule fails, since the namespace
> prefix is unknown;

I want to come back to that. Selectors 3 REC says that a type selector
containing a namespace prefix that has not been previously declared
for namespaced selectors is in invalid selector. This is why you and
Simon Pieters have a problem with the proposal to allow namespace
insertion and modification. Allowing it will imply to reparse the
_original_ stylesheet textual contents since unrecognized namespaces
have thrown away the containing style rule... I understand the rationale
behind your answers now. Ack.

I am guilty for this, back in 2001. The prose, copied and pasted from
Peter's original 1999 spec on Namespaces and Gecko's behaviour, has
not changed since that day.

As the original author and editor of Selectors 3, I should have
detected this before, my bad. This behaviour specified by Selectors 3
was a mistake. A style rule containing an unrecognized namespace in a
type selector or attribute selector should just never match, but not be
invalid. I understand it will keep in the OM rules that never match but
the impact seems low: most documents relying on namespaces in selectors
will include namespace declarations or the corresponding styles won't
work at all and the web designer will see it. It's like having a
namespace declaration and style rules with that namespace in a
stylesheet but no element from that namespace in the document. We have
to deal with them in the style engine, they never match, they cost
some cycles. Author's responsibility.

</Daniel>

Received on Friday, 21 March 2014 08:56:21 UTC