Firebug 0.4.1 and 0.4.0 suffer from a very peculiar bug. If you create an object with a property called ‘-URL’, you can not use console.log to see the value of the property using the console.

Steps to reproduce:

In the console, type

x = {'-URL' : 'foo.pdf', '-Size' : 100};

Now type

x

Now press enter and click on the [Object object] item which shows up in the console. You will see the ‘-Size’ property, but not the ‘-URL’ property. Next, enter the following into the console and press Enter:

x['-URL']

You should now see “foo.pdf” get output to the console. So the value is in Javascript memory, but Firebug won’t show it to you. On a related note, you also cannot view methods of a custom object which are defined using the same means as described above … most of the time. Sometimes it works, so I can’t say for sure what the steps are to reproduce this behavior every time. Why am I blogging about this? Hopefully it will save some other Javascript developer a few hours. Credit goes to my friend, Matthew Metnetsky, for showing me the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *