-
Notifications
You must be signed in to change notification settings - Fork 747
Description
In https://drafts.csswg.org/cssom/#serialize-a-media-query-list, it says
Sort the media features in lexicographical order.
The example shows it also deduplicating which is not in the spec. Also, if deduplication is needed, it is probably necessary to define how to deduplicate. For example, use the first and use the last both produce arbitrary results, so I think you'd need to actually do the calculation for each feature for which duplicates exist. For example, min-width
would need to choose the largest I guess.
Also, it does not specify whether a "feature" includes the possible modifiers (width vs. min-width/max-width), although the examples seem to indicate that the modifier is included.
Finally, it does not specify lowercasing before sorting, so the sort order will not necessarily be stable, which I assume is the intended point of sorting before serialization.
Also, this sorting seems like it could be expensive, and probably means implementations will have to cache the serialization or use more sophisticated data structures during parsing.