Il source code spiega in questo modo:
/**
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);
},
Quindi, per rispondere alla tua domanda: no, non è la stessa di $(this)
, che avvolgere l'istanza vista brace in un oggetto jQuery ...
Il primo frammento suggerisce che l'oggetto jQuery ($) è memorizzato come una proprietà su 'this', probabilmente per evitare l'ambito globale inquinante, ma non ne sono sicuro. –
Ma è eseguito. E ritorna, quindi è incatenato. Penso che sia legittimo, ma non avrei mai pensato di provare che ... – jcolebrand
fa this.button() funziona? Se è così, 'questo' è un oggetto jquery. – MMeah