[css3-conditional] whitespace processing in supportsCSS

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 UTC