Skip to content

Commit bd20807

Browse files
committed
If the selectionStart attribute is null, then selection APIs do not apply to that element.
1 parent 33d7d1a commit bd20807

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

javascript/atoms/keyboard.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,9 @@ bot.Keyboard.prototype.updateOnHomeOrEnd_ = function(key) {
812812
*/
813813
bot.Keyboard.checkCanUpdateSelection_ = function(element) {
814814
try {
815-
element.selectionStart;
815+
if (typeof element.selectionStart == 'number') {
816+
return;
817+
}
816818
} catch (ex) {
817819
// The native error message is actually pretty informative, just add a
818820
// reference to the relevant Chrome bug to provide more context.
@@ -823,6 +825,7 @@ bot.Keyboard.checkCanUpdateSelection_ = function(element) {
823825
}
824826
throw ex;
825827
}
828+
throw Error('Element does not support selection');
826829
};
827830

828831

0 commit comments

Comments
 (0)