Re: : in CSS

On Thursday, February 20, 2003, 9:54:28 AM, Sigurd wrote:


SL> Hello,

SL> When parsing CSS, how do you differentiate between elements which have a :
SL> in their name (like svg:svg) and pseudo elements/classes like (svg:link)

By noting that no elements have a colon in their name, it being
reserved.

Assuming that the namespace prefix svg is declared to map to
http://www.w3.org/2000/svg then the qualified element name is the
tuple

local name = svg
namespace = http://www.w3.org/2000/svg

this would be used in a selector thus:

@namespace foo url(http://www.w3.org/2000/svg);

foo|svg { fill: purple }

Not that this will match all occurrences of the svg element in the SVG
namespace regardless of whether they use s:, svg: foobar: or nothing
as their prefix. It will not match elements that happen to be called
svg in some other namespace. Note that the choice of namespace prefix
in the CSS is arbitrary and is unaffected by the choice of prefix or
lack thereof in the file(s) that it is styling.

The alternative that people might have considered trying, svg\:svg is
bogus and harmful, because it pretends that the whole string is one
local name and because it makes assumptions about what the namespace
prefix is.

-- 
 Chris                            mailto:chris@w3.org

Received on Wednesday, 19 February 2003 07:47:05 UTC