var fixedDiv1 = document.getElementById("fixedDiv1"); varinput = document.getElementById("input");
function test()
{
function getSelectionForEditor(aEditorElement)
{
return SpecialPowers.wrap(aEditorElement).editor.selection;
}
function clear()
{ var sel = window.getSelection();
if (sel.rangeCount > 0)
sel.collapseToEnd();
sel = getSelectionForEditor(input);
if (sel.rangeCount > 0)
sel.collapseToEnd();
}
function check(aFixedDiv1ShouldBeSelected,
aInputShouldBeSelected,
aTestingDescription)
{
function checkCharacter(aSelectedText,
aShouldBeIncludedCharacter,
aSouldBeSelected,
aElementName)
{ var boolvalue = aSouldBeSelected & kTrue; var f = aSouldBeSelected & kToDo ? todo : ok; var str = aSelectedText.replace('\n', '\\n');
if (boolvalue) {
f(aSelectedText.includes(aShouldBeIncludedCharacter), "The contents of " + aElementName + " aren't selected (" + aTestingDescription + "): Selected String: \"" + str + "\"");
} else {
f(!aSelectedText.includes(aShouldBeIncludedCharacter), "The contents of " + aElementName + " are selected (" + aTestingDescription + "): Selected String: \"" + str + "\"");
}
}
var sel = window.getSelection().toString();
checkCharacter(sel, "d", aFixedDiv1ShouldBeSelected, "fixedDiv1");
// input contents must not be included on the parent
// selection.
checkCharacter(sel, "i",
SpecialPowers.getBoolPref("dom.selection.mimic_chrome_tostring.enabled")
? aInputShouldBeSelected
: false
, "input (checking on parent)");
var selInput = getSelectionForEditor(input).toString();
checkCharacter(selInput, "i", aInputShouldBeSelected, "input");
}
function eventHandler(evt) {
evt.preventDefault();
}
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.