Объясните пожалуйста способ и область применения Drupal.attachBehaviors

Главные вкладки

Аватар пользователя kuzyakiev kuzyakiev 26 ноября 2009 в 14:22

Нашёл я эту функцию, в попытках выполнить кастомный javascript в viewsе которую возращает ajax (сформированый в views).
Собственно сабж: способ и область применения Drupal.attachBehaviors

/**
 * Attach all registered behaviors to a page element.
 *
 * Behaviors are event-triggered actions that attach to page elements, enhancing
 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
 * object as follows:
 * code
 *    Drupal.behaviors.behaviorName = function () {
 *      ...
 *    };
 * endcode
 *
 * Drupal.attachBehaviors is added below to the jQuery ready event and so
 * runs on initial page load. Developers implementing AHAH/AJAX in their
 * solutions should also call this function after new page content has been
 * loaded, feeding in an element to be processed, in order to attach all
 * behaviors to the new content.
 *
 * Behaviors should use a class in the form behaviorName-processed to ensure
 * the behavior is attached only once to a given element. (Doing so enables
 * the reprocessing of given elements, which may be needed on occasion despite
 * the ability to limit behavior attachment to a particular element.)
 *
 * param context
 *   An element to attach behaviors to. If none is given, the document element
 *   is used.
 */

Drupal.attachBehaviors

Комментарии