reinitPartialTextSelection();
ex = null;
try { var r3 = document.createRange();
r3.setStart(pts.firstChild, 6);
r3.setEnd(pts.firstChild.nextSibling, 0);
is(r3.toString(), "Hello ", "Wrong range!");
r3.surroundContents(document.createElement("div"));
is(r3.toString(), "Hello ", "Wrong range!");
} catch(e) {
ex = e;
is(e.name, "InvalidStateError", "Didn't get InvalidStateError exception!");
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
}
ok(ex, "There should have been an exception!");
reinitPartialTextSelection();
ex = null;
try { var r3 = document.createRange();
r3.setStart(pts.firstChild.nextSibling, 0);
r3.setEnd(pts.lastChild, 6);
is(r3.toString(), "World!", "Wrong range!");
r3.surroundContents(document.createElement("div"));
is(r3.toString(), "World!", "Wrong range!");
} catch(e) {
ex = e;
is(e.name, "InvalidStateError", "Didn't get InvalidStateError exception!");
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
}
ok(ex, "There should have been an exception!");
ex = null;
try { var pes = document.getElementById("partial-element-selection"); var r4 = document.createRange();
r4.setStart(pes.firstChild.firstChild, 6);
r4.setEnd(pes.lastChild.firstChild, 6);
is(r4.toString(), "Hello World!", "Wrong range!");
r4.surroundContents(document.createElement("div"));
is(r4.toString(), "Hello World!", "Wrong range!");
} catch(e) {
ex = e;
is(e.name, "InvalidStateError", "Didn't get InvalidStateError exception!");
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
}
ok(ex, "There should have been an exception!");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.