Randomblue
Randomblue

Reputation: 116343

Understanding Chrome's basic call stack structure

The following code reveals some of Chrome's internal call stack workings:

(function revealCallStack() {
    var fn = arguments.callee;
    console.log('**Bottom of stack**:\n\n', fn);
    while (fn = fn.caller) console.log('**Next on stack**:\n\n', fn);
})();

Please see http://jsfiddle.net/fW5Ag/. The piece of code reveals four functions on the stack. The first two are somewhat predictable. What about the last two (pasted below)?

function (event){
    if (custom.condition.call(this, event, type)) return fn.call(this, event);
    return true;
}

and

function (event){
    event = new DOMEvent(event, self.getWindow());
    if (condition.call(self, event) === false) event.stop();
}

What exactly is happening here?

Upvotes: 0

Views: 321

Answers (1)

Digital Plane
Digital Plane

Reputation: 38264

These are the Mootools and jsFiddle functions for onload execution of Javascript, not browser functions.

Try noWrap and no library: http://jsfiddle.net/fW5Ag/1/

Upvotes: 3

Related Questions