[gitg] Clone template before filling it
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Clone template before filling it
- Date: Tue, 16 Oct 2012 18:27:35 +0000 (UTC)
commit 2a8f44030dff243f580111356e88683c94b209ae
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Tue Oct 16 20:26:50 2012 +0200
Clone template before filling it
libgitg-gtk/resources/base.js | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libgitg-gtk/resources/base.js b/libgitg-gtk/resources/base.js
index 11786a2..51aa6d8 100644
--- a/libgitg-gtk/resources/base.js
+++ b/libgitg-gtk/resources/base.js
@@ -42,7 +42,7 @@ function create_template(name, bindmap)
$.each(bindmap, function (key, callback) {
props.push({
- elements: templ.find(key),
+ selector: key,
callback: callback
});
});
@@ -51,8 +51,10 @@ function create_template(name, bindmap)
template: templ,
props: props,
execute: function (context) {
+ var ret = this.template.clone();
+
$.each(this.props, function (i, val) {
- $.each(val.elements, function (i, e) {
+ ret.find(val.selector).each(function (i, e) {
var ee = $(e);
retval = val.callback.call(context, ee);
@@ -82,7 +84,7 @@ function create_template(name, bindmap)
});
});
- return this.template.clone();
+ return ret;
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]