Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 6f6264f

Browse files
committed
Build: Update dependencies
1 parent 9f9092c commit 6f6264f

File tree

5 files changed

+97
-7
lines changed

5 files changed

+97
-7
lines changed

bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"devDependencies": {
2121
"requirejs": "2.1.2",
22+
"requirejs-plugins": "1.0.3",
2223
"qunit": "1.18.0",
2324
"qunit-assert-classes": "1.0.2",
2425
"jquery-1.11.3": "jquery#1.11.3",

build/tasks/options/bowercopy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ return {
3030
},
3131
requirejs: {
3232
files: {
33-
"requirejs/require.js": "requirejs/require.js"
33+
"requirejs/require.js": "requirejs/require.js",
34+
"requirejs/plugins/json.js": "requirejs-plugins/src/json.js"
3435
}
3536
},
3637
"jquery": {

external/jquery-ui/widgets/checkboxradio.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
6969

7070
// We need to get the label text but this may also need to make sure it does not contain the
7171
// input itself.
72-
this.label.contents().not( this.element ).each( function() {
72+
this.label.contents().not( this.element[ 0 ] ).each( function() {
7373

7474
// The label contents could be text, html, or a mix. We concat each element to get a
7575
// string representation of the label, without the input as part of it.
@@ -252,7 +252,15 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
252252
_updateLabel: function() {
253253

254254
// Remove the contents of the label ( minus the icon, icon space, and input )
255-
this.label.contents().not( this.element.add( this.icon ).add( this.iconSpace ) ).remove();
255+
var contents = this.label.contents().not( this.element[ 0 ] );
256+
if ( this.icon ) {
257+
contents = contents.not( this.icon[ 0 ] );
258+
}
259+
if ( this.iconSpace ) {
260+
contents = contents.not( this.iconSpace[ 0 ] );
261+
}
262+
contents.remove();
263+
256264
this.label.append( this.options.label );
257265
},
258266

external/jquery-ui/widgets/controlgroup.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ return $.widget( "ui.controlgroup", {
109109
// first / last elements until all enhancments are done.
110110
if ( that[ "_" + widget + "Options" ] ) {
111111
options = that[ "_" + widget + "Options" ]( "middle" );
112+
} else {
113+
options = { classes: {} };
112114
}
113115

114116
// Find instances of this widget inside controlgroup and init them
@@ -118,14 +120,25 @@ return $.widget( "ui.controlgroup", {
118120
var element = $( this );
119121
var instance = element[ widget ]( "instance" );
120122

123+
// We need to clone the default options for this type of widget to avoid
124+
// polluting the variable options which has a wider scope than a single widget.
125+
var instanceOptions = $.widget.extend( {}, options );
126+
121127
// If the button is the child of a spinner ignore it
128+
// TODO: Find a more generic solution
122129
if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
123130
return;
124131
}
132+
133+
// Create the widget if it doesn't exist
134+
if ( !instance ) {
135+
instance = element[ widget ]()[ widget ]( "instance" );
136+
}
125137
if ( instance ) {
126-
options.classes = that._resolveClassesValues( options.classes, instance );
138+
instanceOptions.classes =
139+
that._resolveClassesValues( instanceOptions.classes, instance );
127140
}
128-
element[ widget ]( options );
141+
element[ widget ]( instanceOptions );
129142

130143
// Store an instance of the controlgroup to be able to reference
131144
// from the outermost element for changing options and refresh
@@ -218,12 +231,13 @@ return $.widget( "ui.controlgroup", {
218231
},
219232

220233
_resolveClassesValues: function( classes, instance ) {
234+
var result = {};
221235
$.each( classes, function( key ) {
222236
var current = instance.options.classes[ key ] || "";
223237
current = current.replace( controlgroupCornerRegex, "" ).trim();
224-
classes[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
238+
result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
225239
} );
226-
return classes;
240+
return result;
227241
},
228242

229243
_setOption: function( key, value ) {

external/requirejs/plugins/json.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/** @license
2+
* RequireJS plugin for loading JSON files
3+
* - depends on Text plugin and it was HEAVILY "inspired" by it as well.
4+
* Author: Miller Medeiros
5+
* Version: 0.4.0 (2014/04/10)
6+
* Released under the MIT license
7+
*/
8+
define(['text'], function(text){
9+
10+
var CACHE_BUST_QUERY_PARAM = 'bust',
11+
CACHE_BUST_FLAG = '!bust',
12+
jsonParse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function')? JSON.parse : function(val){
13+
return eval('('+ val +')'); //quick and dirty
14+
},
15+
buildMap = {};
16+
17+
function cacheBust(url){
18+
url = url.replace(CACHE_BUST_FLAG, '');
19+
url += (url.indexOf('?') < 0)? '?' : '&';
20+
return url + CACHE_BUST_QUERY_PARAM +'='+ Math.round(2147483647 * Math.random());
21+
}
22+
23+
//API
24+
return {
25+
26+
load : function(name, req, onLoad, config) {
27+
if (( config.isBuild && (config.inlineJSON === false || name.indexOf(CACHE_BUST_QUERY_PARAM +'=') !== -1)) || (req.toUrl(name).indexOf('empty:') === 0)) {
28+
//avoid inlining cache busted JSON or if inlineJSON:false
29+
//and don't inline files marked as empty!
30+
onLoad(null);
31+
} else {
32+
text.get(req.toUrl(name), function(data){
33+
if (config.isBuild) {
34+
buildMap[name] = data;
35+
onLoad(data);
36+
} else {
37+
onLoad(jsonParse(data));
38+
}
39+
},
40+
onLoad.error, {
41+
accept: 'application/json'
42+
}
43+
);
44+
}
45+
},
46+
47+
normalize : function (name, normalize) {
48+
// used normalize to avoid caching references to a "cache busted" request
49+
if (name.indexOf(CACHE_BUST_FLAG) !== -1) {
50+
name = cacheBust(name);
51+
}
52+
// resolve any relative paths
53+
return normalize(name);
54+
},
55+
56+
//write method based on RequireJS official text plugin by James Burke
57+
//https://github.com/jrburke/requirejs/blob/master/text.js
58+
write : function(pluginName, moduleName, write){
59+
if(moduleName in buildMap){
60+
var content = buildMap[moduleName];
61+
write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
62+
}
63+
}
64+
65+
};
66+
});

0 commit comments

Comments
 (0)