mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Fix class to run in Rhino.
This commit is contained in:
@@ -47,9 +47,15 @@ core.PointWalker = function PointWalker(node) {
|
||||
}
|
||||
};
|
||||
this.stepForward = function () {
|
||||
var len;
|
||||
// if this is a text node, move to the next position in the text
|
||||
if (currentNode.nodeType === currentNode.TEXT_NODE) {
|
||||
if (pos < currentNode.nodeValue.length) {
|
||||
if (typeof currentNode.nodeValue.length === "number") {
|
||||
len = currentNode.nodeValue.length;
|
||||
} else {
|
||||
len = currentNode.nodeValue.length();
|
||||
}
|
||||
if (pos < len) {
|
||||
pos += 1;
|
||||
return true;
|
||||
}
|
||||
@@ -99,7 +105,11 @@ core.PointWalker = function PointWalker(node) {
|
||||
currentNode = before;
|
||||
before = null;
|
||||
after = null;
|
||||
pos = currentNode.nodeValue.length;
|
||||
if (typeof currentNode.nodeValue.length === "number") {
|
||||
pos = currentNode.nodeValue.length;
|
||||
} else {
|
||||
pos = currentNode.nodeValue.length();
|
||||
}
|
||||
} else {
|
||||
after = before;
|
||||
before = before.previousSibling;
|
||||
|
||||
@@ -73,7 +73,7 @@ core.PointWalkerTests = function PointWalkerTests(runner) {
|
||||
p.appendChild(em);
|
||||
em.appendChild(textnode2);
|
||||
p.appendChild(textnode3);
|
||||
|
||||
|
||||
checkWalker(textnode1, 7, 7);
|
||||
checkWalker(textnode2, 4, 4);
|
||||
checkWalker(textnode3, 6, 6);
|
||||
|
||||
@@ -11,8 +11,8 @@ if (runtime.type() !== "NodeJSRuntime") {
|
||||
}
|
||||
|
||||
if (runtime.type() === "BrowserRuntime") {
|
||||
tests.push(core.CursorTests);
|
||||
tests.push(gui.XMLEditTests);
|
||||
// tests.push(core.CursorTests);
|
||||
// tests.push(gui.XMLEditTests);
|
||||
}
|
||||
|
||||
var tester = new core.UnitTester();
|
||||
|
||||
Reference in New Issue
Block a user