Make WordPress Core

Changeset 22682


Ignore:
Timestamp:
11/19/2012 10:41:24 AM (12 years ago)
Author:
koopersmith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r22681 r22682  
    591591            selector = selector || '';
    592592            return this._views[ selector ];
     593        },
     594
     595        // ### Get a selector's first subview
     596        //
     597        // Fetches the first subview that matches a given `selector`.
     598        //
     599        // If no `selector` is provided, it will grab the first subview
     600        // attached to the view's root.
     601        //
     602        // Useful when a selector only has one subview at a time.
     603        first: function( selector ) {
     604            var views = this.get( selector );
     605            return views && views.length ? views[0] : null;
    593606        },
    594607
Note: See TracChangeset for help on using the changeset viewer.