Die source code erklärt dies wie folgt:
/**
Returns a jQuery object for this view's element. If you pass in a selector
string, this method will return a jQuery object, using the current element
as its buffer.
For example, calling `view.$('li')` will return a jQuery object containing
all of the `li` elements inside the DOM element of this view.
@param {String} [selector] a jQuery-compatible selector string
@returns {Ember.CoreQuery} the CoreQuery object for the DOM node
*/
$: function(sel) {
return this.invokeForState('$', sel);
},
So Ihre Frage zu beantworten: Nein, es ist nicht das gleiche wie $(this)
, die die glut View-Instanz in einem jQuery-Objekt wickeln würde ...
Der erste Snippet schlägt vor, dass das jQuery-Objekt ($) als eine Eigenschaft auf 'this 'gespeichert wird, möglicherweise um den globalen Geltungsbereich zu verschmutzen, aber ich bin mir nicht sicher. –
Aber es ist ausgeführt. Und es kehrt zurück, also ist es angekettet. Ich denke, das ist echt, aber ich hätte nie daran gedacht, das zu versuchen ... – jcolebrand
funktioniert this.button()? Wenn dies der Fall ist, ist "dies" ein jquery-Objekt. – MMeah