module Document # Accepts a block that will be called once the document is ready. This uses # the underlying $(function() { ... }) mechanism. Note, multiple blocks may # be passed to this function and they will be called in order. # # @example # # Document.ready? do # puts "document is now ready" # end # # @return [Document] returns self def self.ready? `$(function() { #{yield}; })` if block_given? self end # Returns an {Element} representing the element of the page. # # @return {Element} head element def self.head `return $(document.getElementsByTagName('head')[0]);` end end