<http://suika.fam.cx/www/markup/selectors/ssft/ssft>
<http://suika.fam.cx/www/markup/selectors/ssft/ssft>
<http://suika.fam.cx/gate/cvs/markup/selectors/ssft/ssft.en.html>
© Wakaba.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front‐Cover Texts, and no Back‐Cover
Texts. A copy of the license is
available at <http://www.gnu.org/copyleft/fdl.html>
.
This section describes the status of this document at the time of its publication. Other documents might supersede this document.
This document is a working draft, produced as part
of the manakai
project. It might be updated, replaced, or obsoleted by
other documents at any time. It is inappropriate to
cite this document as other than work in progress
.
Comments on this document are welcome and may be sent to the author.
Translations of thie document might be available. The English version of the document is the only normative version.
This section is non‐normative.
Selectors [SELECTORS] are patterns that match against elements in a tree structure and are used in Web technologies, including CSS [CSS], HTML5 [HTML5], XBL2 [XBL2], and Selectors API [SAPI].
The
CSSOM
specification
[CSSOM]
is trying to define an algorithm to
serialize
a group of selectors for the purpose of selectorText
attribute. However, the algorithm is incomplete
.
Note that current Web browser implementations
of the selectorText
attribute are consistently broken
in not escaping unsafe identifiers.
The key words MUST
,
MUST NOT
,
SHOULD
,
SHOULD NOT
, and
MAY
in this
document are to be interpreted as described in
RFC
2119
[KEYWORDS].
All examples and notes in this specification are non‐normative, as are all sections explicitly marked non‐normative. Everything else in this specification is normative.
For the purpose of this specification, pseudo‐elements are also referred to as simple selectors and are considered as part of the last sequence of simple selector in a selector.
See the reference implementation for now.
No SSFT representation is defined for an invalid group of selectors.
The serialized representation will not contain any comment.
To serialize a group of selectors (gs):
U+002C
COMMA
(,
) followed by a
newline to result.U+0020
SPACE
characters to result.U+0020
SPACE
characters to result.U+0020
SPACE
character to
result.>
)U+003E
GREATER-THAN SIGN
(>
) character to result.+
)U+002B
PLUS SIGN
(+
)
character to result.~
)U+007E
TILDE
(~
)
character to result.U+0020
SPACE
character to
result.To serialize a simple selector (ss):
U+007C
VERTICAL BAR
(|
)
character to result.*
,
or by omitting namespace prefix where no default namespace is
specified)U+002A
ASTERISK
(*
)
character, followed by a U+007C
VERTICAL BAR
(|
)
character, to result.U+002A
ASTERISK
(*
) character to result.U+002E
FULL
STOP
(.
) character, followed
by @@ normalized class name,
result.U+0023
NUMBER
SIGN
(#
) character, followed
by @@ normalized ID,
to result.U+003A
COLON
(:
) character
to result.lang
U+0028
LEFT
PARENTHESIS
((
) character
to result.U+0029
RIGHT PARENTHESIS
()
) character
to result.-manakai-contains
U+0028
LEFT
PARENTHESIS
((
) character
to result.U+0029
RIGHT PARENTHESIS
()
) character
to result.nth-child
,
nth-last-child
, nth-of-type
, or
nth-last-of-type
U+0028
LEFT
PARENTHESIS
((
) character
to result.odd
or even
,
a is 2
. If a and
n
is omitted, a is assumed as
0
. Otherwise, if a is omitted,
it is assumed as 1
(or -1
,
if there is a U+002D
HYPHEN-MINUS
(-
)
character).U+006E
LATIN SMALL LETTER N
(n
) character to result.U+002B
PLUS
SIGN
(+
) or
U+002D
HYPHEN-MINUS
(-
)
character. If the argument is a keyword odd
,
b is 1
. If the argument
is a keyword even
, b is
0
. If b is omitted, it is assumed as
0
. The sign of 0
MUST be U+002B
PLUS SIGN
(+
).U+0029
RIGHT PARENTHESIS
()
) character
to result.not
U+003A
COLON
, U+006E
LATIN SMALL LETTER N
,
U+006F
LATIN
SMALL LETTER O
, U+0074
LATIN SMALL LETTER T
, and
U+0028
LEFT
PARENTHESIS
(:not(
), followed by a
newline, to result.U+0020
SPACE
characters to
result.U+0020
SPACE
characters to
result again.not
pseudo‐class.U+0020
SPACE
characters to
result.U+0029
RIGHT PARENTHESIS
()
) character
to result.U+003A
COLON
characters (::
)
to result.A newline
SHOULD be represented as a
U+000A
LINE FEED
character. However, depending on the context where
the SSFT
representation is in use, a sequence of
U+000D
CARRIAGE RETURN
followed by a U+000A
LINE FEED
or a character
U+000D
CARRIAGE RETURN
MAY be used as a newline instead.
Therefore, when SSFT representations are literally compared, newlines must be normalized.
Since the serializing algorithm is so designed that it always output a valid group of selectors, no special parser for the SSFT representation is necessary. Any conforming parser for groups of selectors MAY be used to parse SSFT representations of groups of selectors.
<http://www.w3.org/TR/CSS21>
.<http://dev.w3.org/csswg/cssom/Overview.html>
.<http://dev.w3.org/2006/webapi/selectors-api/Overview.html>
.
The latest published version of the specification is available at
<http://www.w3.org/TR/selectors-api/>
.<http://www.w3.org/TR/xbl/>
.