summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/default.html
blob: 3187801f67cc08719fe713ad003e68c533ad1aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:default)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<form>
  <button id=button1 type=button>button1</button>
  <button id=button2 type=submit>button2</button>
</form>
<form>
  <button id=button3 type=reset>button3</button>
  <button id=button4>button4</button>
</form>
<button id=button5 type=submit>button5</button>
<form id=form1>
  <input type=text id=input1>
</form>
<input type=text id=input2 form=form1>
<form>
  <input type=submit id=input3>
  <input type=submit id=input4>
</form>
<form>
  <input type=image id=input5>
  <input type=image id=input6>
</form>
<form>
  <input type=submit id=input7>
</form>
<input type=checkbox id=checkbox1 checked>
<input type=checkbox id=checkbox2>
<input type=checkbox id=checkbox3 default>
<input type=radio name=radios id=radio1 checked>
<input type=radio name=radios id=radio2>
<input type=radio name=radios id=radio3 default>
<select id=select1>
 <optgroup label="options" id=optgroup1>
  <option value="option1" id=option1>option1
  <option value="option2" id=option2 selected>option2
</select>
<dialog id="dialog">
  <input type=submit id=input8>
</dialog>
<form>
  <button id=button6 type='invalid'>button6</button>
  <button id=button7>button7</button>
</form>
<form>
  <button id=button8>button8</button>
  <button id=button9>button9</button>
</form>


<script>
  testSelectorIdsMatch(":default", ["button2", "button4", "input3", "input5", "input7", "checkbox1", "radio1", "option2", "button6", "button8"], "':default' matches <button>s that are their form's default button, <input>s of type submit/image that are their form's default button, checked <input>s and selected <option>s");

  document.getElementById("button1").type = "submit"; // change the form's default button
  testSelectorIdsMatch(":default", ["button1", "button4", "input3", "input5", "input7", "checkbox1", "radio1", "option2", "button6", "button8"], "':default' matches dynamically changed form's default buttons");

</script>