W3C home > Mailing lists > Public > www-style@w3.org > August 2012

[css3-conditional] whitespace processing in supportsCSS

From: Florian Rivoal <florianr@opera.com>
Date: Fri, 03 Aug 2012 13:49:56 +0200
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.wigq5ia84p7avi@localhost.localdomain>
The spec currently doesn't say if the 'property' and 'value' arguments of  
supportsCSS are allowed
to have trailing or leading whitespace.

If we go by the strict definitions of 'property' and 'value' in  
http://www.w3.org/TR/CSS21/syndata.html#tokenization

'value' would allow trailing whitespace, but not preceding whitespace, and  
'property' would allow neither. However, I don't think that's very  
intuitive from an author point of view. Nobody is going to expect the  
following behavior:

window.supportsCSS("color", "green"); //-> true
window.supportsCSS("color", "green "); //-> true
window.supportsCSS("color", " green"); //-> false
window.supportsCSS("color ", "green"); //-> false
window.supportsCSS(" color", "green"); //-> false

Instead, since it doesn't introduce any ambiguity or difficulty of  
implementation, I propose that we allow white spaces before and after both.

window.supportsCSS("color", "green"); //-> true
window.supportsCSS("color", "green "); //-> true
window.supportsCSS("color", " green"); //-> true
window.supportsCSS("color ", "green"); //-> true
window.supportsCSS(" color", "green"); //-> true

  - Florian
Received on Friday, 3 August 2012 11:50:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT