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

Function replace_IE

src/prototype/dom/dom.js:813–846  ·  view source on GitHub ↗
(element, content)

Source from the content-addressed store, hash-verified

811 });
812
813 function replace_IE(element, content) {
814 element = $(element);
815 if (content && content.toElement)
816 content = content.toElement();
817 if (Object.isElement(content)) {
818 element.parentNode.replaceChild(content, element);
819 return element;
820 }
821
822 content = Object.toHTML(content);
823 var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
824
825 if (tagName in INSERTION_TRANSLATIONS.tags) {
826 var nextSibling = Element.next(element);
827 var fragments = getContentFromAnonymousElement(
828 tagName, content.stripScripts());
829
830 parent.removeChild(element);
831
832 var iterator;
833 if (nextSibling)
834 iterator = function(node) { parent.insertBefore(node, nextSibling) };
835 else
836 iterator = function(node) { parent.appendChild(node); }
837
838 fragments.each(iterator);
839 } else {
840 // We don't need to special-case this one.
841 element.outerHTML = content.stripScripts();
842 }
843
844 content.evalScripts.bind(content).defer();
845 return element;
846 }
847
848 if ('outerHTML' in document.documentElement)
849 replace = replace_IE;

Callers

nothing calls this directly

Calls 2

$Function · 0.85

Tested by

no test coverage detected