MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / bindJQuery

Function bindJQuery

lib/test/angular/1.5.0/angular.js:1769–1818  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1767
1768var bindJQueryFired = false;
1769function bindJQuery() {
1770 var originalCleanData;
1771
1772 if (bindJQueryFired) {
1773 return;
1774 }
1775
1776 // bind to jQuery if present;
1777 var jqName = jq();
1778 jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present)
1779 !jqName ? undefined : // use jqLite
1780 window[jqName]; // use jQuery specified by `ngJq`
1781
1782 // Use jQuery if it exists with proper functionality, otherwise default to us.
1783 // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.
1784 // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older
1785 // versions. It will not work for sure with jQuery <1.7, though.
1786 if (jQuery && jQuery.fn.on) {
1787 jqLite = jQuery;
1788 extend(jQuery.fn, {
1789 scope: JQLitePrototype.scope,
1790 isolateScope: JQLitePrototype.isolateScope,
1791 controller: JQLitePrototype.controller,
1792 injector: JQLitePrototype.injector,
1793 inheritedData: JQLitePrototype.inheritedData
1794 });
1795
1796 // All nodes removed from the DOM via various jQuery APIs like .remove()
1797 // are passed through jQuery.cleanData. Monkey-patch this method to fire
1798 // the $destroy event on all removed nodes.
1799 originalCleanData = jQuery.cleanData;
1800 jQuery.cleanData = function(elems) {
1801 var events;
1802 for (var i = 0, elem; (elem = elems[i]) != null; i++) {
1803 events = jQuery._data(elem, "events");
1804 if (events && events.$destroy) {
1805 jQuery(elem).triggerHandler('$destroy');
1806 }
1807 }
1808 originalCleanData(elems);
1809 };
1810 } else {
1811 jqLite = JQLite;
1812 }
1813
1814 angular.element = jqLite;
1815
1816 // Prevent double-proxying.
1817 bindJQueryFired = true;
1818}
1819
1820/**
1821 * throw error if the argument is falsy.

Callers 1

angular.jsFile · 0.70

Calls 3

jqFunction · 0.70
isUndefinedFunction · 0.70
extendFunction · 0.70

Tested by

no test coverage detected