Created
June 3, 2010 17:25
-
-
Save cowboyd/424183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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