Slight performance improvements for sauces. Precreate and clone the node instead of creating it each call.

This commit is contained in:
Nicolas Stepien 2012-03-05 00:45:14 +01:00
parent 6f87b3ff14
commit 2cbac888d0
2 changed files with 15 additions and 10 deletions

View File

@ -2798,7 +2798,7 @@
return g.callbacks.push(this.node);
},
funk: function(link) {
var domain, href;
var domain, el, href;
domain = link.match(/(\w+)\.\w+\//)[1];
href = link.replace(/(\$\d)/g, function(parameter) {
switch (parameter) {
@ -2813,12 +2813,15 @@
}
});
href = Function('img', "return '" + href + "'");
el = $.el('a', {
target: '_blank',
textContent: domain
});
return function(img) {
return $.el('a', {
href: href(img),
target: '_blank',
textContent: domain
});
var a;
a = el.cloneNode(true);
a.href = href(img);
return a;
};
},
node: function(post) {

View File

@ -2324,11 +2324,13 @@ sauce =
when '$4'
g.BOARD
href = Function 'img', "return '#{href}'"
el = $.el 'a',
target: '_blank'
textContent: domain
(img) ->
$.el 'a',
href: href img
target: '_blank'
textContent: domain
a = el.cloneNode true
a.href = href img
a
node: (post) ->
{img} = post