Monday, July 27, 2009

YAHOO.util.Event.onDOMReady reminder

The callback argument signature wasn't obvious (or is it wrong?) on the YUI documentation page or very readable at the YUI API site.

The callback has the following format:
function init_for_ondomready(label, args, obj) {
}
  • label - string of "onDOMReady"
  • args - empty array (from source doesn't look like its populated today)
  • obj - object passed to onDOMReady event
Example:
YAHOO.util.Event.onDOMReady(init_for_ondomready, thingy);
  • label = 'onDOMReady'
  • args = []
  • obj = thingy
Therefore you need to include a holder for the empty args array or process the arguments array manually.

3 comments: