(element)
| 78 | } |
| 79 | |
| 80 | function stripCommentsFromElement(element) { |
| 81 | if (element instanceof jqLite) { |
| 82 | switch (element.length) { |
| 83 | case 0: |
| 84 | return []; |
| 85 | break; |
| 86 | |
| 87 | case 1: |
| 88 | // there is no point of stripping anything if the element |
| 89 | // is the only element within the jqLite wrapper. |
| 90 | // (it's important that we retain the element instance.) |
| 91 | if (element[0].nodeType === ELEMENT_NODE) { |
| 92 | return element; |
| 93 | } |
| 94 | break; |
| 95 | |
| 96 | default: |
| 97 | return jqLite(extractElementNode(element)); |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | if (element.nodeType === ELEMENT_NODE) { |
| 103 | return jqLite(element); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | function extractElementNode(element) { |
| 108 | if (!element[0]) return element; |
no test coverage detected