timimahoney / decaf

Ruby in the browser.
http://trydecaf.org
470 stars 8 forks source link

If JavaScript also has to be used besides Ruby, Is it possible with Decaf? #11

Closed raviagrwl420 closed 11 years ago

raviagrwl420 commented 11 years ago

I want to know how exactly Decaf integrates Ruby with WebKit. Is it possible to handle the DOM through both JavaScript and Ruby or you have to move completely to Ruby?

timimahoney commented 11 years ago

Decaf integrates Ruby at the same level as JavaScript. JavaScript is still there, so you can use both at the same time. Here's a little bit about how Ruby is connected to the DOM. It doesn't explain the whole inner workings, but it's a start.

raviagrwl420 commented 11 years ago

The detection of JavaScript or Ruby is probably then done using the "type" attribute of the "script" tag. @timahoney am I right?

timimahoney commented 11 years ago

Ah yeah. Sorry, I should write something more explicit about that. You can specify type='text/ruby' to specify that it's Ruby.