<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27313] trunk/src/wp-includes: `wp.media.collection` should be its own civilized instantiable class, not a wrapper/factory.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27313">27313</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-02-27 19:21:04 +0000 (Thu, 27 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>`wp.media.collection` should be its own civilized instantiable class, not a wrapper/factory. The class shall contain no reference to specific instances, and shall not try to grab static properties of itself. `self`, meet `this`.

See <a href="http://core.trac.wordpress.org/ticket/26631">#26631</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmediaeditorjs">trunk/src/wp-includes/js/media-editor.js</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmediaeditorjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-editor.js (27312 => 27313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-editor.js 2014-02-27 15:21:37 UTC (rev 27312)
+++ trunk/src/wp-includes/js/media-editor.js    2014-02-27 19:21:04 UTC (rev 27313)
</span><span class="lines">@@ -2,13 +2,13 @@
</span><span class="cx"> 
</span><span class="cx"> // WordPress, TinyMCE, and Media
</span><span class="cx"> // -----------------------------
</span><del>-(function($){
</del><ins>+(function($, _){
</ins><span class="cx">   /**
</span><span class="cx">   * Stores the editors' `wp.media.controller.Frame` instances.
</span><span class="cx">   *
</span><span class="cx">   * @static
</span><span class="cx">   */
</span><del>-       var workflows = {}, cache = {};
</del><ins>+        var workflows = {};
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * wp.media.string
</span><span class="lines">@@ -274,39 +274,35 @@
</span><span class="cx">          }
</span><span class="cx">  };
</span><span class="cx"> 
</span><del>-       /**
-        * wp.media.collection
-        * @namespace
-        */
-       wp.media.collection = {
-               attachments : function ( prop, type ) {
-                       /**
-                        * Retrieve attachments based on the properties of the passed shortcode
-                        *
-                        * @global wp.media.query
-                        *
-                        * @param {wp.shortcode} shortcode An instance of wp.shortcode().
-                        * @returns {wp.media.model.Attachments} A Backbone.Collection containing
-                        *      the media items belonging to a collection.
-                        *      The 'prop' specified by the passed prop is a Backbone.Model
-                        *                      containing the 'props' for the gallery.
-                        */
-                       return function( shortcode ) {
</del><ins>+        wp.media.collection = function(attributes) {
+               var collections = {};
+
+               return _.extend( attributes, {
+                       coerce: function ( attrs, key ) {
+                               if ( 'undefined' === typeof attrs[ key ] && 'undefined' !== typeof this.defaults[ key ] ) {
+                                       attrs[ key ] = this.defaults[ key ];
+                               } else if ( 'true' === attrs[ key ] ) {
+                                       attrs[ key ] = true;
+                               } else if ( 'false' === attrs[ key ] ) {
+                                       attrs[ key ] = false;
+                               }
+                               return attrs[ key ];
+                       },
+
+                       attachments: function( shortcode ) {
</ins><span class="cx">                           var shortcodeString = shortcode.string(),
</span><del>-                                       result = cache[ shortcodeString ],
-                                       attrs, args, query, others;
</del><ins>+                                        result = collections[ shortcodeString ],
+                                       attrs, args, query, others, self = this;
</ins><span class="cx"> 
</span><del>-                               delete cache[ shortcodeString ];
-
</del><ins>+                                delete collections[ shortcodeString ];
</ins><span class="cx">                           if ( result ) {
</span><span class="cx">                                  return result;
</span><span class="cx">                          }
</span><del>-
</del><span class="cx">                           // Fill the default shortcode attributes.
</span><span class="cx">                          attrs = _.defaults( shortcode.attrs.named, this.defaults );
</span><span class="cx">                          args  = _.pick( attrs, 'orderby', 'order' );
</span><span class="cx"> 
</span><del>-                               args.type = type;
</del><ins>+                                args.type    = this.type;
</ins><span class="cx">                           args.perPage = -1;
</span><span class="cx"> 
</span><span class="cx">                          // Mark the `orderby` override attribute.
</span><span class="lines">@@ -318,16 +314,6 @@
</span><span class="cx">                                  attrs._orderbyRandom = true;
</span><span class="cx">                          }
</span><span class="cx"> 
</span><del>-                               if ( -1 !== jQuery.inArray( prop, ['playlist', 'video-playlist'] ) ) {
-                                       _.each(['tracknumbers', 'tracklist', 'images', 'artists'], function (setting) {
-                                               if ( 'undefined' === typeof attrs[setting] ) {
-                                                       attrs['_' + setting] = wp.media[ prop ].defaults[ setting ];
-                                               } else if ( 'true' === attrs[setting] || true === attrs[setting] ) {
-                                                       attrs['_' + setting] = true;
-                                               }
-                                       });
-                               }
-
</del><span class="cx">                           // Map the `orderby` attribute to the corresponding model property.
</span><span class="cx">                          if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) {
</span><span class="cx">                                  args.orderby = 'menuOrder';
</span><span class="lines">@@ -352,250 +338,173 @@
</span><span class="cx">                          // Collect the attributes that were not included in `args`.
</span><span class="cx">                          others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' );
</span><span class="cx"> 
</span><ins>+                               // Remove default attributes from the shortcode.
+                               _.each( this.defaults, function( value, key ) {
+                                       others[ key ] = self.coerce( others, key );
+                               });
+
</ins><span class="cx">                           query = wp.media.query( args );
</span><del>-                               query[ prop ] = new Backbone.Model( others );
</del><ins>+                                query[ this.tag ] = new Backbone.Model( others );
</ins><span class="cx">                           return query;
</span><del>-                       };
-               },
</del><ins>+                        },
</ins><span class="cx"> 
</span><del>-               shortcodeAttrs : function ( prop, attachments ) {
-                       var props = attachments.props.toJSON(),
-                               attrs = _.pick( props, 'orderby', 'order', 'style' );
</del><ins>+                        shortcode: function( attachments ) {
+                               var props = attachments.props.toJSON(),
+                                       attrs = _.pick( props, 'orderby', 'order' ),
+                                       shortcode, clone, self = this;
</ins><span class="cx"> 
</span><del>-                       if ( attachments[ prop ] ) {
-                               _.extend( attrs, attachments[ prop ].toJSON() );
-                       }
</del><ins>+                                if ( attachments[this.tag] ) {
+                                       _.extend( attrs, attachments[this.tag].toJSON() );
+                               }
+                               // Convert all gallery shortcodes to use the `ids` property.
+                               // Ignore `post__in` and `post__not_in`; the attachments in
+                               // the collection will already reflect those properties.
+                               attrs.ids = attachments.pluck('id');
</ins><span class="cx"> 
</span><del>-                       // Convert all collection shortcodes to use the `ids` property.
-                       // Ignore `post__in` and `post__not_in`; the attachments in
-                       // the collection will already reflect those properties.
-                       attrs.ids = attachments.pluck('id');
</del><ins>+                                // Copy the `uploadedTo` post ID.
+                               if ( props.uploadedTo ) {
+                                       attrs.id = props.uploadedTo;
+                               }
+                               // Check if the gallery is randomly ordered.
+                               delete attrs.orderby;
</ins><span class="cx"> 
</span><del>-                       // Copy the `uploadedTo` post ID.
-                       if ( props.uploadedTo ) {
-                               attrs.id = props.uploadedTo;
-                       }
</del><ins>+                                if ( attrs._orderbyRandom ) {
+                                       attrs.orderby = 'rand';
+                               } else if ( attrs._orderByField && attrs._orderByField != 'rand' ) {
+                                       attrs.orderby = attrs._orderByField;
+                               }
</ins><span class="cx"> 
</span><del>-                       // Check if the collection is randomly ordered.
-                       delete attrs.orderby;
</del><ins>+                                delete attrs._orderbyRandom;
+                               delete attrs._orderByField;
</ins><span class="cx"> 
</span><del>-                       if ( attrs._orderbyRandom ) {
-                               attrs.orderby = 'rand';
-                       } else if ( attrs._orderByField && attrs._orderByField != 'rand' ) {
-                               attrs.orderby = attrs._orderByField;
-                       }
</del><ins>+                                // If the `ids` attribute is set and `orderby` attribute
+                               // is the default value, clear it for cleaner output.
+                               if ( attrs.ids && 'post__in' === attrs.orderby ) {
+                                       delete attrs.orderby;
+                               }
</ins><span class="cx"> 
</span><del>-                       delete attrs._orderbyRandom;
-                       delete attrs._orderByField;
-
-                       // If the `ids` attribute is set and `orderby` attribute
-                       // is the default value, clear it for cleaner output.
-                       if ( attrs.ids && 'post__in' === attrs.orderby ) {
-                               delete attrs.orderby;
-                       }
-
-                       if ( -1 !== jQuery.inArray( prop, ['playlist', 'video-playlist'] ) ) {
-                               _.each(['tracknumbers', 'tracklist', 'images', 'artists'], function (setting) {
-                                       if ( 'undefined' === typeof attrs[ '_' + setting ] ) {
-                                               attrs[ '_' + setting ] = wp.media[ prop ].defaults[ setting ];
</del><ins>+                                // Remove default attributes from the shortcode.
+                               _.each( this.defaults, function( value, key ) {
+                                       attrs[ key ] = self.coerce( attrs, key );
+                                       if ( value === attrs[ key ] ) {
+                                               delete attrs[ key ];
</ins><span class="cx">                                   }
</span><ins>+                               });
</ins><span class="cx"> 
</span><del>-                                       if ( attrs['_' + setting] ) {
-                                               attrs[setting] = true;
-                                       } else {
-                                               attrs[setting] = false;
-                                       }
-                                       delete attrs['_' + setting];
</del><ins>+                                shortcode = new wp.shortcode({
+                                       tag:    this.tag,
+                                       attrs:  attrs,
+                                       type:   'single'
</ins><span class="cx">                           });
</span><del>-                       }
</del><span class="cx"> 
</span><del>-                       // Remove default attributes from the shortcode.
-                       _.each( wp.media[prop].defaults, function( value, key ) {
-                               if ( value === attrs[ key ] ) {
-                                       delete attrs[ key ];
-                               }
-                       });
-                       return attrs;
-               },
</del><ins>+                                // Use a cloned version of the gallery.
+                               clone = new wp.media.model.Attachments( attachments.models, {
+                                       props: props
+                               });
+                               clone[ this.tag ] = attachments[ this.tag ];
+                               collections[ shortcode.string() ] = clone;
</ins><span class="cx"> 
</span><del>-               editSelection : function ( prop, shortcode ) {
-                       var defaultPostId = wp.media[ prop ].defaults.id,
-                               attachments, selection;
</del><ins>+                                return shortcode;
+                       },
</ins><span class="cx"> 
</span><del>-                       // Ignore the rest of the match object.
-                       shortcode = shortcode.shortcode;
</del><ins>+                        edit: function( content ) {
+                               var shortcode = wp.shortcode.next( this.tag, content ),
+                                       defaultPostId = this.defaults.id,
+                                       attachments, selection;
</ins><span class="cx"> 
</span><del>-                       if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) {
-                               shortcode.set( 'id', defaultPostId );
-                       }
</del><ins>+                                // Bail if we didn't match the shortcode or all of the content.
+                               if ( ! shortcode || shortcode.content !== content ) {
+                                       return;
+                               }
</ins><span class="cx"> 
</span><del>-                       attachments = wp.media[ prop ].attachments( shortcode );
</del><ins>+                                // Ignore the rest of the match object.
+                               shortcode = shortcode.shortcode;
</ins><span class="cx"> 
</span><del>-                       selection = new wp.media.model.Selection( attachments.models, {
-                               props:    attachments.props.toJSON(),
-                               multiple: true
-                       });
</del><ins>+                                if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) {
+                                       shortcode.set( 'id', defaultPostId );
+                               }
</ins><span class="cx"> 
</span><del>-                       selection[ prop ] = attachments[ prop ];
</del><ins>+                                attachments = this.attachments( shortcode );
</ins><span class="cx"> 
</span><del>-                       // Fetch the query's attachments, and then break ties from the
-                       // query to allow for sorting.
-                       selection.more().done( function() {
-                               // Break ties with the query.
-                               selection.props.set({ query: false });
-                               selection.unmirror();
-                               selection.props.unset('orderby');
-                       });
</del><ins>+                                selection = new wp.media.model.Selection( attachments.models, {
+                                       props:    attachments.props.toJSON(),
+                                       multiple: true
+                               });
</ins><span class="cx"> 
</span><del>-                       return selection;
-               },
</del><ins>+                                selection[ this.tag ] = attachments[ this.tag ];
</ins><span class="cx"> 
</span><del>-               /**
-                *
-                * @param {string} prop The shortcode slug
-                * @param {wp.media.model.Attachments} attachments
-                * @param {wp.shortcode} shortcode
-                * @returns {wp.shortcode}
-                */
-               cacheShortcode : function ( prop, attachments, shortcode ) {
-                       // Use a cloned version of the playlist.
-                       var clone = new wp.media.model.Attachments( attachments.models, {
-                               props: attachments.props.toJSON()
-                       });
-                       clone[ prop ] = attachments[ prop ];
-                       cache[ shortcode.string() ] = clone;
</del><ins>+                                // Fetch the query's attachments, and then break ties from the
+                               // query to allow for sorting.
+                               selection.more().done( function() {
+                                       // Break ties with the query.
+                                       selection.props.set({ query: false });
+                                       selection.unmirror();
+                                       selection.props.unset('orderby');
+                               });
</ins><span class="cx"> 
</span><del>-                       return shortcode;
-               },
-
-               getEditFrame : function ( args ) {
-                       // Destroy the previous gallery frame.
-                       if ( this.frame ) {
-                               this.frame.dispose();
-                       }
-
-                       // Store the current gallery frame.
-                       this.frame = wp.media( _.extend( {
-                               frame:     'post',
-                               editing:   true,
-                               multiple:  true
-                       }, args ) ).open();
-
-                       return this.frame;
-               },
-
-               instance : function ( prop, args ) {
-                       return {
-                               attachments: this.attachments( prop, args.type ),
-                               /**
-                                * Triggered when clicking 'Insert {label}' or 'Update {label}'
-                                *
-                                * @global wp.shortcode
-                                * @global wp.media.model.Attachments
-                                *
-                                * @param {wp.media.model.Attachments} attachments A Backbone.Collection containing
-                                *      the media items belonging to a collection.
-                                *      The 'prop' specified by the passed prop is a Backbone.Model
-                                *                      containing the 'props' for the gallery.
-                                * @returns {wp.shortcode}
-                                */
-                               shortcode: function( attachments ) {
-                                       var shortcode = new wp.shortcode({
-                                               tag: prop,
-                                               attrs: wp.media.collection.shortcodeAttrs( prop, attachments ),
-                                               type: 'single'
-                                       });
-
-                                       return wp.media.collection.cacheShortcode( prop, attachments, shortcode );
-                               },
-                               /**
-                                * Triggered when double-clicking a collection shortcode placeholder
-                                *   in the editor
-                                *
-                                * @global wp.shortcode
-                                * @global wp.media.model.Selection
-                                * @global wp.media.view.l10n
-                                *
-                                * @param {string} content Content that is searched for possible
-                                *    shortcode markup matching the passed tag name,
-                                *
-                                * @this wp.media.{prop}
-                                *
-                                * @returns {wp.media.view.MediaFrame.Select} A media workflow.
-                                */
-                               edit: function( content ) {
-                                       var shortcode = wp.shortcode.next( prop, content );
-
-                                       // Bail if we didn't match the shortcode or all of the content.
-                                       if ( ! shortcode || shortcode.content !== content ) {
-                                               return;
-                                       }
-
-                                       return wp.media.collection.getEditFrame( {
-                                               title: args.title,
-                                               state: prop + '-edit',
-                                               selection:      wp.media.collection.editSelection( prop, shortcode )
-                                       } );
</del><ins>+                                // Destroy the previous gallery frame.
+                               if ( this.frame ) {
+                                       this.frame.dispose();
</ins><span class="cx">                           }
</span><del>-                       };
-               }
-       };
</del><span class="cx"> 
</span><del>-       wp.media.gallery = (function() {
-               var gallery = {
-                       defaults : {
-                               itemtag: 'dl',
-                               icontag: 'dt',
-                               captiontag: 'dd',
-                               columns: '3',
-                               link: 'post',
-                               size: 'thumbnail',
-                               order: 'ASC',
-                               id: wp.media.view.settings.post.id,
-                               orderby : 'menu_order ID'
-                       }
-               };
</del><ins>+                                // Store the current gallery frame.
+                               this.frame = wp.media({
+                                       frame:     'post',
+                                       state:     this.tag + '-edit',
+                                       title:     this.editTitle,
+                                       editing:   true,
+                                       multiple:  true,
+                                       selection: selection
+                               }).open();
</ins><span class="cx"> 
</span><del>-               return _.extend(gallery, wp.media.collection.instance( 'gallery', {
-                       type : 'image',
-                       title : wp.media.view.l10n.editGalleryTitle
-               }));
-       }());
-
-       wp.media.playlist = (function() {
-               var playlist = {
-                       defaults : {
-                               id: wp.media.view.settings.post.id,
-                               style: 'light',
-                               tracklist: true,
-                               tracknumbers: true,
-                               images: true,
-                               artists: true
</del><ins>+                                return this.frame;
</ins><span class="cx">                   }
</span><del>-               };
</del><ins>+                });
+       };
</ins><span class="cx"> 
</span><del>-               return _.extend(playlist, wp.media.collection.instance( 'playlist', {
-                       type : 'audio',
-                       title : wp.media.view.l10n.editPlaylistTitle
-               }));
-       }());
</del><ins>+        wp.media.gallery = new wp.media.collection({
+               tag: 'gallery',
+               type : 'image',
+               editTitle : wp.media.view.l10n.editGalleryTitle,
+               defaults : {
+                       itemtag: 'dl',
+                       icontag: 'dt',
+                       captiontag: 'dd',
+                       columns: '3',
+                       link: 'post',
+                       size: 'thumbnail',
+                       order: 'ASC',
+                       id: wp.media.view.settings.post.id,
+                       orderby : 'menu_order ID'
+               }
+       });
</ins><span class="cx"> 
</span><del>-       wp.media['video-playlist'] = (function() {
-               var playlist = {
-                       defaults : {
-                               id: wp.media.view.settings.post.id,
-                               style: 'light',
-                               tracklist: false,
-                               tracknumbers: false,
-                               images: true
-                       }
-               };
</del><ins>+        wp.media.playlist = new wp.media.collection({
+               tag: 'playlist',
+               type : 'audio',
+               editTitle : wp.media.view.l10n.editPlaylistTitle,
+               defaults : {
+                       id: wp.media.view.settings.post.id,
+                       style: 'light',
+                       tracklist: true,
+                       tracknumbers: true,
+                       images: true,
+                       artists: true
+               }
+       });
</ins><span class="cx"> 
</span><del>-               return _.extend(playlist, wp.media.collection.instance( 'video-playlist', {
-                       type : 'video',
-                       title : wp.media.view.l10n.editVideoPlaylistTitle
-               }));
-       }());
</del><ins>+        wp.media['video-playlist'] = new wp.media.collection( {
+               tag: 'video-playlist',
+               type : 'video',
+               editTitle : wp.media.view.l10n.editVideoPlaylistTitle,
+               defaults : {
+                       id: wp.media.view.settings.post.id,
+                       style: 'light',
+                       tracklist: false,
+                       tracknumbers: false,
+                       images: true
+               }
+       } );
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * wp.media.featuredImage
</span><span class="lines">@@ -1083,4 +992,4 @@
</span><span class="cx"> 
</span><span class="cx">  _.bindAll( wp.media.editor, 'open' );
</span><span class="cx">  $( wp.media.editor.init );
</span><del>-}(jQuery));
</del><ins>+}(jQuery, _));
</ins></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media-template.php (27312 => 27313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media-template.php 2014-02-27 15:21:37 UTC (rev 27312)
+++ trunk/src/wp-includes/media-template.php    2014-02-27 19:21:04 UTC (rev 27313)
</span><span class="lines">@@ -432,32 +432,32 @@
</span><span class="cx">          </label>
</span><span class="cx"> 
</span><span class="cx">          <#
</span><del>-                       var playlist = 'playlist-edit' === data.controller.id, emptyModel = 'undefined' === typeof data.model.style;
</del><ins>+                        var playlist = 'playlist-edit' === data.controller.id, emptyModel = _.isEmpty(data.model);
</ins><span class="cx">           #>
</span><span class="cx">          <label class="setting">
</span><span class="cx">                  <span><?php _e( 'Show Tracklist' ); ?></span>
</span><del>-                       <input type="checkbox" data-setting="_tracklist" <# if ( playlist && emptyModel ) { #>
</del><ins>+                        <input type="checkbox" data-setting="tracklist" <# if ( playlist && emptyModel ) { #>
</ins><span class="cx">                           checked="checked"
</span><span class="cx">                  <# } #> />
</span><span class="cx">          </label>
</span><span class="cx"> 
</span><span class="cx">          <label class="setting">
</span><span class="cx">                  <span><?php _e( 'Show Track Numbers' ); ?></span>
</span><del>-                       <input type="checkbox" data-setting="_tracknumbers" <# if ( playlist && emptyModel ) { #>
</del><ins>+                        <input type="checkbox" data-setting="tracknumbers" <# if ( playlist && emptyModel ) { #>
</ins><span class="cx">                           checked="checked"
</span><span class="cx">                  <# } #> />
</span><span class="cx">          </label>
</span><span class="cx"> 
</span><span class="cx">          <label class="setting">
</span><span class="cx">                  <span><?php _e( 'Show Artist Name in Tracklist' ); ?></span>
</span><del>-                       <input type="checkbox" data-setting="_artists" <# if ( playlist && emptyModel ) { #>
</del><ins>+                        <input type="checkbox" data-setting="artists" <# if ( playlist && emptyModel ) { #>
</ins><span class="cx">                           checked="checked"
</span><span class="cx">                  <# } #> />
</span><span class="cx">          </label>
</span><span class="cx"> 
</span><span class="cx">          <label class="setting">
</span><span class="cx">                  <span><?php _e( 'Show Images' ); ?></span>
</span><del>-                       <input type="checkbox" data-setting="_images" <# if ( emptyModel ) { #>
</del><ins>+                        <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #>
</ins><span class="cx">                           checked="checked"
</span><span class="cx">                  <# } #> />
</span><span class="cx">          </label>
</span></span></pre>
</div>
</div>

</body>
</html>