MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / addOrReuseElement

Function addOrReuseElement

web/static/bower_components/angular/angular.js:26573–26591  ·  view source on GitHub ↗
(parent, current, type, templateElement)

Source from the content-addressed store, hash-verified

26571 }
26572
26573 function addOrReuseElement(parent, current, type, templateElement) {
26574 var element;
26575 // Check whether we can reuse the next element
26576 if (current && lowercase(current.nodeName) === type) {
26577 // The next element is the right type so reuse it
26578 element = current;
26579 } else {
26580 // The next element is not the right type so create a new one
26581 element = templateElement.cloneNode(false);
26582 if (!current) {
26583 // There are no more elements so just append it to the select
26584 parent.appendChild(element);
26585 } else {
26586 // The next element is not a group so insert the new one
26587 parent.insertBefore(element, current);
26588 }
26589 }
26590 return element;
26591 }
26592
26593
26594 function removeExcessElements(current) {

Callers 1

updateOptionsFunction · 0.85

Calls 1

lowercaseFunction · 0.85

Tested by

no test coverage detected