Skip to content

Instantly share code, notes, and snippets.

@cowboyd cowboyd/env.rb
Created Jun 3, 2010

Embed
What would you like to do?
require 'v8'
cxt = V8::Context.new
cxt.load('env.js')
cxt['document'].tap do |document|
puts document
document.createElement('div').tap do |div|
puts div
div.setAttribute("id", "foo")
puts div.getAttribute("id")
document.documentElement.appendChild(div)
puts document.childNodes.length
puts document.childNodes[0]
end
end
[object HTMLDocument]
[object HTMLDivElement]
foo
1
[object HTMLHtmlElement]
Program exited with code #0 after 0.22 seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.