@atlassian/aui 10.0.4 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/aui/aui-css-deprecations.js +3 -1
  2. package/dist/aui/aui-css-deprecations.js.map +1 -1
  3. package/dist/aui/aui-prototyping-browserfocus.css +1 -1
  4. package/dist/aui/aui-prototyping-browserfocus.css.map +1 -1
  5. package/dist/aui/aui-prototyping-design-tokens-api-full.js +4 -10
  6. package/dist/aui/aui-prototyping-design-tokens-api-full.js.map +1 -1
  7. package/dist/aui/aui-prototyping-design-tokens-api.js +1 -10
  8. package/dist/aui/aui-prototyping-design-tokens-api.js.map +1 -1
  9. package/dist/aui/aui-prototyping-design-tokens-compatibility.css.map +1 -1
  10. package/dist/aui/aui-prototyping.css +6 -6
  11. package/dist/aui/aui-prototyping.css.map +1 -1
  12. package/dist/aui/aui-prototyping.js +64 -104
  13. package/dist/aui/aui-prototyping.js.map +1 -1
  14. package/dist/aui/aui-prototyping.nodeps.css +6 -6
  15. package/dist/aui/aui-prototyping.nodeps.css.map +1 -1
  16. package/dist/aui/aui-prototyping.nodeps.js +64 -104
  17. package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
  18. package/package.json +8 -7
  19. package/src/js/aui/blanket.js +1 -1
  20. package/src/js/aui/flag.js +1 -1
  21. package/src/js/aui/form-validation.js +1 -1
  22. package/src/js/aui/inline-dialog.js +30 -23
  23. package/src/js/aui/layer.js +1 -1
  24. package/src/js/aui/query-input.js +1 -1
  25. package/src/js/aui/restful-table/entry-model.js +2 -2
  26. package/src/js/aui/restful-table/event-handlers.js +1 -1
  27. package/src/js/aui/restful-table/row.js +1 -1
  28. package/src/js/aui/restful-table.js +2 -2
  29. package/src/js/aui/select2.js +3 -3
  30. package/src/js/aui/tabs.js +2 -2
  31. package/src/js/aui/when-i-type.js +2 -2
  32. package/src/js-vendor-effective/jquery.hotkeys/jquery.hotkeys.js +2 -2
  33. package/src/js-vendor-effective/select2/select2.js +31 -29
  34. package/src/js-vendor-effective/tablesorter/jquery.tablesorter.js +35 -35
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "10.0.4",
4
+ "version": "10.1.1",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "//": "AUI's publishConfig is managed by its build scripts.",
35
35
  "peerDependencies": {
36
- "jquery": "^2 || ^3"
36
+ "jquery": "^2 || ^3 || ^4"
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/tokens": "4.9.1",
@@ -58,17 +58,18 @@
58
58
  "@types/backbone": "1.4.22",
59
59
  "@types/jqueryui": "1.12.23",
60
60
  "fs-extra": "9.1.0",
61
- "ignore-emit-webpack-plugin": "2.0.6",
62
- "jquery": "3.5.1",
63
- "jquery-migrate": "3.5.2",
61
+ "ignore-emit-webpack-plugin": "^2.0.6",
62
+ "jquery": "4.0.0",
63
+ "jquery-3": "npm:jquery@3.7.1",
64
64
  "less": "4.2.0",
65
- "react": "18.3.1"
65
+ "react": "18.3.1",
66
+ "webpack-merge": "6.0.1"
66
67
  },
67
68
  "scripts": {
68
69
  "prepublishOnly": "yarn clean && cross-env NODE_ENV=production yarn build && node scripts/prepublishOnly.js",
69
70
  "postpublish": "node scripts/postpublish.js",
70
71
  "clean": "rm -rf ./dist",
71
- "dist/build:prototyping": "webpack --config webpack/dist.prototyping.webpack.config.js",
72
+ "dist/build:prototyping": "rspack --config webpack/dist.prototyping.webpack.config.js",
72
73
  "build": "yarn dist/build:prototyping",
73
74
  "watch": "yarn dist/build:prototyping --watch"
74
75
  }
@@ -67,7 +67,7 @@ function dim(useShim, zIndex) {
67
67
  overflowEl.style.overflow = 'hidden';
68
68
  }
69
69
 
70
- dim.$dim.removeAttr('hidden');
70
+ dim.$dim.prop('hidden', false);
71
71
 
72
72
  if (zIndex) {
73
73
  dim.$dim.css({ zIndex: zIndex });
@@ -168,7 +168,7 @@ function insertFlag($flag) {
168
168
  $flag.appendTo(flagContainer);
169
169
  recomputeStyle($flag);
170
170
 
171
- $flag.removeAttr('hidden').attr('open', '');
171
+ $flag.attr('aria-hidden', 'false').attr('open', 'open');
172
172
  }
173
173
 
174
174
  amdify('aui/flag', flag);
@@ -183,7 +183,7 @@ function createArgumentAccessorFunction($field) {
183
183
 
184
184
  function changeFieldState($field, state, message) {
185
185
  $field.attr('data-' + ATTRIBUTE_FIELD_STATE, state);
186
- $field.attr('aria-invalid', false);
186
+ $field.removeAttr('aria-invalid');
187
187
 
188
188
  if (state === UNVALIDATED) {
189
189
  return;
@@ -293,7 +293,7 @@ function InlineDialog(items, identifier, url, options) {
293
293
  // lazy load popup contents
294
294
  if (!contentLoading) {
295
295
  contentLoading = true;
296
- if ($.isFunction(url)) {
296
+ if (typeof url === 'function') {
297
297
  // If the passed in URL is a function, execute it. Otherwise simply load the content.
298
298
  url(contents, trigger, doShowPopup);
299
299
  } else {
@@ -441,7 +441,7 @@ function InlineDialog(items, identifier, url, options) {
441
441
  */
442
442
  var bindHideOnExternalClick = function () {
443
443
  if (!hasBoundOnExternalClick) {
444
- $('body').bind('click.' + externalClickNamespace, function (e) {
444
+ $('body').on('click.' + externalClickNamespace, function (e) {
445
445
  var $target = $(e.target);
446
446
  // hide the popup if the target of the event is not in the dialog
447
447
  if (
@@ -539,18 +539,22 @@ function dimensionsOf(el) {
539
539
  }
540
540
 
541
541
  function getDimensions(popup, targetPosition, mousePosition, opts) {
542
- var offsetX = $.isFunction(opts.offsetX)
543
- ? opts.offsetX(popup, targetPosition, mousePosition, opts)
544
- : opts.offsetX;
545
- var offsetY = $.isFunction(opts.offsetY)
546
- ? opts.offsetY(popup, targetPosition, mousePosition, opts)
547
- : opts.offsetY;
548
- var arrowOffsetX = $.isFunction(opts.arrowOffsetX)
549
- ? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
550
- : opts.arrowOffsetX;
551
- var arrowOffsetY = $.isFunction(opts.arrowOffsetY)
552
- ? opts.arrowOffsetY(popup, targetPosition, mousePosition, opts)
553
- : opts.arrowOffsetY;
542
+ var offsetX =
543
+ typeof opts.offsetX === 'function'
544
+ ? opts.offsetX(popup, targetPosition, mousePosition, opts)
545
+ : opts.offsetX;
546
+ var offsetY =
547
+ typeof opts.offsetY === 'function'
548
+ ? opts.offsetY(popup, targetPosition, mousePosition, opts)
549
+ : opts.offsetY;
550
+ var arrowOffsetX =
551
+ typeof opts.arrowOffsetX === 'function'
552
+ ? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
553
+ : opts.arrowOffsetX;
554
+ var arrowOffsetY =
555
+ typeof opts.arrowOffsetY === 'function'
556
+ ? opts.arrowOffsetY(popup, targetPosition, mousePosition, opts)
557
+ : opts.arrowOffsetY;
554
558
 
555
559
  // Support positioning inside a scroll container other than <body>
556
560
  var isConstrainedScroll = opts.container.toLowerCase() !== 'body';
@@ -703,15 +707,18 @@ function calculateWestPositions(popup, targetPosition, mousePosition, opts) {
703
707
  }
704
708
 
705
709
  function calculateNorthSouthPositions(popup, targetPosition, mousePosition, opts) {
706
- var offsetX = $.isFunction(opts.offsetX)
707
- ? opts.offsetX(popup, targetPosition, mousePosition, opts)
708
- : opts.offsetX;
709
- var offsetY = $.isFunction(opts.offsetY)
710
- ? opts.offsetY(popup, targetPosition, mousePosition, opts)
711
- : opts.offsetY;
712
- var arrowOffsetX = $.isFunction(opts.arrowOffsetX)
713
- ? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
714
- : opts.arrowOffsetX;
710
+ var offsetX =
711
+ typeof opts.offsetX === 'function'
712
+ ? opts.offsetX(popup, targetPosition, mousePosition, opts)
713
+ : opts.offsetX;
714
+ var offsetY =
715
+ typeof opts.offsetY === 'function'
716
+ ? opts.offsetY(popup, targetPosition, mousePosition, opts)
717
+ : opts.offsetY;
718
+ var arrowOffsetX =
719
+ typeof opts.arrowOffsetX === 'function'
720
+ ? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
721
+ : opts.arrowOffsetX;
715
722
 
716
723
  var viewportDimensions = dimensionsOf(window);
717
724
  var targetDimensions = dimensionsOf(targetPosition.target);
@@ -589,7 +589,7 @@ LayerManager.prototype = {
589
589
  this._stack
590
590
  .slice()
591
591
  .reverse()
592
- .find((layer) => layer.attr('open')) || null
592
+ .find((layer) => layer.attr('open') !== undefined) || null
593
593
  );
594
594
  },
595
595
 
@@ -6,7 +6,7 @@ var QueryInput = Backbone.View.extend({
6
6
  initialize: function () {
7
7
  bindAll(this, 'changed', 'val');
8
8
  this._lastValue = this.val();
9
- this.$el.bind('keyup focus', this.changed);
9
+ this.$el.on('keyup focus', this.changed);
10
10
  },
11
11
 
12
12
  val: function () {
@@ -139,10 +139,10 @@ var EntryModel = Backbone.Model.extend({
139
139
  $.each(attributes, function (name, value) {
140
140
  if (!current[name]) {
141
141
  if (typeof value === 'string') {
142
- if ($.trim(value) !== '') {
142
+ if (value.trim() !== '') {
143
143
  changed[name] = value;
144
144
  }
145
- } else if ($.isArray(value)) {
145
+ } else if (Array.isArray(value)) {
146
146
  if (value.length !== 0) {
147
147
  changed[name] = value;
148
148
  }
@@ -20,7 +20,7 @@ function triggerEvt(name, args) {
20
20
  * @param {Function} func
21
21
  */
22
22
  function bindEvt(name, func) {
23
- $eventTarget.bind(name, func);
23
+ $eventTarget.on(name, func);
24
24
  }
25
25
 
26
26
  /**
@@ -290,7 +290,7 @@ export default Backbone.View.extend({
290
290
 
291
291
  $cell = $('<td />').append($editableRegion).appendTo(instance.$el);
292
292
 
293
- if (!contents || !$.trim(contents)) {
293
+ if (!contents || !String(contents).trim()) {
294
294
  $cell.addClass(instance.classNames.NO_VALUE);
295
295
  $editableRegion.html(
296
296
  $('<em />').text(this.emptyText || I18n.getText('aui.enter.value'))
@@ -109,7 +109,7 @@ var RestfulTable = Backbone.View.extend({
109
109
  // Let user know the table is loading
110
110
  this.showGlobalLoading();
111
111
  this.options.columns.forEach(function (column) {
112
- var header = $.isFunction(column.header) ? column.header() : column.header;
112
+ var header = typeof column.header === 'function' ? column.header() : column.header;
113
113
  if (typeof header === 'undefined') {
114
114
  logger.warn(
115
115
  'You have not specified [header] for column [' +
@@ -300,7 +300,7 @@ var RestfulTable = Backbone.View.extend({
300
300
 
301
301
  fetchInitialResources: function () {
302
302
  var instance = this;
303
- if ($.isFunction(this.options.resources.all)) {
303
+ if (typeof this.options.resources.all === 'function') {
304
304
  this.options.resources.all(function (entries) {
305
305
  instance.populate(entries);
306
306
  });
@@ -106,7 +106,7 @@ $.fn.auiSelect2 = function (first) {
106
106
  // mask is created during opening event, before open
107
107
  $('#select2-drop-mask').css('z-index', dropdownLayer.$el.css('z-index'));
108
108
 
109
- if (options.multiple || $selectInput.attr('multiple')) {
109
+ if (options.multiple || $selectInput.prop('multiple')) {
110
110
  // This is a multi-select, exiting
111
111
  return;
112
112
  }
@@ -137,7 +137,7 @@ $.fn.auiSelect2 = function (first) {
137
137
  const $selectInput = $(this);
138
138
  const wasAriaDescribedByCleared = $selectInput.data('was-ariadescribedby-cleared');
139
139
 
140
- if (options.multiple || $selectInput.attr('multiple') || wasAriaDescribedByCleared) {
140
+ if (options.multiple || $selectInput.prop('multiple') || wasAriaDescribedByCleared) {
141
141
  return;
142
142
  }
143
143
 
@@ -153,7 +153,7 @@ $.fn.auiSelect2 = function (first) {
153
153
  const $selectInput = $(this);
154
154
  const $container = $selectInput.parent().find('.select2-container');
155
155
 
156
- if (options.multiple || $selectInput.attr('multiple')) {
156
+ if (options.multiple || $selectInput.prop('multiple')) {
157
157
  if (searchLabel) {
158
158
  $container.find('.select2-search-field label').text(searchLabel);
159
159
  }
@@ -207,7 +207,7 @@ function calculateResponsiveTabs(tabsContainer, index) {
207
207
  var $dropdownTriggerTab = $tabsMenu.find('.aui-tabs-responsive-trigger').parent();
208
208
  var $dropdownTrigger = $dropdownTriggerTab.find('a');
209
209
  var dropdownId = $dropdownTrigger.attr('aria-controls');
210
- var $dropdown = $(document.getElementById(dropdownId)).attr('aria-checked', false);
210
+ var $dropdown = $(document.getElementById(dropdownId)).removeAttr('aria-checked');
211
211
  var isResponsive = $dropdown.length > 0;
212
212
  var totalTabsWidth = ResponsiveAdapter.totalTabsWidth($visibleTabs, $dropdown);
213
213
  var needsResponsive = totalTabsWidth > $tabsContainer.outerWidth();
@@ -290,7 +290,7 @@ function switchToTab(tab) {
290
290
  var dropdownId = $dropdownTriggerTab.attr('aria-controls');
291
291
  var $dropdown = $(document.getElementById(dropdownId));
292
292
 
293
- $dropdown.find('li a').attr('aria-checked', false).removeClass('checked aui-dropdown2-checked');
293
+ $dropdown.find('li a').removeAttr('aria-checked').removeClass('checked aui-dropdown2-checked');
294
294
  $dropdown.find('li').removeClass('active-tab');
295
295
 
296
296
  $tab.parent('li.menu-item')
@@ -76,7 +76,7 @@ function whenIType(keys) {
76
76
  // Bind an arbitrary set of keys by calling bindKeyCombo on each triggering key combo.
77
77
  // A string like "abc 123" means (a then b then c) OR (1 then 2 then 3). abc is one key combo, 123 is another.
78
78
  function bindKeys(keys) {
79
- var keyCombos = keys && keys.split ? $.trim(keys).split(' ') : [keys];
79
+ var keyCombos = keys && keys.split ? keys.trim().split(' ') : [keys];
80
80
 
81
81
  keyCombos.forEach(function (keyCombo) {
82
82
  bindKeyCombo(keyCombo);
@@ -562,7 +562,7 @@ whenIType.fromJSON = function (json, switchCtrlToMetaOnMac) {
562
562
  );
563
563
  }
564
564
 
565
- if (!$.isArray(params)) {
565
+ if (!Array.isArray(params)) {
566
566
  logger.error(
567
567
  'Badly formatted shortcut parameter. String or JSON Array of parameters required: ' +
568
568
  param
@@ -66,7 +66,7 @@
66
66
 
67
67
  function keyHandler( handleObj ) {
68
68
  // Only care when a possible input has been specified
69
- if ( !(jQuery.isPlainObject(handleObj.data) || jQuery.isArray(handleObj.data) || typeof handleObj.data === "string") ) {
69
+ if ( !(jQuery.isPlainObject(handleObj.data) || Array.isArray(handleObj.data) || typeof handleObj.data === "string") ) {
70
70
  return;
71
71
  }
72
72
 
@@ -79,7 +79,7 @@
79
79
  (function (data) {
80
80
  if (typeof data === 'string') {
81
81
  options.combo = [ data ];
82
- } else if (jQuery.isArray(data)) {
82
+ } else if (Array.isArray(data)) {
83
83
  options.combo = data;
84
84
  } else {
85
85
  jQuery.extend(options, data);
@@ -320,7 +320,8 @@ the specific language governing permissions and limitations under the Apache Lic
320
320
  function syncCssClasses(dest, src, adapter) {
321
321
  var classes, replacements = [], adapted;
322
322
 
323
- classes = $.trim(dest.attr("class"));
323
+ const destClassesAttr = dest.attr("class");
324
+ classes = (destClassesAttr === undefined || destClassesAttr === null) ? "" : destClassesAttr.trim();
324
325
 
325
326
  if (classes) {
326
327
  classes = '' + classes; // for IE which returns object
@@ -332,7 +333,8 @@ the specific language governing permissions and limitations under the Apache Lic
332
333
  });
333
334
  }
334
335
 
335
- classes = $.trim(src.attr("class"));
336
+ const srcClassesAttr = src.attr("class");
337
+ classes = (srcClassesAttr === undefined || srcClassesAttr === null) ? "" : srcClassesAttr.trim();
336
338
 
337
339
  if (classes) {
338
340
  classes = '' + classes; // for IE which returns object
@@ -428,7 +430,7 @@ the specific language governing permissions and limitations under the Apache Lic
428
430
  if (handler && typeof handler.abort === "function") { handler.abort(); }
429
431
 
430
432
  if (options.params) {
431
- if ($.isFunction(options.params)) {
433
+ if (typeof options.params === 'function') {
432
434
  $.extend(params, options.params.call(self));
433
435
  } else {
434
436
  $.extend(params, options.params);
@@ -481,12 +483,12 @@ the specific language governing permissions and limitations under the Apache Lic
481
483
  tmp,
482
484
  text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
483
485
 
484
- if ($.isArray(data)) {
486
+ if (Array.isArray(data)) {
485
487
  tmp = data;
486
488
  data = { results: tmp };
487
489
  }
488
490
 
489
- if ($.isFunction(data) === false) {
491
+ if (data !== 'function') {
490
492
  tmp = data;
491
493
  data = function() { return tmp; };
492
494
  }
@@ -495,7 +497,7 @@ the specific language governing permissions and limitations under the Apache Lic
495
497
  if (dataItem.text) {
496
498
  text = dataItem.text;
497
499
  // if text is not a function we assume it to be a key name
498
- if (!$.isFunction(text)) {
500
+ if (text !== 'function') {
499
501
  dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
500
502
  text = function (item) { return item[dataText]; };
501
503
  }
@@ -535,11 +537,11 @@ the specific language governing permissions and limitations under the Apache Lic
535
537
 
536
538
  // TODO javadoc
537
539
  function tags(data) {
538
- var isFunc = $.isFunction(data);
540
+ var isFunc = typeof data === 'function';
539
541
  return function (query) {
540
542
  var t = query.term, filtered = {results: []};
541
543
  var result = isFunc ? data(query) : data;
542
- if ($.isArray(result)) {
544
+ if (Array.isArray(result)) {
543
545
  $(result).each(function () {
544
546
  var isObject = this.text !== undefined,
545
547
  text = isObject ? this.text : this;
@@ -561,7 +563,7 @@ the specific language governing permissions and limitations under the Apache Lic
561
563
  * @param formatter
562
564
  */
563
565
  function checkFormatter(formatter, formatterName) {
564
- if ($.isFunction(formatter)) return true;
566
+ if (typeof formatter === 'function') return true;
565
567
  if (!formatter) return false;
566
568
  if (typeof(formatter) === 'string') return true;
567
569
  throw new Error(formatterName +" must be a string, function, or falsy value");
@@ -576,7 +578,7 @@ the specific language governing permissions and limitations under the Apache Lic
576
578
  * @returns {*}
577
579
  */
578
580
  function evaluate(val, context) {
579
- if ($.isFunction(val)) {
581
+ if (typeof val === 'function') {
580
582
  var args = Array.prototype.slice.call(arguments, 2);
581
583
  return val.apply(context, args);
582
584
  }
@@ -816,7 +818,7 @@ the specific language governing permissions and limitations under the Apache Lic
816
818
 
817
819
  this.lastSearchTerm = undefined;
818
820
 
819
- if ($.isFunction(this.opts.initSelection)) {
821
+ if (typeof this.opts.initSelection === 'function') {
820
822
  // initialize selection based on the current value of the source element
821
823
  this.initSelection();
822
824
 
@@ -1026,7 +1028,7 @@ the specific language governing permissions and limitations under the Apache Lic
1026
1028
  var elemTags = opts.element.data('tags');
1027
1029
 
1028
1030
  // data-tags should actually be a boolean
1029
- if (!$.isArray(elemTags)) {
1031
+ if (!Array.isArray(elemTags)) {
1030
1032
  elemTags = [];
1031
1033
  }
1032
1034
 
@@ -1045,7 +1047,7 @@ the specific language governing permissions and limitations under the Apache Lic
1045
1047
 
1046
1048
  // ajax.results -> ajax.processResults
1047
1049
  if (opts.ajax != null) {
1048
- if ($.isFunction(opts.ajax.processResults)) {
1050
+ if (typeof opts.ajax.processResults === 'function') {
1049
1051
  opts.ajax.results = opts.ajax.processResults;
1050
1052
  }
1051
1053
  }
@@ -1055,32 +1057,32 @@ the specific language governing permissions and limitations under the Apache Lic
1055
1057
  var lang = opts.language;
1056
1058
 
1057
1059
  // formatNoMatches -> language.noMatches
1058
- if ($.isFunction(lang.noMatches)) {
1060
+ if (typeof lang.noMatches === 'function') {
1059
1061
  opts.formatNoMatches = lang.noMatches;
1060
1062
  }
1061
1063
 
1062
1064
  // formatSearching -> language.searching
1063
- if ($.isFunction(lang.searching)) {
1065
+ if (typeof lang.searching === 'function') {
1064
1066
  opts.formatSearching = lang.searching;
1065
1067
  }
1066
1068
 
1067
1069
  // formatInputTooShort -> language.inputTooShort
1068
- if ($.isFunction(lang.inputTooShort)) {
1070
+ if (typeof lang.inputTooShort === 'function') {
1069
1071
  opts.formatInputTooShort = lang.inputTooShort;
1070
1072
  }
1071
1073
 
1072
1074
  // formatInputTooLong -> language.inputTooLong
1073
- if ($.isFunction(lang.inputTooLong)) {
1075
+ if (typeof lang.inputTooLong === 'function') {
1074
1076
  opts.formatInputTooLong = lang.inputTooLong;
1075
1077
  }
1076
1078
 
1077
1079
  // formatLoading -> language.loadingMore
1078
- if ($.isFunction(lang.loadingMore)) {
1080
+ if (typeof lang.loadingMore === 'function') {
1079
1081
  opts.formatLoading = lang.loadingMore;
1080
1082
  }
1081
1083
 
1082
1084
  // formatSelectionTooBig -> language.maximumSelected
1083
- if ($.isFunction(lang.maximumSelected)) {
1085
+ if (typeof lang.maximumSelected === 'function') {
1084
1086
  opts.formatSelectionTooBig = lang.maximumSelected;
1085
1087
  }
1086
1088
  }
@@ -1152,7 +1154,7 @@ the specific language governing permissions and limitations under the Apache Lic
1152
1154
  opts.id = function (e) { return e[idKey]; };
1153
1155
  }
1154
1156
 
1155
- if ($.isArray(opts.element.data("select2Tags"))) {
1157
+ if (Array.isArray(opts.element.data("select2Tags"))) {
1156
1158
  if ("tags" in opts) {
1157
1159
  throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
1158
1160
  }
@@ -1209,7 +1211,7 @@ the specific language governing permissions and limitations under the Apache Lic
1209
1211
  } else if ("tags" in opts) {
1210
1212
  opts.query = tags(opts.tags);
1211
1213
  if (opts.createSearchChoice === undefined) {
1212
- opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
1214
+ opts.createSearchChoice = function (term) { return {id: (term === undefined || term === null) ? "" : term.trim(), text: (term === undefined || term === null) ? "" : term.trim()}; };
1213
1215
  }
1214
1216
  if (opts.initSelection === undefined) {
1215
1217
  opts.initSelection = function (element, callback) {
@@ -1217,7 +1219,7 @@ the specific language governing permissions and limitations under the Apache Lic
1217
1219
  $(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
1218
1220
  var obj = { id: this, text: this },
1219
1221
  tags = opts.tags;
1220
- if ($.isFunction(tags)) tags=tags();
1222
+ if (typeof tags === 'function') tags=tags();
1221
1223
  $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
1222
1224
  data.push(obj);
1223
1225
  });
@@ -1904,7 +1906,7 @@ the specific language governing permissions and limitations under the Apache Lic
1904
1906
  var maxSelSize = this.getMaximumSelectionSize();
1905
1907
  if (maxSelSize >=1) {
1906
1908
  data = this.data();
1907
- if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
1909
+ if (Array.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
1908
1910
  render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
1909
1911
  return;
1910
1912
  }
@@ -2070,7 +2072,7 @@ the specific language governing permissions and limitations under the Apache Lic
2070
2072
  //Determine the placeholder option based on the specified placeholderOption setting
2071
2073
  return (this.opts.placeholderOption === "first" && firstOption) ||
2072
2074
  (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
2073
- } else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
2075
+ } else if (firstOption.text() == null ? "" : firstOption.text().trim() === "" && firstOption.val() === "") {
2074
2076
  //No explicit placeholder option specified, use the first if it's blank
2075
2077
  return firstOption;
2076
2078
  }
@@ -2116,7 +2118,7 @@ the specific language governing permissions and limitations under the Apache Lic
2116
2118
  }
2117
2119
 
2118
2120
  return null;
2119
- } else if ($.isFunction(this.opts.width)) {
2121
+ } else if (typeof this.opts.width === 'function') {
2120
2122
  return this.opts.width();
2121
2123
  } else {
2122
2124
  return this.opts.width;
@@ -2530,7 +2532,7 @@ the specific language governing permissions and limitations under the Apache Lic
2530
2532
  }
2531
2533
  return is_match;
2532
2534
  },
2533
- callback: !$.isFunction(callback) ? $.noop : function() {
2535
+ callback: typeof callback !== 'function' ? $.noop : function() {
2534
2536
  callback(match);
2535
2537
  }
2536
2538
  });
@@ -2822,7 +2824,7 @@ the specific language governing permissions and limitations under the Apache Lic
2822
2824
  }
2823
2825
  return is_match;
2824
2826
  },
2825
- callback: !$.isFunction(callback) ? $.noop : function() {
2827
+ callback: callback !== 'function' ? $.noop : function() {
2826
2828
  // reorder matches based on the order they appear in the ids array because right now
2827
2829
  // they are in the order in which they appear in data array
2828
2830
  var ordered = [];
@@ -3625,7 +3627,7 @@ the specific language governing permissions and limitations under the Apache Lic
3625
3627
  return markup.join("");
3626
3628
  },
3627
3629
  transformVal: function(val) {
3628
- return $.trim(val);
3630
+ return (val === undefined || val === null) ? "" : val.trim();
3629
3631
  },
3630
3632
  formatSelection: function (data, container, escapeMarkup) {
3631
3633
  return data ? escapeMarkup(this.text(data)) : undefined;
@@ -3642,7 +3644,7 @@ the specific language governing permissions and limitations under the Apache Lic
3642
3644
  id: function (e) { return e == undefined ? null : e.id; },
3643
3645
  text: function (e) {
3644
3646
  if (e && this.data && this.data.text) {
3645
- if ($.isFunction(this.data.text)) {
3647
+ if (typeof this.data.text === 'function') {
3646
3648
  return this.data.text(e);
3647
3649
  } else {
3648
3650
  return e[this.data.text];