Previous fix did not work when jQuery was inlined into app.js because RequireJS was under the impression that it had already init-ed jQuery and didn't call the init function. This new strategy just allows jQuery to be jQuery and has app.js include the extensions (components/extend-jquery.js) before the app boots.

This commit is contained in:
Spencer Alger
2013-09-14 17:59:09 -07:00
parent 2a1c67ffdb
commit a0bd73f27c
6 changed files with 24 additions and 31 deletions
+2 -1
View File
@@ -10,7 +10,8 @@ define([
'elasticjs',
'bootstrap',
'angular-sanitize',
'angular-strap'
'angular-strap',
'extend-jquery'
],
function (angular, $, _, appLevelRequire) {
"use strict";
@@ -1,4 +1,4 @@
define(['jquery-src'],
define(['jquery'],
function ($) {
'use strict';
+6 -13
View File
@@ -23,8 +23,10 @@ require.config({
'underscore-src': '../vendor/underscore',
bootstrap: '../vendor/bootstrap/bootstrap',
jquery: 'components/jquery.extended',
'jquery-src': '../vendor/jquery/jquery-1.8.0',
jquery: '../vendor/jquery/jquery-1.8.0',
'extend-jquery': 'components/extend-jquery.js',
'jquery.flot': '../vendor/jquery/jquery.flot',
'jquery.flot.pie': '../vendor/jquery/jquery.flot.pie',
'jquery.flot.selection': '../vendor/jquery/jquery.flot.selection',
@@ -54,17 +56,8 @@ require.config({
exports: 'Modernizr'
},
'jquery-src': {
init: (function (global) {
'use strict';
return function () {
var jQuery = global.jQuery;
// jquery defines itself, but we want to extend it and provide our version as the 'jquery'
// package
require.undef('jquery');
return jQuery;
};
})(this)
jquery: {
exports: 'jQuery'
},
// simple dependency declatation