Monday, May 26th, 2008

W3C CSS Namespaces; Now a Candidate Recommendation

Category: CSS, Standards

<p>The CSS Namespace Module has now been bumped up to a “W3C Candidate Recommendation”, thanks to the work of Elika J. Etemad and Anne van Kesteren (who built on the earlier work of Peter Linss and Chris Lilley).

The module is simple, but will be a very welcome addition:

This CSS Namespaces module defines the syntax for using namespaces in CSS. It defines the @namespace rule for declaring the default namespace and binding namespaces to namespace prefixes, and it also defines a syntax that other specifications can adopt for using those prefixes in namespace-qualified names.

This example does a good job at showing the namespaces:

Given the namespace declarations:

  1. @namespace toto "http://toto.example.org";
  2. @namespace "http://example.com/foo";

In a context where the default namespace applies:

  • toto|A:
    represents the name A in the http://toto.example.org namespace.
  • |B:
    represents the name B that belongs to no namespace.
  • *|C:
    represents the name C in any namespace, including no namespace.
  • D:
    represents the name D in the http://example.com/foo namespace.

This is a good step, but what we really wait for is the support in major browsers!

Related Content:

Posted by Dion Almaer at 9:26 am
3 Comments

++++-
4 rating from 13 votes

3 Comments »

Comments feed TrackBack URI

I’ve always hated the use of the pipe ‘|’ character for this back when it was first proposed. Yes, “:” is already used to separate pseudoclasses/elements, but perhaps they could have used “::” instead which is the scoping operator in “some” programming languages (e.g. C++) Or given that they are using suffix operations now, they could have just used pseudo-class syntax

Compare:

toto|A { … }

vs

A::toto { … }

or

toto:ns(A)

Perhaps they considered this at the WG and rejected it for some reasons.

Comment by cromwellian — May 26, 2008

So I would go:
namespace|ul li a{}

but could I go:
ul li namespace|a{} …?

Comment by JeromeLapointe — May 26, 2008

Also I wonder how complicated it will be when you have your xml namespaces and CSS name spaces and need to target both… like xforms where you’d like to create some namespace to split sub portion of the website… like the affiliate program related pages… and therefor differentiate between your two xform signup pages… in this case the “username” …

affiliates|xf\:input#username

?

Comment by JeromeLapointe — May 27, 2008

Leave a comment

You must be logged in to post a comment.