这在 Coffeescript 中意味着什么?

What does this mean in Coffeescript?

我正在浏览一个用 Coffescript 编写的代码库,我遇到了这个声明:

@$('.js-edit-feedback-section').addClass('hidden')

如果我没记错的话,这可以翻译成

this.$('.js-edit-feedback-section').addClass('hidden')

这样做而不是直接使用 jQuery 选择器有什么好处:

$('.js-edit-feedback-section').addClass('hidden')

我假设您使用的是 Backbone.View,其中 Backbone.View.$ 与全局 jQuery 有点不同。

If jQuery is included on the page, each view has a $ function that runs queries scoped within the view's element. If you use this scoped jQuery function, you don't have to use model ids as part of your query to pull out specific elements in a list, and can rely much more on HTML class attributes. It's equivalent to running: view.$el.find(selector)

http://backbonejs.org/#View-dollar