diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 14 | ||||
| -rw-r--r-- | src/AngularPublic.js | 5 | ||||
| -rw-r--r-- | src/angular.suffix | 2 | ||||
| -rw-r--r-- | src/jqLite.js | 3 | ||||
| -rw-r--r-- | src/scenario/angular.suffix | 2 |
5 files changed, 19 insertions, 7 deletions
diff --git a/src/Angular.js b/src/Angular.js index 4187e9ad..b856aa24 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -83,17 +83,16 @@ var _undefined = undefined, PRIORITY_LAST = 99999, PRIORITY = {'FIRST': PRIORITY_FIRST, 'LAST': PRIORITY_LAST, 'WATCH':PRIORITY_WATCH}, Error = window.Error, - jQuery = window['jQuery'] || window['$'], // weirdness to make IE happy - _ = window['_'], /** holds major version number for IE or NaN for real browsers */ msie = parseInt((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1], 10), - jqLite = jQuery || jqLiteWrap, + jqLite, // delay binding since jQuery could be loaded after us. + jQuery, // delay binding slice = Array.prototype.slice, push = Array.prototype.push, error = window[$console] ? bind(window[$console], window[$console]['error'] || noop) : noop, /** @name angular */ - angular = window[$angular] || (window[$angular] = {}), + angular = window[$angular] || (window[$angular] = {}), /** @name angular.markup */ angularTextMarkup = extensionMap(angular, 'markup'), /** @name angular.attrMarkup */ @@ -1006,6 +1005,7 @@ function angularInit(config){ } function angularJsConfig(document, config) { + bindJQuery(); var scripts = document.getElementsByTagName("script"), match; config = extend({ @@ -1028,3 +1028,9 @@ function angularJsConfig(document, config) { } return config; } + +function bindJQuery(){ + // bind to jQuery if present; + jQuery = window.jQuery; + angular.element = jqLite = jQuery || jqLiteWrap; +} diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 4654acb1..b62483f8 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -46,3 +46,8 @@ extend(angular, { 'isArray': isArray }); +//try to bind to jquery now so that one can write angular.element().read() +//but we will rebind on bootstrap again. +bindJQuery(); + + diff --git a/src/angular.suffix b/src/angular.suffix index 3da27dc0..fcd3e577 100644 --- a/src/angular.suffix +++ b/src/angular.suffix @@ -1,5 +1,5 @@ - jqLite(document).ready(function(){ + jqLiteWrap(document).ready(function(){ angularInit(angularJsConfig(document)); }); diff --git a/src/jqLite.js b/src/jqLite.js index b607c095..ad7734c9 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -97,7 +97,8 @@ JQLite.prototype = { } this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9 - jqLite(window).bind('load', trigger); // fallback to window.onload for others + // we can not use jqLite since we are not done loading and jQuery could be loaded later. + new JQLite(window).bind('load', trigger); // fallback to window.onload for others }, bind: function(type, fn){ diff --git a/src/scenario/angular.suffix b/src/scenario/angular.suffix index f3ef9f0d..3ab796d2 100644 --- a/src/scenario/angular.suffix +++ b/src/scenario/angular.suffix @@ -1,6 +1,6 @@ var $scenario = new angular.scenario.Runner(window); - jqLite(document).ready(function() { + jqLiteWrap(document).ready(function() { angularScenarioInit($scenario, angularJsConfig(document)); }); |
