(parent, current, type, templateElement)
| 26308 | } |
| 26309 | |
| 26310 | function addOrReuseElement(parent, current, type, templateElement) { |
| 26311 | var element; |
| 26312 | // Check whether we can reuse the next element |
| 26313 | if (current && lowercase(current.nodeName) === type) { |
| 26314 | // The next element is the right type so reuse it |
| 26315 | element = current; |
| 26316 | } else { |
| 26317 | // The next element is not the right type so create a new one |
| 26318 | element = templateElement.cloneNode(false); |
| 26319 | if (!current) { |
| 26320 | // There are no more elements so just append it to the select |
| 26321 | parent.appendChild(element); |
| 26322 | } else { |
| 26323 | // The next element is not a group so insert the new one |
| 26324 | parent.insertBefore(element, current); |
| 26325 | } |
| 26326 | } |
| 26327 | return element; |
| 26328 | } |
| 26329 | |
| 26330 | |
| 26331 | function removeExcessElements(current) { |
no test coverage detected