Drupal behaviors

后端 未结 6 1951
南方客
南方客 2020-12-12 12:42
  • What are Drupal behaviors at all?
  • What type of service layer it offers to module developers?
  • What type of relation it maps to jQuery.ready
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 13:21

    Duplicated Functionality

    Note that the Drupal.behaviors architecture duplicates functionality already in jQuery.

    Also, as of this writing, there does not appear to be any documentation or case studies for Drupal.behaviors outside of Drupal itself; and the documentation within Drupal (as stated above) could benefit considerably from improvements. As of this writing, it appears that the primary detailed documentation is restricted-access for-fee only.

    This means you may notice performance degredation, anomalies, and unexpected results not consistent with standard jQuery that are endemic to the Drupal.behaviors ecosystem.

    Native jQuery Functionality

    In contrast to Drupal.behaviors, the built-in functionality of the standard jQuery API is extensively documented including in-line demonstrations and examples. Moreover, there are numerous live examples freely available on sites such as jsfiddle.

    The links in the see also section enumerate the jQuery api calls relevant to handling new DOM elements inserted into the document.

    See also

    • http://api.jquery.com/on/
    • http://api.jquery.com/live/
    • http://api.jquery.com/bind/
    • http://api.jquery.com/delegate/

提交回复
热议问题