Skip to content

Instantly share code, notes, and snippets.

@alloy
Created February 11, 2011 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alloy/822210 to your computer and use it in GitHub Desktop.
Save alloy/822210 to your computer and use it in GitHub Desktop.
Iterating over WebKit NodeList results with MacRuby
class DOMNodeList
include Enumerable
def each
length.times { |i| yield item(i) }
end
end
doc = webView.mainFrameDocument
p doc.getElementsByTagName('meta').find { |e| e.name == 'viewport' } # => #<DOMHTMLMetaElement:0x2005e6d60>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment