diff --git a/cache.manifest b/cache.manifest index d75f1bec..48009393 100644 --- a/cache.manifest +++ b/cache.manifest @@ -1,5 +1,5 @@ CACHE MANIFEST -#Date Tue Sep 03 2013 23:04:10 +#Date Tue Sep 03 2013 23:30:01 CACHE: index.html diff --git a/res-min/main.js b/res-min/main.js index 01985512..9965cbb9 100644 --- a/res-min/main.js +++ b/res-min/main.js @@ -4532,28 +4532,21 @@ define("config", function() {}), define("settings", [ "underscore", "config" ], var t = document.getElementById("wmd-preview-section-" + e.id); b.removeChild(t); }); - var n = document.getElementById("wmd-preview"), i = Array.prototype.slice.call(n.childNodes); - n.innerHTML = ""; - var o = document.createDocumentFragment(); + var n = document.getElementById("wmd-preview"), i = n.firstChild, o = document.createDocumentFragment(); e.each(p, function(n) { for (var r = t("div", { id: "wmd-preview-section-" + n.id, "class": "wmd-preview-section preview-content" - }), a = !0; 0 !== i.length; ) { - var s = i[0]; - if (a === !1 && /(^| )wmd-title($| )/.test(s.className)) break; - if (a = !1, "DIV" == s.tagName && "footnotes" == s.className) e.each(s.querySelectorAll("ol > li"), function(e) { + }), a = !0; i; ) { + var s = i.nextSibling; + if (a === !1 && /(^| )wmd-title($| )/.test(i.className)) break; + a = !1, "DIV" == i.tagName && "footnotes" == i.className ? e.each(i.querySelectorAll("ol > li"), function(e) { var t = e.id.substring(3); y[t] = e; - }); else try { - r.appendChild(s); - } catch (l) { - r.appendChild(document.createTextNode(s.innerText)); - } - i.shift(); + }) : r.appendChild(i), i = s; } o.appendChild(r); - }); + }), n.innerHTML = ""; var r = v; void 0 !== f && (r = document.getElementById("wmd-preview-section-" + f.id)), b.insertBefore(o, r), v.innerHTML = ""; diff --git a/res/extensions/partialRendering.js b/res/extensions/partialRendering.js index 7baf560c..94e14cb8 100644 --- a/res/extensions/partialRendering.js +++ b/res/extensions/partialRendering.js @@ -114,8 +114,7 @@ define([ }); var wmdPreviewElt = document.getElementById("wmd-preview"); - var markdownEltList = Array.prototype.slice.call(wmdPreviewElt.childNodes); - wmdPreviewElt.innerHTML = ''; + var childNode = wmdPreviewElt.firstChild; var newSectionEltList = document.createDocumentFragment(); _.each(modifiedSections, function(section) { var sectionElt = crel('div', { @@ -123,33 +122,28 @@ define([ class: 'wmd-preview-section preview-content' }); var isFirst = true; - while(markdownEltList.length !== 0) { - var elt = markdownEltList[0]; - if(isFirst === false && /(^| )wmd-title($| )/.test(elt.className)) { + while(childNode) { + var nextNode = childNode.nextSibling; + if(isFirst === false && /(^| )wmd-title($| )/.test(childNode.className)) { // Stop when encountered the next wmd-title break; } isFirst = false; - if(elt.tagName == 'DIV' && elt.className == 'footnotes') { - _.each(elt.querySelectorAll("ol > li"), function(footnoteElt) { + if(childNode.tagName == 'DIV' && childNode.className == 'footnotes') { + _.each(childNode.querySelectorAll("ol > li"), function(footnoteElt) { // Store each footnote in our footnote map var id = footnoteElt.id.substring(3); footnoteMap[id] = footnoteElt; }); } else { - try { - sectionElt.appendChild(elt); - } - catch(e) { - // IE fails with text nodes - sectionElt.appendChild(document.createTextNode(elt.innerText)); - } + sectionElt.appendChild(childNode); } - markdownEltList.shift(); + childNode = nextNode; }; newSectionEltList.appendChild(sectionElt); }); + wmdPreviewElt.innerHTML = ''; var insertBeforeElt = footnoteContainerElt; if(insertBeforeSection !== undefined) { insertBeforeElt = document.getElementById("wmd-preview-section-" + insertBeforeSection.id);