From f31fe288d4beaa3e928af9bb5f600445aed0d97b Mon Sep 17 00:00:00 2001 From: Nate Delage Date: Sun, 12 Oct 2014 21:47:37 -0500 Subject: [PATCH] Append content to DOM instead of setting innerHTML Ensure that all bound events and data will remain attached to the element instead of "flattening" it to just HTML string. --- js/transitions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/transitions.js b/js/transitions.js index 5f1d0a9d9..2843c08d6 100644 --- a/js/transitions.js +++ b/js/transitions.js @@ -39,7 +39,8 @@ var displayBar = function (bar, container) { if (container) { - container.innerHTML = bar.innerHTML; + container.innerHTML = ""; + container.appendChild(bar); } else { // per Ratchet's CSS, bar elements must be the first thing in // here we assume `.content` is an immediate child of @@ -115,7 +116,8 @@ transitionContent(newContentDiv, existingContentDiv, transition, complete); } else { - document.body.innerHTML = contents.innerHTML; + document.body.innerHTML = ""; + document.body.appendChild(contents); complete && complete(); } };