-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemLanguage is not clear about case-insensitive matches #517
Comments
It's also worth mentioning that in CSS language matching is case-insensitive: https://drafts.csswg.org/selectors-3/#lang-pseudo |
Firefox has switched to case insensitive matches recently. Note that it does allowReorder matching per the SVG 2 specification requirements. |
Blink will switch to case-insensitive matching in the near future. |
I agree with @GLRoylance's main argument that, if we are defining the attribute values in terms of BCP 47, we should be defining equality of two values according to that spec, too. So I'd count this as a "correction" rather than a "change". We've got one implementation already matching the correction, and another (per #517 (comment)) with a fix in process. If any of those implementations come with tests suitable for uploading to WPT, that would be very helpful, too! (Currently, there is only one old, manual test for |
Addition: per Eric's informal tests, reported here, MS Edge also already supports case-insensitive matching. |
Language tags are case-insensitive. Closes #517
Document structure chapter
Switch and systemLanguage
https://svgwg.org/svg2-draft/struct.html#SwitchElement
The systemLanguage attribute is a comma-separated list of BCP 47 langtags.
The SVG 2.0 spec states the systemLanguage attribute:
The phrase "exactly equals" has misled many implementers. It would be better to state explicitly that the comparison is a case-insensitive match. For example, the langtag "en-US" is equivalent to "en-us". To most readers, it is not "exactly equals" but is "equivalent". Saying it is a case-insensitive match would just make it clear.
Clarity is an issue. Chrome and Firefox browsers currently use case-sensitive matches for systemLanguage. Consequently, systemLanguage="EN" evaluates to false but systemLanguage="en" evaluates to true on those browsers.
BCP 47 (https://tools.ietf.org/html/bcp47) implies that the case of the langtag does not matter when doing some operations, but doesn't actually make a clear statement that case does not matter for any comparison. You can search through the RFCs and find mention that case does not matter in some situations, but I did not find the broad statement.
Search the BCP 47 document for "insensitive" to find statements such as
and
A better statement for the SVG specification would be (also using "language tag" instead of "language"):
Interestingly, BCP 47 (RFC 4647 section 3) states
SVG is a specification, but it has not clearly indicated the mechanism used in matching langtags. SVG 1.1 uses 3.3.1 Basic Filtering; there's a match if the basic filtered set is not empty. The SMIL allowReorder semantics are more complicated (and even ambiguous).
The text was updated successfully, but these errors were encountered: