kazu2012 / embeddedjavascript

Automatically exported from code.google.com/p/embeddedjavascript
Other
0 stars 0 forks source link

Update function with differend templates #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Call (new EJS(options)).update(element) twice with differend templates and 
elements

What is the expected output? What do you see instead?
Expected different functions that updates only template which has been called 
by. Instead of this all functions try to update last template which has call 
update function.

What version of the product are you using? On what operating system?
1.0 Window 7 x86 Chrome  20

Please provide any additional information below.
I think problem with closure. Variable _template replaced by 'this' value of 
last object that call function update;
Fix (lines 102-105):

return (function(_template){
    return function(object){
        EJS.prototype.update.call(_template, element, object);
    };
}(this));

Original issue reported on code.google.com by OzOn1...@gmail.com on 17 Apr 2012 at 12:26