From 2b7d2637358ed791ac1e174041731d5e81557ec1 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Fri, 1 Nov 2013 15:25:44 +0100 Subject: [PATCH] only create a reply box when needed Previously this led to unnecessary object creation which impacted the rendering time (on my machine 200 comments -> 1200ms) just to create the postbox per comment (just the object initialization)). --- isso/js/app/fancy.js | 2 +- isso/js/app/isso.js | 6 +++--- isso/js/embed.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/isso/js/app/fancy.js b/isso/js/app/fancy.js index 8a6b9c7..3c4edde 100644 --- a/isso/js/app/fancy.js +++ b/isso/js/app/fancy.js @@ -18,4 +18,4 @@ define(function() { return { autoresize: autoresize }; -}); \ No newline at end of file +}); diff --git a/isso/js/app/isso.js b/isso/js/app/isso.js index 7d8cb75..c61c7ed 100644 --- a/isso/js/app/isso.js +++ b/isso/js/app/isso.js @@ -120,10 +120,10 @@ define(["app/text/html", "app/dom", "app/utils", "app/api", "app/markup", "app/i header = $("#isso-" + comment.id + " > .text-wrapper > .isso-comment-header"), text = $("#isso-" + comment.id + " > .text-wrapper > .text"); - var form = new Postbox(comment.id); + var form = null; $("a.reply", footer).toggle("click", function(toggler) { - footer.insertAfter(form); + form = footer.insertAfter(new Postbox(comment.id)); form.onsuccess = function() { toggler.next(); }; $("textarea", form).focus(); $("a.reply", footer).textContent = msgs["comment-close"]; @@ -269,4 +269,4 @@ define(["app/text/html", "app/dom", "app/utils", "app/api", "app/markup", "app/i insert: insert, Postbox: Postbox }; -}); \ No newline at end of file +}); diff --git a/isso/js/embed.js b/isso/js/embed.js index 4999363..6951bb7 100644 --- a/isso/js/embed.js +++ b/isso/js/embed.js @@ -38,4 +38,4 @@ require(["ready", "app/api", "app/isso", "app/count", "app/dom", "app/markup"], } }); }); -}); \ No newline at end of file +});