Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use this to access the DOM #5

Closed
adelevie opened this issue Apr 8, 2013 · 2 comments
Closed

Can I use this to access the DOM #5

adelevie opened this issue Apr 8, 2013 · 2 comments

Comments

@adelevie
Copy link

adelevie commented Apr 8, 2013

I'm using the sandbox you hosted here: http://qiezi.me/projects/mruby-web-irb/mruby.html#

Calling Document does not work. Is something like this even possible?

@xxuejie
Copy link
Owner

xxuejie commented Apr 9, 2013

Okay, I made a few changes, now the demo above should be able to access DOM(you may need to refresh the browser cache). For example, you can use following line to print the page title:

puts MrubyJs::get_root_object.document.title

Here MrubyJs::get_root_object is actual window, and you can access any DOM object starting from this. For a more detailed explanation please refer to here.

@xxuejie xxuejie closed this as completed Apr 9, 2013
@adelevie
Copy link
Author

adelevie commented Apr 9, 2013

This is great, thanks!

Sent from my iPhone

On Apr 8, 2013, at 10:45 PM, xxuejie notifications@github.com wrote:

Okay, I made a few changes, now the demo above should be able to access DOM. For example, you can use following line to print the page title:

puts MrubyJs::get_root_object.document.title
Here MrubyJs::get_root_object is actual window, and you can access any DOM object starting from this. For a more detailed explanation please refer to here.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants