Elide the explicit any namespace prefix when lacking default namespace.

Once again it seems we don't need to preserve the original prefix name,
and this lets to_css serialize to the shortest form when there is no
default namespace and the *| prefix is used.

Selectors § 6.1.1 says:

    Element type selectors that have no namespace component (no namespace
    separator) represent elements without regard to the element's namespace
    (equivalent to "*|") unless a default namespace has been declared for
    namespaced selectors (e.g. in CSS, in the style sheet). If a default
    namespace has been declared, such selectors will represent only elements
    in the default namespace.

Then if there is no default namespace, *| (which we write as
QNamePrefix::ExplicitAnyNamespace) is equivalent to what we write as
QNamePrefix::ImplicitAnyNamespace; the latter has a shorter
serialization, so we should use that.
This commit is contained in:
Jonathan Chan 2017-07-12 22:56:35 -07:00
parent bd5ff3b4ce
commit 989b707623
3 changed files with 90 additions and 98 deletions

View file

@ -1,26 +1,5 @@
[serialize-namespaced-type-selectors.htm]
type: testharness
[Type selector with any namespace]
expected: FAIL
[Universal selector in any namespace]
expected: FAIL
[Type selector with any namespace followed by class]
expected: FAIL
[Type selector with any namespace followed by id]
expected: FAIL
[Type selector with any namespace followed by pseudo class]
expected: FAIL
[Type selector with any namespace followed by pseudo element]
expected: FAIL
[Type selector with any namespace followed by attribute selector]
expected: FAIL
[Universal selector followed by class]
expected: FAIL
@ -51,27 +30,6 @@
[Universal selector in any namespace followed by attribute selector]
expected: FAIL
[Type selector with namespace equal to default namespace]
expected: FAIL
[Universal selector with namespace equal to default namespace]
expected: FAIL
[Type selector with namespace equal to default namespace followed by class]
expected: FAIL
[Type selector with namespace equal to default namespace followed by id]
expected: FAIL
[Type selector with namespace equal to default namespace followed by pseudo class]
expected: FAIL
[Type selector with namespace equal to default namespace followed by pseudo element]
expected: FAIL
[Type selector with namespace equal to default namespace followed by attribute selector]
expected: FAIL
[Universal selector with namespace equal to default namespace followed by class]
expected: FAIL