简体   繁体   English

如何在opal-jquery中使用jquery的.html()?

[英]How do I use jquery's .html( ) in opal-jquery?

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? 有人能告诉我如何在ruby -> jquery使用jquery的.html()方法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. 对于我将如何在未来稀疏记录的宝石中找出已实现的方法的任何建议肯定会受到赞赏。

jQuery's .html() method in opal-jquery is mapped as Element#html and Element#html= . opal-jquery jQuery的.html()方法被映射为Element#htmlElement#html=

The latter is definitively more like Ruby and is obviously there to set HTML content. 后者最终更像Ruby,显然是设置HTML内容。

For convenience though you can still use #html as both a setter (with an argument) or a getter (no arguments). 为方便起见,您仍然可以将#html用作setter(带参数)或getter(无参数)。

This is where .html() is aliased as #html= : 这是.html()别名为#html=

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

This is where #html is defined: 这是定义#html地方:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM