locked
IE9 JavaScript scopes. - window.<javascript.js> is 'undefined' RRS feed

  • Question

  • I'm crafting assertion tests for an HTML page in VS2012 (Secrets of the JavaScript Ninja - Listing 3.1) .  It would be expected that any function instantiated with a declaration of "function functionName() { return true ; }" would be in the window context and the name  accessible by window.functionName.name so that tests can be done to determine that functions are accessible within the apporpriate scopes.

    FireFox and Google handle this functionality fine, however, IE9 report window.functionName.name as 'undefined'.  In what context are names of declared functions in IE9 instantiated if not "window".

    ____

    function isNimble() { return true;}

    assert(type of  window.isNimble ==='function"," isNimble() defined;  //passes the assertion test

    assert(isNimble.name === 'isNimble', 'isNimble has a name'); //fails the assertion (even if I use window.isNimble)

    ___

    Assert failure


    Make it happen.


    • Edited by DanKline Wednesday, January 9, 2013 6:31 PM
    Wednesday, January 9, 2013 6:30 PM