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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/select-set-length-with-mutation-reparent.html

Issue 1509853008: Move select/option/optgroup-related tests in fast/forms to fast/forms/select. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('Tests that setting .length on an HTMLSelectElement works in the pre sence of mutation event listeners that reparent options');
11
12 var sel = document.createElement('select');
13 document.body.appendChild(sel);
14 var otherSel = document.createElement('select');
15 document.body.appendChild(otherSel);
16
17 function onRemove(e) {
18 if (e.target.nextSibling != null) {
19 // remove listener temporarily to avoid lots of nesting
20 sel.removeEventListener('DOMNodeRemoved', onRemove, false);
21 var n = e.target.nextSibling;
22 n.parentNode.removeChild(n);
23 otherSel.appendChild(n);
24 sel.addEventListener('DOMNodeRemoved', onRemove, false);
25 }
26 }
27
28 sel.addEventListener('DOMNodeRemoved', onRemove, false);
29 sel.addEventListener('DOMNodeInserted', function() {}, false);
30
31 sel.length = 200;
32 shouldBe('sel.length', '200');
33 shouldBe('otherSel.length', '0');
34
35 sel.length = 100;
36 shouldBe('sel.length', '100');
37 shouldBe('otherSel.length', '0');
38
39 sel.length = 180;
40 shouldBe('sel.length', '180');
41 shouldBe('otherSel.length', '0');
42 </script>
43 </body>
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698