Skip to content

Commit cb8e30a

Browse files
committed
added warning when getSelection cannot find input control
1 parent 54ef43e commit cb8e30a

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

dist/js/selectize.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@
331331
*/
332332
var getSelection = function(input) {
333333
var result = {};
334+
if(input === undefined) {
335+
console.warn('WARN getSelection cannot locate input control');
336+
return result;
337+
}
334338
if ('selectionStart' in input) {
335339
result.start = input.selectionStart;
336340
result.length = input.selectionEnd - result.start;

dist/js/selectize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/standalone/selectize.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ var watchChildEvent = function($parent, event, selector, fn) {
189189
*/
190190
var getSelection = function(input) {
191191
var result = {};
192+
if(input === undefined) {
193+
console.warn('WARN getSelection cannot locate input control');
194+
return result;
195+
}
192196
if ('selectionStart' in input) {
193197
result.start = input.selectionStart;
194198
result.length = input.selectionEnd - result.start;

0 commit comments

Comments
 (0)