34255 lines · 1.2 MB · JavaScript
RawDownload
 * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData * - [`children()`](http://api.jquery.com/children/) - Does not support selectors * - [`clone()`](http://api.jquery.com/clone/) * - [`contents()`](http://api.jquery.com/contents/) * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. *   As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing. * - [`data()`](http://api.jquery.com/data/) * - [`detach()`](http://api.jquery.com/detach/) * - [`empty()`](http://api.jquery.com/empty/) * - [`eq()`](http://api.jquery.com/eq/) * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name * - [`hasClass()`](http://api.jquery.com/hasClass/) * - [`html()`](http://api.jquery.com/html/) * - [`next()`](http://api.jquery.com/next/) - Does not support selectors * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors * - [`prepend()`](http://api.jquery.com/prepend/) * - [`prop()`](http://api.jquery.com/prop/) * - [`ready()`](http://api.jquery.com/ready/) (_deprecated_, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`) * - [`remove()`](http://api.jquery.com/remove/) * - [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument * - [`removeData()`](http://api.jquery.com/removeData/) * - [`replaceWith()`](http://api.jquery.com/replaceWith/) * - [`text()`](http://api.jquery.com/text/) * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers * - [`unbind()`](http://api.jquery.com/unbind/) (_deprecated_, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter * - [`val()`](http://api.jquery.com/val/) * - [`wrap()`](http://api.jquery.com/wrap/) * * ## jQuery/jqLite Extras * Angular also provides the following additional methods and events to both jQuery and jqLite: * * ### Events * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM *    element before it is removed. * * ### Methods * - `controller(name)` - retrieves the controller of the current element or its parent. By default *   retrieves controller associated with the `ngController` directive. If `name` is provided as *   camelCase directive name, then the controller for this directive will be retrieved (e.g. *   `'ngModel'`). * - `injector()` - retrieves the injector of the current element or its parent. * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current *   element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to *   be enabled. * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the *   current element. This getter should be used only on elements that contain a directive which starts a new isolate *   scope. Calling `scope()` on this element always returns the original non-isolate scope. *   Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled. * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top *   parent element is reached. * * @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See * https://github.com/angular/angular.js/issues/14251 for more information. * * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. * @returns {Object} jQuery object. */ JQLite.expando = 'ng339'; var jqCache = JQLite.cache = {},    jqId = 1; /* * !!! This is an undocumented "private" function !!! */JQLite._data = function(node) {  //jQuery always returns an object on cache miss  return this.cache[node[this.expando]] || {};}; function jqNextId() { return ++jqId; }  var DASH_LOWERCASE_REGEXP = /-([a-z])/g;var MS_HACK_REGEXP = /^-ms-/;var MOUSE_EVENT_MAP = { mouseleave: 'mouseout', mouseenter: 'mouseover' };var jqLiteMinErr = minErr('jqLite'); /** * Converts kebab-case to camelCase. * There is also a special case for the ms prefix starting with a lowercase letter. * @param name Name to normalize */function cssKebabToCamel(name) {    return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-'));} function fnCamelCaseReplace(all, letter) {  return letter.toUpperCase();} /** * Converts kebab-case to camelCase. * @param name Name to normalize */function kebabToCamel(name) {  return name    .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace);} var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;var HTML_REGEXP = /<|&#?\w+;/;var TAG_NAME_REGEXP = /<([\w:-]+)/;var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi; var wrapMap = {  'option': [1, '<select multiple="multiple">', '</select>'],   'thead': [1, '<table>', '</table>'],  'col': [2, '<table><colgroup>', '</colgroup></table>'],  'tr': [2, '<table><tbody>', '</tbody></table>'],  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],  '_default': [0, '', '']}; wrapMap.optgroup = wrapMap.option;wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;wrapMap.th = wrapMap.td;  function jqLiteIsTextNode(html) {  return !HTML_REGEXP.test(html);} function jqLiteAcceptsData(node) {  // The window object can accept data but has no nodeType  // Otherwise we are only interested in elements (1) and documents (9)  var nodeType = node.nodeType;  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;} function jqLiteHasData(node) {  for (var key in jqCache[node.ng339]) {    return true;  }  return false;} function jqLiteBuildFragment(html, context) {  var tmp, tag, wrap,      fragment = context.createDocumentFragment(),      nodes = [], i;   if (jqLiteIsTextNode(html)) {    // Convert non-html into a text node    nodes.push(context.createTextNode(html));  } else {    // Convert html into DOM nodes    tmp = fragment.appendChild(context.createElement('div'));    tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();    wrap = wrapMap[tag] || wrapMap._default;    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];     // Descend through wrappers to the right content    i = wrap[0];    while (i--) {      tmp = tmp.lastChild;    }     nodes = concat(nodes, tmp.childNodes);     tmp = fragment.firstChild;    tmp.textContent = '';  }   // Remove wrapper from fragment  fragment.textContent = '';  fragment.innerHTML = ''; // Clear inner HTML  forEach(nodes, function(node) {    fragment.appendChild(node);  });   return fragment;} function jqLiteParseHTML(html, context) {  context = context || window.document;  var parsed;   if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {    return [context.createElement(parsed[1])];  }   if ((parsed = jqLiteBuildFragment(html, context))) {    return parsed.childNodes;  }   return [];} function jqLiteWrapNode(node, wrapper) {  var parent = node.parentNode;   if (parent) {    parent.replaceChild(wrapper, node);  }   wrapper.appendChild(node);}  // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.var jqLiteContains = window.Node.prototype.contains || /** @this */ function(arg) {  // eslint-disable-next-line no-bitwise  return !!(this.compareDocumentPosition(arg) & 16);}; /////////////////////////////////////////////function JQLite(element) {  if (element instanceof JQLite) {    return element;  }   var argIsString;   if (isString(element)) {    element = trim(element);    argIsString = true;  }  if (!(this instanceof JQLite)) {    if (argIsString && element.charAt(0) !== '<') {      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');    }    return new JQLite(element);  }   if (argIsString) {    jqLiteAddNodes(this, jqLiteParseHTML(element));  } else if (isFunction(element)) {    jqLiteReady(element);  } else {    jqLiteAddNodes(this, element);  }} function jqLiteClone(element) {  return element.cloneNode(true);} function jqLiteDealoc(element, onlyDescendants) {  if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]);   if (element.querySelectorAll) {    jqLite.cleanData(element.querySelectorAll('*'));  }} function jqLiteOff(element, type, fn, unsupported) {  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');   var expandoStore = jqLiteExpandoStore(element);  var events = expandoStore && expandoStore.events;  var handle = expandoStore && expandoStore.handle;   if (!handle) return; //no listeners registered   if (!type) {    for (type in events) {      if (type !== '$destroy') {        element.removeEventListener(type, handle);      }      delete events[type];    }  } else {     var removeHandler = function(type) {      var listenerFns = events[type];      if (isDefined(fn)) {        arrayRemove(listenerFns || [], fn);      }      if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {        element.removeEventListener(type, handle);        delete events[type];      }    };     forEach(type.split(' '), function(type) {      removeHandler(type);      if (MOUSE_EVENT_MAP[type]) {        removeHandler(MOUSE_EVENT_MAP[type]);      }    });  }} function jqLiteRemoveData(element, name) {  var expandoId = element.ng339;  var expandoStore = expandoId && jqCache[expandoId];   if (expandoStore) {    if (name) {      delete expandoStore.data[name];      return;    }     if (expandoStore.handle) {      if (expandoStore.events.$destroy) {        expandoStore.handle({}, '$destroy');      }      jqLiteOff(element);    }    delete jqCache[expandoId];    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it  }}  function jqLiteExpandoStore(element, createIfNecessary) {  var expandoId = element.ng339,      expandoStore = expandoId && jqCache[expandoId];   if (createIfNecessary && !expandoStore) {    element.ng339 = expandoId = jqNextId();    expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};  }   return expandoStore;}  function jqLiteData(element, key, value) {  if (jqLiteAcceptsData(element)) {    var prop;     var isSimpleSetter = isDefined(value);    var isSimpleGetter = !isSimpleSetter && key && !isObject(key);    var massGetter = !key;    var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);    var data = expandoStore && expandoStore.data;     if (isSimpleSetter) { // data('key', value)      data[kebabToCamel(key)] = value;    } else {      if (massGetter) {  // data()        return data;      } else {        if (isSimpleGetter) { // data('key')          // don't force creation of expandoStore if it doesn't exist yet          return data && data[kebabToCamel(key)];        } else { // mass-setter: data({key1: val1, key2: val2})          for (prop in key) {            data[kebabToCamel(prop)] = key[prop];          }        }      }    }  }} function jqLiteHasClass(element, selector) {  if (!element.getAttribute) return false;  return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').      indexOf(' ' + selector + ' ') > -1);} function jqLiteRemoveClass(element, cssClasses) {  if (cssClasses && element.setAttribute) {    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')                            .replace(/[\n\t]/g, ' ');    var newClasses = existingClasses;     forEach(cssClasses.split(' '), function(cssClass) {      cssClass = trim(cssClass);      newClasses = newClasses.replace(' ' + cssClass + ' ', ' ');    });     if (newClasses !== existingClasses) {      element.setAttribute('class', trim(newClasses));    }  }} function jqLiteAddClass(element, cssClasses) {  if (cssClasses && element.setAttribute) {    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')                            .replace(/[\n\t]/g, ' ');    var newClasses = existingClasses;     forEach(cssClasses.split(' '), function(cssClass) {      cssClass = trim(cssClass);      if (newClasses.indexOf(' ' + cssClass + ' ') === -1) {        newClasses += cssClass + ' ';      }    });     if (newClasses !== existingClasses) {      element.setAttribute('class', trim(newClasses));    }  }}  function jqLiteAddNodes(root, elements) {  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.   if (elements) {     // if a Node (the most common case)    if (elements.nodeType) {      root[root.length++] = elements;    } else {      var length = elements.length;       // if an Array or NodeList and not a Window      if (typeof length === 'number' && elements.window !== elements) {        if (length) {          for (var i = 0; i < length; i++) {            root[root.length++] = elements[i];          }        }      } else {        root[root.length++] = elements;      }    }  }}  function jqLiteController(element, name) {  return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');} function jqLiteInheritedData(element, name, value) {  // if element is the document object work with the html element instead  // this makes $(document).scope() possible  if (element.nodeType === NODE_TYPE_DOCUMENT) {    element = element.documentElement;  }  var names = isArray(name) ? name : [name];   while (element) {    for (var i = 0, ii = names.length; i < ii; i++) {      if (isDefined(value = jqLite.data(element, names[i]))) return value;    }     // If dealing with a document fragment node with a host element, and no parent, use the host    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM    // to lookup parent controllers.    element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);  }} function jqLiteEmpty(element) {  jqLiteDealoc(element, true);  while (element.firstChild) {    element.removeChild(element.firstChild);  }} function jqLiteRemove(element, keepData) {  if (!keepData) jqLiteDealoc(element);  var parent = element.parentNode;  if (parent) parent.removeChild(element);}  function jqLiteDocumentLoaded(action, win) {  win = win || window;  if (win.document.readyState === 'complete') {    // Force the action to be run async for consistent behavior    // from the action's point of view    // i.e. it will definitely not be in a $apply    win.setTimeout(action);  } else {    // No need to unbind this handler as load is only ever called once    jqLite(win).on('load', action);  }} function jqLiteReady(fn) {  function trigger() {    window.document.removeEventListener('DOMContentLoaded', trigger);    window.removeEventListener('load', trigger);    fn();  }   // check if document is already loaded  if (window.document.readyState === 'complete') {    window.setTimeout(fn);  } else {    // We can not use jqLite since we are not done loading and jQuery could be loaded later.     // Works for modern browsers and IE9    window.document.addEventListener('DOMContentLoaded', trigger);     // Fallback to window.onload for others    window.addEventListener('load', trigger);  }} //////////////////////////////////////////// Functions which are declared directly.

Lines 3001–3500 of 34255. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t