[Mapcss] Selector syntax

Thomas Davie tom.davie at gmail.com
Sat Mar 12 23:16:26 GMT 2011

On 12 Mar 2011, at 20:03, Sebastian Klein wrote:

> Thomas Davie wrote:
>> The mapCSS 0.2 wiki page states that we may not write
>> relation[type=route]
>> way[highway]
>>  { stroke-color: red; }
>> as
>> relation [type=route]
>>  way [highway]
>>   { stroke-color: red; }
>> I see no reason why allowing this would make the grammar ambiguous, and disallowing it makes the grammar significantly more complex (we can't simply ignore whitespace tokens any more, and have to pollute every grammar rule with whitspace? between pretty much all tokens).
>> What's the reason for this restriction?
> The reason for this is to comply with css. Try the following snippet:
> <style type="text/css">
>   p [lang=en] { color: purple; }
> </style>
> <p lang="en">normal text</p>
> <p>text <span lang="en">in purple</span></p>
> The browser will consider [lang=en] to be a shortcut for *[lang=en] and make everything purple that has the lang=en property and is descendent of a <p> element.

Is * expected to be a valid object name in MapCSS too then? If it is I can completely understand doing this.  If not, it would seem that trying to maintain compatibility somewhere where we're already incompatible is a bit odd, especially when it makes parsing significantly harder.

Tom Davie

More information about the Mapcss mailing list