Skip to content

Commit 7fa346f

Browse files
committed
rename local function to avoid global collision
1 parent e3a86d4 commit 7fa346f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/selectize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,7 +2093,7 @@ $.extend(Selectize.prototype, {
20932093
var self = this;
20942094

20952095
direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
2096-
selection = getSelection(self.$control_input[0]);
2096+
selection = getInputSelection(self.$control_input[0]);
20972097

20982098
if (self.$activeOption && !self.settings.hideSelected) {
20992099
if (typeof self.settings.deselectBehavior === 'string' && self.settings.deselectBehavior === 'top') {
@@ -2172,7 +2172,7 @@ $.extend(Selectize.prototype, {
21722172
if (self.rtl) direction *= -1;
21732173

21742174
tail = direction > 0 ? 'last' : 'first';
2175-
selection = getSelection(self.$control_input[0]);
2175+
selection = getInputSelection(self.$control_input[0]);
21762176

21772177
if (self.isFocused && !self.isInputHidden) {
21782178
valueLength = self.$control_input.val().length;

src/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ var watchChildEvent = function ($parent, event, selector, fn) {
187187
* @param {object} input
188188
* @returns {object}
189189
*/
190-
var getSelection = function (input) {
190+
var getInputSelection = function (input) {
191191
var result = {};
192192
if (input === undefined) {
193-
console.warn('WARN getSelection cannot locate input control');
193+
console.warn('WARN getInputSelection cannot locate input control');
194194
return result;
195195
}
196196
if ('selectionStart' in input) {
@@ -302,7 +302,7 @@ var autoGrow = function ($input) {
302302
);
303303

304304
if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
305-
selection = getSelection($input[0]);
305+
selection = getInputSelection($input[0]);
306306
if (selection.length) {
307307
value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
308308
} else if (keyCode === KEY_BACKSPACE && selection.start) {

test/support/syn.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ define('syn/key', [
15481548
'syn/typeable',
15491549
'syn/browsers'
15501550
], function (syn) {
1551-
var h = syn.helpers, getSelection = function (el) {
1551+
var h = syn.helpers, getInputSelection = function (el) {
15521552
var real, r, start;
15531553
if (el.selectionStart !== undefined) {
15541554
if (document.activeElement && document.activeElement !== el && el.selectionStart === el.selectionEnd && el.selectionStart === 0) {
@@ -1752,7 +1752,7 @@ define('syn/key', [
17521752
},
17531753
getText: function (el) {
17541754
if (syn.typeable.test(el)) {
1755-
var sel = getSelection(el);
1755+
var sel = getInputSelection(el);
17561756
return el.value.substring(sel.start, sel.end);
17571757
}
17581758
var win = syn.helpers.getWindow(el);
@@ -2120,7 +2120,7 @@ define('syn/key', [
21202120
syn.trigger(element, 'keyup', options.replace('-up', ''));
21212121
return callback(true, element);
21222122
}
2123-
var activeElement = h.getWindow(element).document.activeElement, caret = syn.typeable.test(element) && getSelection(element), key = convert[options] || options, runDefaults = syn.trigger(element, 'keydown', key), getDefault = syn.key.getDefault, prevent = syn.key.browser.prevent, defaultResult, keypressOptions = syn.key.options(key, 'keypress');
2123+
var activeElement = h.getWindow(element).document.activeElement, caret = syn.typeable.test(element) && getInputSelection(element), key = convert[options] || options, runDefaults = syn.trigger(element, 'keydown', key), getDefault = syn.key.getDefault, prevent = syn.key.browser.prevent, defaultResult, keypressOptions = syn.key.options(key, 'keypress');
21242124
if (runDefaults) {
21252125
if (!keypressOptions) {
21262126
defaultResult = getDefault(key).call(element, keypressOptions, h.getWindow(element), key, undefined, caret);

0 commit comments

Comments
 (0)