[selectors] How to handle unexpected hyphens in the language range of :lang()?

Hi,

I am not sure what is the correct way to handle “invalid" language ranges with :lang().

The draft says that :lang() accepts valid CSS identifiers (http://dev.w3.org/csswg/selectors4/#the-lang-pseudo <http://dev.w3.org/csswg/selectors4/#the-lang-pseudo>). 

RFC4647 is significantly more restrictive.

Given the following values:
    en-
    en--us
It is no clear how to handle the step 3.3.2 of RFC4647.

We could either ignore empty groups:
    en- -> [“en”, “”] -> [“en”]
    en--us -> [“en”, “”, “us”] -> [“en”, “us”]

Or consider them part of the matching, in which case they always fail to match since the normalized element’s language would never contains the empty group.

Is this defined anywhere by any chance?
I assume they should always fail for compatibility with Level 3.

Benjamin

Received on Tuesday, 11 November 2014 05:18:18 UTC