O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the DOM Behind FBJS

Problem

I need to see the actual DOM object that’s behind an FBJS variable, but I can’t figure out any way to get to it.

Solution and Discussion

Install Firebug (see Use Firebug (No, Seriously) for more information), and then add a call to console.dir(obj) on your object. Firebug will give you a long listing of all of the functions that FBJS has added to your object (starting with things such as addClassName(), addEventListener(), appendChild(), etc.), at the very top of which you will find a PRIV_obj entry. If you open that up, you’ll see the actual DOM object hiding behind the ultimate FBJS representation.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required