0

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?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
pencilCake
  • 51,323
  • 85
  • 226
  • 363

1 Answers1

3

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.

Gijs
  • 5,201
  • 1
  • 27
  • 42
  • But why it throws an exception then? – pencilCake Jun 07 '11 at 08:03
  • The short answer is "because Firebug is highly magical and by extension volatile when it comes to displaying objects, and evaluates your JS in a strange way". If you feed it things which throw exceptions when poked in weird places, it may break. You could actually probably file a bug about this. – Gijs Jun 07 '11 at 08:11
  • thank you for the answer. The right place to report it is where by the way? can you provide the url? – pencilCake Jun 07 '11 at 08:18
  • Thanks! I have submitted the issue. – pencilCake Jun 07 '11 at 08:26