Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: LayoutTests/fast/forms/form-associated-element.html

Issue 106423005: Only 'form associated' elements have a potential form owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use 'error' instead of 'click' events when testing form ownership Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/forms/form-associated-element-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script type="text/javascript">
6 var formOwner;
7 function hasFormOwner(shouldHaveOwner, haveIt, event)
8 {
9 formOwner = haveIt || "not defined";
10 debug("Testing " + event.target.tagName);
11 if (shouldHaveOwner)
12 shouldBeEqualToString("formOwner", "defined");
13 else
14 shouldBeEqualToString("formOwner", "not defined");
15 }
16 </script>
17 </head>
18 <body>
19 <div style="display: none;">
20 <form id=topForm>
21 <label form=topForm onerror="" onclick="hasFormOwner(true, typeof canary !== 'un defined' && canary, event);"><input type="button"/></label>
22 <!-- Form-associated elements per http://whatwg.org/specs/web-apps/current-work/ #form-associated-element -->
23 <button onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, eve nt);"></button>
24 <fieldset onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, e vent);"></fieldset>
25 <input type=radio onerror="hasFormOwner(true, typeof canary !== 'undefined' && c anary, event);"/>
26 <input type=number onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, event);"/>
27 <keygen keytype=rsa onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, event);"></keygen>
28 <label onerror="" onclick="hasFormOwner(true, typeof canary !== 'undefined' && c anary, event);"><input type="button"/></label>
29 <object onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, eve nt);"></object>
30 <select onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, eve nt);"></select>
31 <textarea onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, e vent);"></textarea>
32 <img onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, event) ;"></img>
33
34 <!-- Elements that aren't associated. -->
35 <option onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, ev ent);"></option>
36 <div onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event );"></div>
37 <a onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event); "></a>
38 <p onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event); "></p>
39 </form>
40
41 <!-- Elements that associated by 'form' reference rather than ancestor. -->
42 <input form=topForm type="number" onerror="hasFormOwner(true, typeof canary !== 'undefined' && canary, event);"/>
43 <keygen form=topForm keytype=rsa onerror="hasFormOwner(true, typeof canary !== ' undefined' && canary, event);"></keygen>
44 <object form=topForm onerror="hasFormOwner(true, typeof canary !== 'undefined' & & canary, event);"></object>
45 <select form=topForm onerror="hasFormOwner(true, typeof canary !== 'undefined' & & canary, event);"></select>
46 <pre form=topForm onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event);"></pre>
47 <span form=topForm onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event);"></span>
48 <img form=topForm onerror="hasFormOwner(false, typeof canary !== 'undefined' && canary, event);"></img>
49 </div>
50 <script>
51 description("Verify that only elements that are 'form associatable' get a form o wner.");
52
53 var elements;
54 function testFormAssociation()
55 {
56 document.forms[0].canary = "defined";
57 elements = document.querySelectorAll("*[onerror]");
58 shouldBeTrue("elements.length > 0");
59 for (var i = 0; i < elements.length; ++i) {
60 // <label/> won't handle 'error', use 'click'.
61 var eventType = (elements[i] instanceof HTMLLabelElement) ? "click" : "e rror";
62 elements[i].dispatchEvent(new Event(eventType));
63 }
64 }
65 testFormAssociation();
66 if (window.testRunner)
67 testRunner.dumpAsText();
68 </script>
69 </body>
70 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/form-associated-element-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698