1
0
mirror of synced 2024-11-24 22:06:07 +03:00
This will prevent leaking variables, and will remove the possibility
of Select2 not working well with other plugins which support
AMD loaders. The `define` and `require` methods are now aliased
under `$.Select2.amd` for use inside additional files, such as
translations.
This commit is contained in:
Kevin Brown 2014-10-31 20:15:17 -04:00
parent 8e70642b87
commit afbf30d09a
8 changed files with 26 additions and 39 deletions

View File

@ -78,7 +78,8 @@ module.exports = function (grunt) {
paths: {
almond: '../../vendor/almond-0.2.9',
jquery: 'jquery.shim'
}
},
wrap: grunt.file.readJSON('src/js/banner.json')
}
},
'dist.full': {
@ -91,7 +92,8 @@ module.exports = function (grunt) {
paths: {
almond: '../../vendor/almond-0.2.9',
jquery: '../../vendor/jquery-2.1.0'
}
},
wrap: grunt.file.readJSON('src/js/banner.json')
}
},
'amd': {
@ -103,7 +105,8 @@ module.exports = function (grunt) {
include: includes,
paths: {
jquery: 'empty:'
}
},
wrap: grunt.file.readJSON('src/js/banner.json')
}
},
'amd.full': {
@ -115,30 +118,12 @@ module.exports = function (grunt) {
include: fullIncludes,
paths: {
jquery: 'empty:'
}
},
wrap: grunt.file.readJSON('src/js/banner.json')
}
}
},
concat: {
'dist': {
src: [
'src/js/start.js',
'dist/js/select2.js',
'src/js/end.js'
],
dest: 'dist/js/select2.js'
},
'dist.full': {
src: [
'src/js/start.js',
'dist/js/select2.full.js',
'src/js/end.js'
],
dest: 'dist/js/select2.full.js'
}
},
watch: {
js: {
files: [
@ -174,7 +159,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['compile', 'test', 'minify']);
grunt.registerTask('compile', ['requirejs', 'sass:dev', 'concat']);
grunt.registerTask('compile', ['requirejs', 'sass:dev']);
grunt.registerTask('minify', ['uglify', 'sass:dist']);
grunt.registerTask('test', ['qunit', 'jshint']);
};

View File

@ -1,4 +1,4 @@
define('select2/utils',[], function () {
(function() {define('select2/utils',[], function () {
var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,3 +1674,4 @@ define('jquery.select2',[
return Select2;
});
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

View File

@ -1,4 +1,4 @@
define('select2/utils',[], function () {
(function() {define('select2/utils',[], function () {
var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,3 +1674,4 @@ define('jquery.select2',[
return Select2;
});
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

View File

@ -1,5 +1,4 @@
/**
(function() {/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
@ -11210,5 +11209,4 @@ define('jquery.select2',[
return Select2;
});
require('jquery.select2');
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

File diff suppressed because one or more lines are too long

6
dist/js/select2.js vendored
View File

@ -1,5 +1,4 @@
/**
(function() {/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
@ -2103,5 +2102,4 @@ define('jquery.select2',[
return Select2;
});
require('jquery.select2');
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

File diff suppressed because one or more lines are too long

4
src/js/banner.json Normal file
View File

@ -0,0 +1,4 @@
{
"start": "(function() {",
"end": "require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define, require: require };}());"
}