diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 9 | ||||
| -rw-r--r-- | src/Compiler.js | 12 | ||||
| -rw-r--r-- | src/jqLite.js | 9 | ||||
| -rw-r--r-- | src/widgets.js | 2 |
4 files changed, 18 insertions, 14 deletions
diff --git a/src/Angular.js b/src/Angular.js index b856aa24..9a1ab4a2 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1032,5 +1032,12 @@ function angularJsConfig(document, config) { function bindJQuery(){ // bind to jQuery if present; jQuery = window.jQuery; - angular.element = jqLite = jQuery || jqLiteWrap; + // reset to jQuery or default to us. + if (window.jQuery) { + jqLite = window.jQuery; + jqLite.fn.scope = JQLite.prototype.scope; + } else { + jqLite = jqLiteWrap; + } + angular.element = jqLite; } diff --git a/src/Compiler.js b/src/Compiler.js index 472ec625..d1505404 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -69,18 +69,6 @@ Template.prototype = { } }; -/* - * Function walks up the element chain looking for the scope associated with the give element. - */ -function retrieveScope(element) { - var scope; - element = jqLite(element); - while (element && element.length && !(scope = element.data($$scope))) { - element = element.parent(); - } - return scope; -} - /////////////////////////////////// //Compiler ////////////////////////////////// diff --git a/src/jqLite.js b/src/jqLite.js index ad7734c9..206c1d70 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -87,6 +87,15 @@ JQLite.prototype = { })(this[0]); }, + scope: function() { + var scope, element = this; + while (element && element.length && !(scope = element.data($$scope))) { + element = element.parent(); + } + return scope; + }, + + ready: function(fn) { var fired = false; diff --git a/src/widgets.js b/src/widgets.js index 461684ac..f8efae60 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -561,7 +561,7 @@ angularWidget('option', function(){ return function(option) { var select = option.parent(); var isMultiple = select[0].type == 'select-multiple'; - var scope = retrieveScope(select); + var scope = select.scope(); var model = modelAccessor(scope, select); //if parent select doesn't have a name, don't bother doing anything any more |
