[Celerity-users] Query native javascript functions on an HTMLElement?
Jari Bakken
jari.bakken at gmail.com
Thu Sep 3 17:49:10 EDT 2009
On Thu, Sep 3, 2009 at 12:41 AM, chao Lam<chaolam at gmail.com> wrote:
> Hi Jari,
>
> Wow, that was fast - thank you.
>
> Just trying to understand the underlying mechanism, how does jsx_get work?
> Does it have a jsx_get_<field> method for every <field> in the HTMLElement
> or CSSStyleDeclaration javascript object?
>
That's right - we implement method_missing to avoid the prefix present
in HtmlUnit.
You can use Ruby's reflection features to see a list of what methods
an object responds to:
>> browser.div(:id, "gbar").javascript_object.methods - Object.methods
=> ["jsx_set_align", "jsx_set_align__method",
"jsxGet_align__method", "jsx_get_align", ...]
More information about the Celerity-users
mailing list