~alcinnz/haskell-stylist

547b185deaf1a0a5956adfcb8630060915d912ff — Adrian Cochrane 4 years ago 86efaac
ISSUES: Record pseudoclass progress.
2 files changed, 2 insertions(+), 61 deletions(-)

M ISSUES/func-psudoclasses.md
D ISSUES/psuedoclass-lowering.md
M ISSUES/func-psudoclasses.md => ISSUES/func-psudoclasses.md +2 -2
@@ 2,9 2,9 @@
These would mostly need to be added to the interpretor.

* [ ]  :not()
* [ ]  :dir()
* [x]  :dir()
* [ ]  :is()
* [ ]  :lang()
* [x]  :lang()
* [ ]  :nth-child()
* [ ]  :nth-last-child()
* [ ]  :nth-of-type()

D ISSUES/psuedoclass-lowering.md => ISSUES/psuedoclass-lowering.md +0 -59
@@ 1,59 0,0 @@
# Provide API to lower non-functional psuedoclasses
It may be simpler, though less featureful[1], to implement interactive
psuedoclasses as if they were psuedoelements. That way when the style
tree has been interacted, we can retrieve the altered styles rather than
reapply the full stylesheet.

Many other psuedoclasses are equivalent to other selectors, especially if the
caller doesn't implement certain interactions.

As such there should be a StyleSheet decorator that can be configure to perform
these tasks.

## Notes
1. Rewriting psuedoclasses to psuedoelements would not allow a browser to support
selectors like ":hover li" that are popularly used to create offline-interactive
pages without JavaScript.

However it is probably wise to discourage such patterns, as they do not
communicate necessary state to accessibility tools.

## Lowering Rules
`:active` -> interactive
`:any-link`, `:link` -> `:where([href], [src])`
`:blank` -> `:where(input[value=""])`
`:checked` -> `[checked]`
`:default` -> UNSUPPORTED (forms)
`:defined` -> UNSUPPORTED (custom elements)
`:dir(_)` -> `:where([dir=_], [dir=_] *)`
`:disabled` -> `[disabled]`
`:empty` -> would need to be handled by XML Conduit Stylist.
`:enabled` -> `:not([disabled])`
`:first-child` -> `:nth-child(1)`
`:first-of-type` -> `:nth-of-type(1)`
`:fullscreen` -> Handled elsewhere.
`:focus`, `:focus-visible` -> interactive
`:focus-within` -> interactive
`:host` -> UNSUPPORTED (custom elements)
`:host()` -> UNSUPPORTED (custom elements)
`:host-context()` -> UNSUPPORTED (custom elements)
`:hover` -> interactive
`:indeterminate` -> `[indeterminate]`
`:in-range` -> UNSUPPORTED (forms)
`:invalid` -> UNSUPPORTED (forms)
`:lang(_)` -> `:where([lang|=_], [lang|=_] *)`
`:last-child` -> `:nth-last-child(1)`, PROBABLY UNSUPPORTED
`:last-of-type` -> `:nth-last-of-type(1)`, PROBABLY UNSUPPORTED
`:only-child` -> `:nth-child(1):nth-last-child(1)`, PROBABLY UNSUPPORTED
`:only-of-type` -> `:nth-of-type(1):nth-last-of-type(1)`, PROBABLY UNSUPPORTED
`:optional` -> `:not([required])`
`:out-of-range` -> UNSUPPORTED (forms)
`:placeholder-shown` -> `:where(:not([value]), [value=""])`
`:readonly` -> `[readonly]`
`:read-write` -> `:not([readonly])`
`:required` -> `[required]`
`:root`, `:scope` -> `html`, or applied by XML Conduit stylist for more leniency.
`:state()` -> UNSUPPORTED (custom elements), may want an alternative.
`:target` -> `#_`, selected ID sourced from outside data.
`:valid` -> UNSUPPORTED (forms)
`:visited` -> requires special handling, with outside data.