Search code examples
javascriptdomfirebugdeveloper-tools

Why IE Developer Tools seems to be more descriptive than FireBug in this example?


When I call this line:

Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 

For FireBug it returns:

>>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 

where for IE, Developer Tools it returns:

>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 
{
    get :  function innerHTML() {     [native code] } ,
    set :  function innerHTML() {     [native code] } ,
    enumerable : true,
    configurable : true
} 

Do you know why it is different? Why IE Dev. Tools seems to be more descriptive than FireBug for this case?


Solution

  • Because the way Firebug runs your input generates an exception, which is then in turn hidden by Firebug. Try running:

    try { Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") } catch (ex) { console.log(ex); }
    

    And you'll see what I mean. As @lonesomeday suggested, try using the web console instead.