Skip to content

Commit

Permalink
Append content to DOM instead of setting innerHTML
Browse files Browse the repository at this point in the history
Ensure that all bound events and data will remain attached to the
element instead of "flattening" it to just HTML string.
  • Loading branch information
ndelage committed Oct 13, 2014
1 parent ab358dc commit f31fe28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <body>
// here we assume `.content` is an immediate child of <body>
Expand Down Expand Up @@ -115,7 +116,8 @@
transitionContent(newContentDiv, existingContentDiv,
transition, complete);
} else {
document.body.innerHTML = contents.innerHTML;
document.body.innerHTML = "";
document.body.appendChild(contents);
complete && complete();
}
};
Expand Down

0 comments on commit f31fe28

Please sign in to comment.