gustafl / lexeme

A new take on language learning.
1 stars 0 forks source link

"Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range'" #96

Open gustafl opened 8 years ago

gustafl commented 8 years ago

The full error message is:

Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range': The offset 63 is larger than or equal to the node's length (54).

It happens here:

if (window.lastSelection.node !== null) {
    // Restore selection
    let node = window.lastSelection.node;
    let start = window.lastSelection.start;
    let end = window.lastSelection.end;
    var range = document.createRange();
    range.setStart(node, start);
    range.setEnd(node, start + (end - start));  // ERROR!
    var selection = window.getSelection();
    selection.addRange(range);
}

Like the other error messages I currently get, there is no actual consequence. But I should look into it.