summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-30 20:33:32 +0800
committerWu Cheng-Han2016-07-30 20:33:32 +0800
commitd85dd19816df7ec74eb3e4dd31b3c4d63c6119aa (patch)
tree3442269c9ad90b63f53a15a5da6874d6b7a501a7 /public
parenteab984defff23e2bcf5edfd930714243653eafe2 (diff)
Update slide rendering to reduce DOM wrap and avoid duplicate rendering slides
Diffstat (limited to 'public')
-rwxr-xr-xpublic/js/reveal-markdown.js2
-rw-r--r--public/js/slide.js12
2 files changed, 9 insertions, 5 deletions
diff --git a/public/js/reveal-markdown.js b/public/js/reveal-markdown.js
index ca22e09c..a969967c 100755
--- a/public/js/reveal-markdown.js
+++ b/public/js/reveal-markdown.js
@@ -355,7 +355,7 @@
var rendered = md.render(markdown);
rendered = preventXSS(rendered);
var result = postProcess(rendered);
- section.innerHTML = result[0].outerHTML;
+ section.innerHTML = result[0].innerHTML;
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
section.parentNode.getAttribute( 'data-element-attributes' ) ||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
diff --git a/public/js/slide.js b/public/js/slide.js
index 795f47be..4c2f1ff9 100644
--- a/public/js/slide.js
+++ b/public/js/slide.js
@@ -55,10 +55,14 @@ viewAjaxCallback = function () {
};
function renderSlide(event) {
- var title = document.title;
- finishView($(event.currentSlide));
- document.title = title;
- Reveal.layout();
+ var markdown = $(event.currentSlide);
+ if (!markdown.attr('data-rendered')) {
+ var title = document.title;
+ finishView(markdown);
+ markdown.attr('data-rendered', 'true');
+ document.title = title;
+ Reveal.layout();
+ }
}
Reveal.addEventListener('ready', renderSlide);