Drupal DOMinate

458 views

Published on

Drupal DOMinate was presented by Matt Wrather and Steven Rifkin at the Los Angeles Drupal User Group meetup 5/14/13. The presentation covers the use of the Drupal Javascript API focusing on the behaviors and settings objects.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
458
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Drupal DOMinate

  1. 1. Drupal DOMinateStories of masochism on the front endSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather
  2. 2. AgendaSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherWorst PracticesBest PracticesDrupal.behaviors{}Drupal.settings{}Questions
  3. 3. Don’t hack coreIf I update jQuery versions it works it doesn’t work!Steve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherStories from the front-end lines
  4. 4. Better/Best PracticesSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherjQuery Update modulehttp://drupal.org/project/jquery_updateUsing closurehttp://drupal.org/project/jqmulti
  5. 5. Drupal DOM objectWhip out your web inspector, firebug, dev tool flavor and take a peekSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherDrupal {}Drupal.settings{}Drupal.theme()Drupal.locale{}Drupal.behaviors{}
  6. 6. Drupal.jsLet’s have a readSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrathervar Drupal = Drupal || { settings: {}, behaviors: {}, locale: {} };
  7. 7. Drupal.behaviorsMan I wish I knew that beforeSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather
  8. 8. Drupal.behaviorsMan I wish I knew that beforeSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherSo how should I load my script on the page?
  9. 9. Drupal.behaviorsMan I wish I knew that beforeSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather
  10. 10. Drupal.behaviorsMan I wish I knew that beforeSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherDrupal.attachBehaviors();
  11. 11. Drupal.behaviorsMan I wish I knew that beforeSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather$(“#element”).doSomething();$(“#element:not(.processed)”).addClass(‘processed’).doSomething();vs
  12. 12. Drupal.settingsAnother way of using drupal_add_jsSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather
  13. 13. Drupal.settingsAnother way of using drupal_add_jsSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwrather
  14. 14. SourcesSteve Rifkin & Matt Wrather LA Drupal 5-14-2013 @steverifkin @mwratherhttp://api.drupal.org/api/drupal/developer!topics!javascript_startup_guide.html/6http://drupal.org/node/304258http://drupal.org/project/jqmultihttps://drupal.org/node/121997

×