4

I've read all of the documentation I can find and it is a bit spotty. Can someone tell me how to use jquery's .html() method in the ruby -> jquery bridge opal-jquery? Also any advice for how I would go about figuring out implemented methods in a sparsely documented gem in the future would definitely be appreciated.

ylluminate
  • 12,102
  • 17
  • 78
  • 152

1 Answers1

5

jQuery's .html() method in opal-jquery is mapped as Element#html and Element#html=.

The latter is definitively more like Ruby and is obviously there to set HTML content.

For convenience though you can still use #html as both a setter (with an argument) or a getter (no arguments).

This is where .html() is aliased as #html=:

https://github.com/opal/opal-jquery/blob/eab45e24ed1128721395d38d7d4b9e84c4427c00/opal/opal-jquery/element.rb#L78

This is where #html is defined:

https://github.com/opal/opal-jquery/blob/eab45e24ed1128721395d38d7d4b9e84c4427c00/opal/opal-jquery/element.rb#L214-L222

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Elia Schito
  • 989
  • 7
  • 18