When this.$() returns null


#1

I’ve been doing some work in an implementation of View#didInsertElement in Ember 1.1.2 and am noticing that invoking this.$(’.foo’) returns undefined if there is no element of class foo. However, jQuery returns an empty Array in this case. Is this intentional or a bug?


#2

how about Ember.$('.foo')?


#3

Hmm… haven’t checked that yet. But the idea is that this.() will give me the jQuery element for that view, then I can essentially do a .find('.foo') by just calling this.(’.foo’), but it should never return undefined.


#4

But here is a jsfiddle that I think displays that it is working http://jsfiddle.net/NQKvy/378/

Just make sure your markup is correct, because I’ve seen scenarios where that breaks the traversing.


#5

Hmmm… let me reduce my case down and see if it still shows…