Media: Add a method to fetch the first subview. see #21390.

git-svn-id: https://develop.svn.wordpress.org/trunk@22682 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-11-19 10:41:24 +00:00
parent 17af1e2366
commit aa6b7069e6
1 changed files with 13 additions and 0 deletions

View File

@ -592,6 +592,19 @@
return this._views[ selector ];
},
// ### Get a selector's first subview
//
// Fetches the first subview that matches a given `selector`.
//
// If no `selector` is provided, it will grab the first subview
// attached to the view's root.
//
// Useful when a selector only has one subview at a time.
first: function( selector ) {
var views = this.get( selector );
return views && views.length ? views[0] : null;
},
// ### Register subview(s)
//
// Registers any number of `views` to a `selector`.