diff --git a/dom/ranges/Range-collapse.html b/dom/ranges/Range-collapse.html index b30731ea2292c7..3ca95ac0123595 100644 --- a/dom/ranges/Range-collapse.html +++ b/dom/ranges/Range-collapse.html @@ -12,14 +12,9 @@ var range; if (rangeEndpoints == "detached") { range = document.createRange(); - range.detach(); - assert_throws("INVALID_STATE_ERR", function() { - range.collapse(toStart); - }, "Detached Range must throw INVALID_STATE_ERR on .collapse()"); - assert_throws("INVALID_STATE_ERR", function() { - range.collapsed; - }, "Detached Range must throw INVALID_STATE_ERR on .collapsed access"); - return; + range.detach(); // should be a no-op and therefore the following should not throw + range.collapse(toStart); + assert_equals(true, range.collapsed); } // Have to account for Ranges involving Documents! @@ -37,7 +32,10 @@ && range.startOffset == range.endOffset, "collapsed must be true if and only if the start and end are equal"); - range.collapse(toStart); + if(undefined == toStart) + range.collapse() + else + range.collapse(toStart); assert_equals(range.startContainer, expectedContainer, "Wrong startContainer"); @@ -128,6 +126,11 @@ eval(ranges[i]), false ]); + tests.push([ + "Range " + i + " " + ranges[i] + ", toStart omitted", + eval(ranges[i]), + undefined + ]); } generate_tests(testCollapse, tests);