10BC0 [cssom] clarification needed on sort order and lowercasing of media features · Issue #533 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[cssom] clarification needed on sort order and lowercasing of media features #533

@metajack

Description

@metajack

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0