While the Facebook Developer Documentation has gotten somewhat better, there are places where it is out and out – well – wrong.
For example, then using the addEventListener function connect events to an object, the Facebook documentation says that the third parameter for capture is not used. WRONG.
How do I know this? Well, because I had need to attach both a blur and a change event to an inline edit control… and when the 3rd parameter was left missing, the blur event never fired. Adding false to the third parameter allowed both events to fire (see code below).
if (document.getElementById('inlineEdit')) {document.getElementById('inlineEdit').addEventListener('blur', blurInlineEdit, false);}
if (document.getElementById('inlineEdit')) {document.getElementById('inlineEdit').addEventListener('change', changeInlineEdit, false);}
One of the big challenges in writing Javascript (er, FBJS) for Facebook Canvas Pages is seeing what gets broken by Facebook’s munging of Javascript. By and large, things hang together pretty well. Events, however, probably cause me more grief in debugging Facebook applications than any other area of development focus.