Guest User

Untitled

a guest
Jun 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. // This is why we moved from prototype to jQuery
  2.  
  3. FastInit.addOnLoad(function()
  4. {
  5. $$('#body_content_left_content', '#body_content_right_content').each(function(content){
  6. // it's okay if the first and last descendant are the same
  7. descendants = content.descendants().select(function(d){return d.tagName == "P"})
  8. if ((first_descendant = descendants.first()) != null) { first_descendant.addClassName('first_paragraph'); }
  9. if ((last_descendant = descendants.last()) != null) { last_descendant.addClassName('last_paragraph'); }
  10. });
  11. });
  12.  
  13. //becomes:
  14.  
  15. $(document).ready(function(){
  16. $('#body_content_left_content p:first, #body_content_right_content p:first').addClass('first_paragraph');
  17. });
Add Comment
Please, Sign In to add comment