MCPcopy Create free account
hub / github.com/prototypejs/prototype / getContentFromAnonymousElement

Function getContentFromAnonymousElement

src/prototype/dom/dom.js:1115–1135  ·  view source on GitHub ↗
(tagName, html, force)

Source from the content-addressed store, hash-verified

1113 // tags. So we wrap the string with enclosing HTML (if necessary), stick it
1114 // in a DIV, then grab the DOM nodes.
1115 function getContentFromAnonymousElement(tagName, html, force) {
1116 var t = INSERTION_TRANSLATIONS.tags[tagName], div = DIV;
1117
1118 var workaround = !!t;
1119 if (!workaround && force) {
1120 workaround = true;
1121 t = ['', '', 0];
1122 }
1123
1124 if (workaround) {
1125 div.innerHTML = ' ' + t[0] + html + t[1];
1126 div.removeChild(div.firstChild);
1127 for (var i = t[2]; i--; )
1128 div = div.firstChild;
1129 } else {
1130 div.innerHTML = html;
1131 }
1132
1133 return $A(div.childNodes);
1134 //return SLICE.call(div.childNodes, 0);
1135 }
1136
1137 /**
1138 * Element.clone(@element, deep) -> Element

Callers 3

updateFunction · 0.85
replace_IEFunction · 0.85
insertContentAtFunction · 0.85

Calls 1

$AFunction · 0.85

Tested by

no test coverage detected