Posted By

remotezygote on 09/24/09


Tagged

javascript textmate document documentbody


Versions (?)

Bomb-proof document retreiver


 / Published in: JavaScript
 

This will get the document's body in a very agreeable manner - it returns the first div on the page if there is no body (hey it can happen).

Adapted from code by Scott Schiller

  1. getDocument: function() {
  2. return(document.body?document.body:(document.documentElement?document.documentElement:document.getElementsByTagName('div')[0]));
  3. },

Report this snippet  

You need to login to post a comment.