Added .dataset
fallback for jQuery 1.x
As we have established already, jQuery 1.x does not correctly handle
`data-*` attributes where there are multiple dashes. This makes it
so we can still handle nested options when working with jQuery 1.x
by using the `.dataset` option that is supported by all major
browsers as well as IE 11+.
Browser support tables for the `.dataset` attributes can be found at
http://caniuse.com/dataset
A notice was already added to the documentation about this in
caeb0ec9b7
.
The related ticket in the jQuery repository about this issue is
https://github.com/jquery/jquery/issues/2070.
This closes https://github.com/select2/select2/issues/2969.
This commit is contained in:
parent
dc2f6d451a
commit
a9f6d64b72
1
dist/js/i18n/hi.js
vendored
Normal file
1
dist/js/i18n/hi.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
|
4
dist/js/select2.amd.full.js
vendored
4
dist/js/select2.amd.full.js
vendored
@ -4116,7 +4116,9 @@ define('select2/options',[
|
||||
$e.data('ajax--url', $e.data('ajax-url'));
|
||||
}
|
||||
|
||||
var data = $e.data();
|
||||
// Prefer the element's `dataset` attribute if it exists
|
||||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||||
var data = $.extend(true, {}, $e[0].dataset || $e.data());
|
||||
|
||||
data = Utils._convertData(data);
|
||||
|
||||
|
4
dist/js/select2.amd.js
vendored
4
dist/js/select2.amd.js
vendored
@ -4116,7 +4116,9 @@ define('select2/options',[
|
||||
$e.data('ajax--url', $e.data('ajax-url'));
|
||||
}
|
||||
|
||||
var data = $e.data();
|
||||
// Prefer the element's `dataset` attribute if it exists
|
||||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||||
var data = $.extend(true, {}, $e[0].dataset || $e.data());
|
||||
|
||||
data = Utils._convertData(data);
|
||||
|
||||
|
4
dist/js/select2.full.js
vendored
4
dist/js/select2.full.js
vendored
@ -4555,7 +4555,9 @@ define('select2/options',[
|
||||
$e.data('ajax--url', $e.data('ajax-url'));
|
||||
}
|
||||
|
||||
var data = $e.data();
|
||||
// Prefer the element's `dataset` attribute if it exists
|
||||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||||
var data = $.extend(true, {}, $e[0].dataset || $e.data());
|
||||
|
||||
data = Utils._convertData(data);
|
||||
|
||||
|
2
dist/js/select2.full.min.js
vendored
2
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
4
dist/js/select2.js
vendored
4
dist/js/select2.js
vendored
@ -4555,7 +4555,9 @@ define('select2/options',[
|
||||
$e.data('ajax--url', $e.data('ajax-url'));
|
||||
}
|
||||
|
||||
var data = $e.data();
|
||||
// Prefer the element's `dataset` attribute if it exists
|
||||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||||
var data = $.extend(true, {}, $e[0].dataset || $e.data());
|
||||
|
||||
data = Utils._convertData(data);
|
||||
|
||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
4
src/js/select2/options.js
vendored
4
src/js/select2/options.js
vendored
@ -70,7 +70,9 @@ define([
|
||||
$e.data('ajax--url', $e.data('ajax-url'));
|
||||
}
|
||||
|
||||
var data = $e.data();
|
||||
// Prefer the element's `dataset` attribute if it exists
|
||||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||||
var data = $.extend(true, {}, $e[0].dataset || $e.data());
|
||||
|
||||
data = Utils._convertData(data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user