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)).
This commit is contained in:
Martin Zimmermann 2013-11-01 15:25:44 +01:00
parent cac4694f43
commit 2b7d263735
3 changed files with 5 additions and 5 deletions

View File

@ -18,4 +18,4 @@ define(function() {
return {
autoresize: autoresize
};
});
});

View File

@ -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
};
});
});

View File

@ -38,4 +38,4 @@ require(["ready", "app/api", "app/isso", "app/count", "app/dom", "app/markup"],
}
});
});
});
});