<!DOCTYPE html> <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-select-element"> <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script> var select, optionA, optionB, optionC; function makeSelect() { select = document.createElement('select'); optionA = select.appendChild(new Option('a')); optionB = select.appendChild(new Option('b')); optionC = select.appendChild(new Option('c')); } test(function() { makeSelect(); select.remove(1); assert_equals(select.options[0], optionA); assert_equals(select.options[1], optionC); }, 'Basics'); test(function() { makeSelect(); select.remove(10); assert_equals(select.options[0], optionA); assert_equals(select.options[1], optionB); assert_equals(select.options[2], optionC); }, 'Index out of range'); test(function() { makeSelect(); select.remove(-1); assert_equals(select.options[0], optionA); assert_equals(select.options[1], optionB); assert_equals(select.options[2], optionC); }, 'Index out of range, negative'); test(function() { makeSelect(); select.remove({}); assert_equals(select.options[0], optionB); assert_equals(select.options[1], optionC); }, 'Objects are coerced to 0'); test(function() { makeSelect(); select.remove(optionC); assert_equals(select.options[0], optionB); assert_equals(select.options[1], optionC); }, 'Nodes are objects too. Coerced to 0'); </script> </html>