change(common/core/web): includes review suggestion

This commit is contained in:
jahorton 2021-02-11 13:20:42 +07:00
parent dabd425003
commit 9d5db8a345

View file

@ -288,8 +288,8 @@ namespace com.keyman.text {
this.text = text ? text : "";
var defaultLength = this.text._kmwLength();
// An index of 0 should still be considered 'defined', while null and undefined... not so much.
this.caretIndex = (caretPos || caretPos === 0) ? caretPos : defaultLength;
// Ensures that `caretPos == 0` is handled correctly.
this.caretIndex = typeof caretPos == "number" ? caretPos : defaultLength;
}
// Clones the state of an existing EditableElement, creating a Mock version of its state.