Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Speed up extractDOM by avoiding jQuery/Zepto append() call"

This reverts commit 35eda00.
  • Loading branch information...
commit 0f470acaa89658bf43772c64222a426e3e2219f0 1 parent 35eda00
Roman Rudenko authored
Showing with 6 additions and 14 deletions.
  1. +6 −14 api/extractDOM.js
View
20 api/extractDOM.js
@@ -74,25 +74,17 @@ $.extend(html, {
Mobify.timing.addPoint('Recovered Markup');
// Disable attributes that can cause loading of external resources
- var disabledHead = this.disable(captured.headContent);
+ var disabledHead = this.disable(captured.headContent)
, disabledBody = this.disable(captured.bodyContent);
Mobify.timing.addPoint('Disabled Markup');
// Reinflate HTML strings back into declawed DOM nodes.
- var div = document.createElement('div');
- var $head = makeElement(captured.headTag);
- var $body = makeElement(captured.bodyTag);
- var result = {
- 'doctype' : captured.doctype
- , '$head' : $head
- , '$body' : $body
- , '$html' : makeElement(captured.htmlTag).append($head, $body)
- };
-
- for (div.innerHTML = disabledHead; div.firstChild; $head.appendChild(div.firstChild));
- for (div.innerHTML = disabledBody; div.firstChild; $body.appendChild(div.firstChild));
-
+ var result = { doctype: captured.doctype };
+ result.$head = makeElement(captured.headTag).append(disabledHead);
+ result.$body = makeElement(captured.bodyTag).append(disabledBody);
+ result.$html = makeElement(captured.htmlTag).append(result.$head, result.$body);
+
Mobify.timing.addPoint('Built Passive DOM');
return result;
Please sign in to comment.
Something went wrong with that request. Please try again.