Media: Prevent type and search attachments filters from short circuiting.

Moves the reference to the source collection out of the props model. If it was translated over to a query (which was potentially possible) which then fired an ajax request, jQuery would attempt to serialize an object recursively, which caused an infinite loop and much sadness for my browser.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-21 08:09:28 +00:00
parent 4fcb87234b
commit c717bb47e2
1 changed files with 6 additions and 5 deletions

View File

@ -325,8 +325,9 @@ window.wp = window.wp || {};
},
_changeFilteredProp: function( prop, model, term ) {
// Bail if we're currently searching for the same term.
if ( this.props.get( prop ) === term )
// If this is a query, updating the collection will be handled by
// `this._requery()`.
if ( this.props.get('query') )
return;
if ( term && ! this.filters[ prop ] )
@ -337,10 +338,10 @@ window.wp = window.wp || {};
// If no `Attachments` model is provided to source the searches
// from, then automatically generate a source from the existing
// models.
if ( ! this.props.get('source') )
this.props.set( 'source', new Attachments( this.models ) );
if ( ! this._source )
this._source = new Attachments( this.models );
this.reset( this.props.get('source').filter( this.validator ) );
this.reset( this._source.filter( this.validator, this ) );
},
_changeSearch: function( model, term ) {