Browse Source

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.
pull/684/head
Nate Delage 10 years ago
parent
commit
ed585a04db
  1. 6
      js/transitions.js

6
js/transitions.js

@ -39,7 +39,8 @@
var displayBar = function (bar, container) { var displayBar = function (bar, container) {
if (container) { if (container) {
container.innerHTML = bar.innerHTML; container.innerHTML = '';
container.appendChild(bar);
} else { } else {
// per Ratchet's CSS, bar elements must be the first thing in <body> // per Ratchet's CSS, bar elements must be the first thing in <body>
// here we assume `.content` is an immediate child of <body> // here we assume `.content` is an immediate child of <body>
@ -115,7 +116,8 @@
transitionContent(newContentDiv, existingContentDiv, transitionContent(newContentDiv, existingContentDiv,
transition, complete); transition, complete);
} else { } else {
document.body.innerHTML = contents.innerHTML; document.body.innerHTML = '';
document.body.appendChild(contents);
complete && complete(); complete && complete();
} }
}; };

Loading…
Cancel
Save