diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 7 | ||||
| -rw-r--r-- | src/jqLite.js | 41 | 
2 files changed, 25 insertions, 23 deletions
diff --git a/src/Angular.js b/src/Angular.js index 7bbee592..aefe7ad5 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1040,9 +1040,10 @@ function bindJQuery() {        injector: JQLitePrototype.injector,        inheritedData: JQLitePrototype.inheritedData      }); -    JQLitePatchJQueryRemove('remove', true); -    JQLitePatchJQueryRemove('empty'); -    JQLitePatchJQueryRemove('html'); +    // Method signature: JQLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) +    JQLitePatchJQueryRemove('remove', true, true, false); +    JQLitePatchJQueryRemove('empty', false, false, false); +    JQLitePatchJQueryRemove('html', false, false, true);    } else {      jqLite = JQLite;    } diff --git a/src/jqLite.js b/src/jqLite.js index 6809da74..218b9683 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -107,37 +107,38 @@ function camelCase(name) {  /////////////////////////////////////////////  // jQuery mutation patch  // -//  In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a +// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a  // $destroy event on all DOM nodes being removed.  //  ///////////////////////////////////////////// -function JQLitePatchJQueryRemove(name, dispatchThis) { +function JQLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {    var originalJqFn = jQuery.fn[name];    originalJqFn = originalJqFn.$original || originalJqFn;    removePatch.$original = originalJqFn;    jQuery.fn[name] = removePatch; -  function removePatch() { -    var list = [this], +  function removePatch(param) { +    var list = filterElems && param ? [this.filter(param)] : [this],          fireEvent = dispatchThis,          set, setIndex, setLength, -        element, childIndex, childLength, children, -        fns, events; - -    while(list.length) { -      set = list.shift(); -      for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) { -        element = jqLite(set[setIndex]); -        if (fireEvent) { -          element.triggerHandler('$destroy'); -        } else { -          fireEvent = !fireEvent; -        } -        for(childIndex = 0, childLength = (children = element.children()).length; -            childIndex < childLength; -            childIndex++) { -          list.push(jQuery(children[childIndex])); +        element, childIndex, childLength, children; + +    if (!getterIfNoArguments || param != null) { +      while(list.length) { +        set = list.shift(); +        for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) { +          element = jqLite(set[setIndex]); +          if (fireEvent) { +            element.triggerHandler('$destroy'); +          } else { +            fireEvent = !fireEvent; +          } +          for(childIndex = 0, childLength = (children = element.children()).length; +              childIndex < childLength; +              childIndex++) { +            list.push(jQuery(children[childIndex])); +          }          }        }      }  | 
