Update 'drafts/css-conditions.md'

This commit is contained in:
alcinnz 2018-12-01 00:33:13 -05:00
parent 9c4898c3b5
commit a064bbcb04
1 changed files with 11 additions and 3 deletions

View File

@ -20,6 +20,9 @@ Additionally the keywords "mouse-x" and "mouse-y" may be used to refer to the po
The condition SHOULD pass if it passes for any of the values of the variables.
#### Impact on layout
The user agent MUST not reposition or resize any elements in response to applying style rules from an `@@while` rule which specifies a layout condition. Logic variables are not valid in a condition.
### Logic Variables
The attribute selector is extended in relation to `@@while` rules so that attribute can be tested for equality against a sequence of `$`-prefixed identifiers and strings. These sequences MUST start with a string, which MAY be empty.
@ -34,11 +37,16 @@ The `:last-match` psuedoclass matches an element if it is the last element in pa
Additional at-rules are specified in this document in order to ease the development of simpler user interfaces. Logic variables in attribute selectors, `:last-match`, and `:first-match` are valid for these too.
### `@@toggled`
`@@toggled` is written in the form `"@@toggled" ("on"|"off") "(" SELECTOR ")" (":" RULE | "{" RULE* "}")`. The keywords "on" or "off" specifies if the `RULE`s SHOULD apply by default. Then once any elements are matched by `SELECTOR` the `RULE`s should alternate being enabled or disabled.
`@@toggled` is written in the form `"@@toggled" ("on"|"off") "(" SELECTOR ")" (":" RULE | "{" RULE* "}")`. The keywords "on" or "off" specifies if the `RULE`s SHOULD apply by default. Then once any elements matched by `SELECTOR` are "activated" by the user (as determined by the user agent) the `RULE`s should alternate being enabled or disabled.
### `@@on`
`@@on` is written in the form `"@@on" "(" SELECTOR ")" (":" RULE | "{" RULE* "}")`. Once an element matches SELECTOR the `RULE`s are applied, and are not disabled once the SELECTOR stops matching.
## Security Concerns
* If url() functions are resolved lazily, it's possible for servers to track the user's interactions. These URLs SHOULD be resolved eagerly while the CSS is being parsed.
* If position tests were allowed to trigger a relayout, that would trigger a significant loss of performance user agents SHOULD prevent.
* Worse it's possible that if logic variables were captured from position conditions as well, that webpages could execute arbitrary computations which may or may not be malicious.
* Any other Turing Completeness concerns? It doesn't take much to fall into that trap.
## TODO
* Cleanup specification to make it more normative.
* Document security concerns
* Cleanup specification to make it more normative.