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

Function addOrReuseElement

lib/test/angular/1.5.0/angular.js:27652–27670  ·  view source on GitHub ↗
(parent, current, type, templateElement)

Source from the content-addressed store, hash-verified

27650 }
27651
27652 function addOrReuseElement(parent, current, type, templateElement) {
27653 var element;
27654 // Check whether we can reuse the next element
27655 if (current && lowercase(current.nodeName) === type) {
27656 // The next element is the right type so reuse it
27657 element = current;
27658 } else {
27659 // The next element is not the right type so create a new one
27660 element = templateElement.cloneNode(false);
27661 if (!current) {
27662 // There are no more elements so just append it to the select
27663 parent.appendChild(element);
27664 } else {
27665 // The next element is not a group so insert the new one
27666 parent.insertBefore(element, current);
27667 }
27668 }
27669 return element;
27670 }
27671
27672
27673 function removeExcessElements(current) {

Callers 1

updateOptionsFunction · 0.70

Calls 1

lowercaseFunction · 0.70

Tested by

no test coverage detected