captainbrosset/cleanjs — Issue #34: FunctionParser reports usage of vars in function body, not inside closures
Author: captainbrosset
Created: 2012-02-06 18:46:20+00:00
State: open

initSomeStuff: function() {
var test = document.getElementById("test");
var self = this;
test.onclick = function() {
alert(self._prop)
}
},

cleanjs will report that variable self is not used ... because the functionparser looks for identifier usage inside the body of a function, and it meets the onclick function declaration, it switches its scope to it, so that self is only reported as being used inside onclick, not inside initSomeStuff