Re: CSS3 namespace feedback

On Wed, 12 Mar 2008 20:27:40 +0100, John Boyer <boyerj@ca.ibm.com> wrote:
> In the telecon today, we were unable to get back around to the topic  
> after
> the beginning of the call, but with respect to your proposed feedback
> here:
>
> http://lists.w3.org/Archives/Public/public-forms/2008Mar/0012.html
>
> Nick and I both felt that in principle the backwards compatibility
> argument was a good piece of feedback.
>
> I wondered, however, at what a resulting change would look like.  Would
> the behavior of  unqualified names seem bizarre or unnatural to
> namespace-aware authors?
>
> A few code examples might clarify quickly whether it "feels right".

Actually, I think XPath should have done this too. In my experience the  
first place a beginner trips up with XPath is trying to select like  
"html/body/p[1]"and wondering why it doesn't work. The answer is of  
course: you have to qualify elements. It would have been better if  
unqualified names matched any namespace (rather than the mythical no  
namespace).

So, my proposal is:

	a {text-decoration: underline; color: red}

should work with elements in any namespace, which is how it works now in  
CSS without namespace awareness (as long as the elements are unqualified  
in the document).

If you want to select elements in particular namespaces, then say so:

	@namespace html "http://..."
	@namespace svg  "http://..."

	html|a {color: blue}
	svg|a {color: green}

So putting it all together:

	@namespace html "http://..."
	@namespace svg  "http://..."

	a {text-decoration: underline; color: red}
	html|a {color: blue}
	svg|a {color: green}

all a elements would be underlined. XHTML ones would be coloured blue, SVG  
ones would be coloured green, and the rest would be red. In a  
non-namespaced CSS processor, all a elements would be red (and underlined).

Does that help?

Steven

Received on Wednesday, 12 March 2008 22:01:08 UTC