如何用 jQuery 包装集扩展 class?

How do you extend a class with a jQuery wrapped set?

以下几乎可以工作...

$el = ->
$el:: = $ '#test'
new class extends $el
  constructor: ->
    @append '<h1>Worked!</h1>'


    # this will overflow the stack
    @find('[role=test2]').append '<h2>Also Worked!</h2>'

此处示例:http://jsfiddle.net/66a3jdot/

答案就在眼前……

new class
  @:: = $ '#test'
  constructor: ->
    @append '<h1>Worked!</h1>'
    @find('[role=test2]').append '<h2>Also Worked!</h2>'

http://jsfiddle.net/wycleffsean/66a3jdot/2/