I am using the Mariontte ItemView 'ui' to create short hands for selectors.
class MyView extends App.Views.ItemView
ui:
myItem: "#item"
However when I call @ui.myItem I'm being returned an array so the actual element is inside @ui.myItem[0] What's causing this behavior? It's an issue for me as I'm doing a compare between @ui.myItem with the event.target element from an event so they don't match and now I have to do some fiddling.
This is a jQuery thing. When it selects an element it's actually storing it in an array-like object. Using @ui.myItem[0]
to compare is one way to go. Another way is @ui.myItem.get(0)
.
While the first approach above is what I would recommend, you could also compare using jQuery.is.