blob: 2c26d874176852561f13b049b300fe4d7136f23a [file] [log] [blame]
<csstest def=":focus with ::selection" module="W3C Selectors" modulename="css3-modsel" number="164" rev="1.0" date="21-november-2001" xmlns="http://www.example.org/css3tests">
<author>Ian Hickson</author>
<userinteraction/>
<cssrules>
textarea { border: solid thick gray; }
textarea:focus { border: solid thick green; }
textarea::selection { background: silver; color: black; }
textarea:focus::selection { background: lime; color: black; }
</cssrules>
<code>
<p xmlns="http://www.w3.org/1999/xhtml"><textarea rows="5" cols="70"
>Select some of this text, then change the focus around. While this
text is focussed, the selection should be green. While the focus is
elsewhere, the selection should be silver. The border should at all
times be a darker colour than the selection's background. Repeat the
test with everything selected.</textarea></p>
<p xmlns="http://www.w3.org/1999/xhtml">CONFORMANCE NOTE: If the UA
removes the selection when the focus leaves the text, which is also
valid behaviour, then the description above is inaccurate. In these
cases, the selection should disappear completely when the focus is
moved, and when the focus is returned, the selection should not be
in the same place as when focus was removed (typically, either the
selection will be non-existent, or everything will be selected --
but what is selected is independent of what was selected when the
focus was removed).</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the selection is
preserved, then the selection should NOT disappear when focus is
removed, it should instead turn silver as described.</p>
</code>
</csstest>