From ba66c4f3cc8fecaa5c3f406c1e9f5507c3f3e1d6 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Wed, 2 Apr 2014 15:14:42 -0400 Subject: [PATCH] refactor(jqLite): IE8-support fixes ddb8081982e26cef2d8a4e87a743df6de35332d2 refactors jqLite, and removes support for IE8. This patch extends this to prevent the CL from breaking IE8, and to remain suitable for the 1.2.x branch. Closes #6963 --- src/jqLite.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/jqLite.js b/src/jqLite.js index d03ea67b4..a471d3742 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -205,17 +205,19 @@ function jqLiteIsTextNode(html) { function jqLiteBuildFragment(html, context) { var elem, tmp, tag, wrap, fragment = context.createDocumentFragment(), - nodes = [], i; + nodes = [], i, j, jj; if (jqLiteIsTextNode(html)) { // Convert non-html into a text node nodes.push(context.createTextNode(html)); } else { + tmp = fragment.appendChild(context.createElement('div')); // Convert html into DOM nodes - tmp = tmp || fragment.appendChild(context.createElement("div")); tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase(); wrap = wrapMap[tag] || wrapMap._default; - tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1>") + wrap[2]; + tmp.innerHTML = '
 
' + + wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1>") + wrap[2]; + tmp.removeChild(tmp.firstChild); // Descend through wrappers to the right content i = wrap[0]; @@ -223,7 +225,7 @@ function jqLiteBuildFragment(html, context) { tmp = tmp.lastChild; } - nodes = concat(nodes, tmp.childNodes); + for (j=0, jj=tmp.childNodes.length; j