<!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>[22648] trunk/wp-includes: Media: Add a base view class.</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, #logmsg > ol { margin-left: 0; 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/22648">22648</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2012-11-19 00:36:47 +0000 (Mon, 19 Nov 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Media: Add a base view class.
* Centralizes view and subview management, unifying several disjointed constructs.
* Utilizes the `dispose` functionality found in Backbone master, providing a standard method for memory management.
see <a href="http://core.trac.wordpress.org/ticket/21390">#21390</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludescssmediaviewscss">trunk/wp-includes/css/media-views.css</a></li>
<li><a href="#trunkwpincludesjsmediaviewsjs">trunk/wp-includes/js/media-views.js</a></li>
<li><a href="#trunkwpincludesmediaphp">trunk/wp-includes/media.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludescssmediaviewscss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/media-views.css (22647 => 22648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/media-views.css        2012-11-18 23:49:54 UTC (rev 22647)
+++ trunk/wp-includes/css/media-views.css        2012-11-19 00:36:47 UTC (rev 22648)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">         border: 0 solid #dfdfdf;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.media-frame > .media-toolbar {
</del><ins>+.media-frame-toolbar > .media-toolbar {
</ins><span class="cx">         top: auto;
</span><span class="cx">         left: 200px;
</span><span class="cx">         bottom: 0;
</span><span class="lines">@@ -116,7 +116,7 @@
</span><span class="cx">         box-shadow: 0 -4px 4px -4px rgba( 0, 0, 0, 0.1 );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.media-frame.hide-toolbar > .media-toolbar {
</del><ins>+.hide-toolbar .media-frame-toolbar > .media-toolbar {
</ins><span class="cx">         bottom: -61px;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/media-views.js (22647 => 22648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/media-views.js        2012-11-18 23:49:54 UTC (rev 22647)
+++ trunk/wp-includes/js/media-views.js        2012-11-19 00:36:47 UTC (rev 22648)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">          * wp.media.controller.Region
</span><span class="cx">          */
</span><span class="cx">         media.controller.Region = function( options ) {
</span><del>-                _.extend( this, _.pick( options || {}, 'id', 'controller' ) );
</del><ins>+                _.extend( this, _.pick( options || {}, 'id', 'controller', 'selector' ) );
</ins><span class="cx">
</span><span class="cx">                 this.on( 'activate:empty', this.empty, this );
</span><span class="cx">                 this.mode('empty');
</span><span class="lines">@@ -113,25 +113,12 @@
</span><span class="cx">                         if ( mode )
</span><span class="cx">                                 view.$el.addClass( 'mode-' + mode );
</span><span class="cx">
</span><del>-                        // Remove the hide class.
-                        // this.$el.removeClass( 'hide-' + subview );
-
-                        if ( previous ) {
-                                // Replace the view in place.
-                                previous.$el.replaceWith( view.$el );
-
-                                // Fire the view's `destroy` event if it exists.
-                                if ( previous.destroy )
-                                        previous.destroy();
-                                // Undelegate events.
-                                previous.undelegateEvents();
-                        }
-
</del><ins>+                        this.controller.views.set( this.selector, view );
</ins><span class="cx">                         this._view = view;
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="cx">                 empty: function() {
</span><del>-                        this.view( new Backbone.View() );
</del><ins>+                        this.view( new media.View() );
</ins><span class="cx">                 }
</span><span class="cx">         });
</span><span class="cx">
</span><span class="lines">@@ -574,11 +561,154 @@
</span><span class="cx">          * ========================================================================
</span><span class="cx">          */
</span><span class="cx">
</span><ins>+        // wp.media.Views
+        // -------------
+        //
+        // A subview manager.
+
+        media.Views = function( view, views ) {
+                this.view = view;
+                this._views = _.isArray( views ) ? { '': views } : views || {};
+        };
+
+        media.Views.extend = Backbone.Model.extend;
+
+        _.extend( media.Views.prototype, {
+                get: function( selector ) {
+                        selector = selector || '';
+                        return this._views[ selector ];
+                },
+
+                set: function( selector, views, options ) {
+                        var $selector, els, existing, add, method;
+
+                        if ( ! _.isString( selector ) ) {
+                                options = views;
+                                views = selector;
+                                selector = '';
+                        }
+
+                        views = _.isArray( views ) ? views : [ views ];
+                        add = options && options.add;
+                        existing = this.get( selector );
+                        method = add ? 'attach' : 'replace';
+
+                        if ( ! add && existing ) {
+                                this.unset( selector );
+                                _.invoke( existing, 'dispose' );
+                        }
+
+                        this._views[ selector ] = add && existing ? existing.concat( views ) : views;
+
+                        $selector = selector ? this.view.$( selector ) : this.view.$el;
+                        els = _.pluck( views, 'el' );
+
+                        _.each( views, function( subview ) {
+                                var subviews = subview.views = subview.views || new this.constructor( subview );
+                                subviews.parent = this.view;
+                                subviews.selector = selector;
+                        }, this );
+
+                        this[ method ]( $selector, els );
+                        return this;
+                },
+
+                add: function( selector, views ) {
+                        return this.set( selector, views, { add: true });
+                },
+
+                unset: function( selector, views ) {
+                        var existing;
+
+                        if ( ! _.isString( selector ) ) {
+                                views = selector;
+                                selector = '';
+                        }
+
+                        views = _.isArray( views ) ? views : [ views ];
+
+                        if ( existing = this.get( selector ) )
+                                this._views[ selector ] = _.difference( existing, views );
+
+                        return this;
+                },
+
+                render: function() {
+                        var root = this._views[''];
+
+                        if ( root )
+                                this.replace( this.view.$el, _.pluck( root, 'el' ) );
+
+                        _.each( this._views, function( views, selector ) {
+                                if ( selector )
+                                        this.replace( this.view.$( selector ), _.pluck( views, 'el' ) );
+                        }, this );
+
+                        return this;
+                },
+
+                dispose: function() {
+                        delete this.parent;
+                        delete this.selector;
+
+                        _.chain( this._views ).flatten().invoke('dispose');
+                        this._views = [];
+                },
+
+                replace: function( $target, els ) {
+                        if ( this.view.replace )
+                                return this.view.replace( $target, els );
+
+                        $target.html( els );
+                },
+
+                attach: function( $target, els ) {
+                        if ( this.view.attach )
+                                return this.view.attach( $target, els );
+
+                        $target.append( els );
+                }
+        });
+
+        // wp.media.View
+        // -------------
+        //
+        // The base view class.
+        media.View = Backbone.View.extend({
+                constructor: function() {
+                        this.views = new media.Views( this, this.views );
+                        Backbone.View.apply( this, arguments );
+                },
+
+                dispose: function() {
+                        // Undelegating events, removing events from the model, and
+                        // removing events from the controller mirror the code for
+                        // `Backbone.View.dispose` in Backbone master.
+                        this.undelegateEvents();
+
+                        if ( this.model && this.model.off )
+                                this.model.off( null, null, this );
+
+                        if ( this.collection && this.collection.off )
+                                this.collection.off( null, null, this );
+
+                        // Recursively dispose child views.
+                        if ( this.views )
+                                this.views.dispose();
+
+                        return this;
+                },
+
+                remove: function() {
+                        this.dispose();
+                        return Backbone.View.prototype.remove.apply( this, arguments );
+                }
+        });
+
</ins><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Frame
</span><span class="cx">          */
</span><del>-        media.view.Frame = Backbone.View.extend({
-
</del><ins>+        media.view.Frame = media.View.extend({
</ins><span class="cx">                 initialize: function() {
</span><span class="cx">                         this._createRegions();
</span><span class="cx">                         this._createStates();
</span><span class="lines">@@ -592,7 +722,8 @@
</span><span class="cx">                         _.each( this.regions, function( region ) {
</span><span class="cx">                                 this[ region ] = new media.controller.Region({
</span><span class="cx">                                         controller: this,
</span><del>-                                        id: region
</del><ins>+                                        id: region,
+                                        selector: '.media-frame-' + region
</ins><span class="cx">                                 });
</span><span class="cx">                         }, this );
</span><span class="cx">                 },
</span><span class="lines">@@ -610,14 +741,11 @@
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="cx">                 render: function() {
</span><del>-                        var els = _.map( this.regions, function( region ) {
-                                        return this[ region ].view().el;
-                                }, this );
</del><ins>+                        if ( ! this.template )
+                                return;
</ins><span class="cx">
</span><del>-                        // Detach the current views to maintain event bindings.
-                        $( els ).detach();
-                        this.$el.html( els );
-
</del><ins>+                        this.$el.html( this.template( this.options ) );
+                        this.views.render();
</ins><span class="cx">                         return this;
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="lines">@@ -635,6 +763,7 @@
</span><span class="cx">          */
</span><span class="cx">         media.view.MediaFrame = media.view.Frame.extend({
</span><span class="cx">                 className: 'media-frame',
</span><ins>+                template: media.template('media-frame'),
</ins><span class="cx">                 regions: ['menu','content','sidebar','toolbar'],
</span><span class="cx">
</span><span class="cx">                 initialize: function() {
</span><span class="lines">@@ -1084,7 +1213,7 @@
</span><span class="cx">                         media.view.MediaFrame.Select.prototype.mainMenu.call( this, { silent: true });
</span><span class="cx">
</span><span class="cx">                         this.menu.view().add({
</span><del>-                                separateLibrary: new Backbone.View({
</del><ins>+                                separateLibrary: new media.View({
</ins><span class="cx">                                         className: 'separator',
</span><span class="cx">                                         priority: 60
</span><span class="cx">                                 }),
</span><span class="lines">@@ -1112,7 +1241,7 @@
</span><span class="cx">                                                                 frame.close();
</span><span class="cx">                                                 }
</span><span class="cx">                                         },
</span><del>-                                        separateCancel: new Backbone.View({
</del><ins>+                                        separateCancel: new media.View({
</ins><span class="cx">                                                 className: 'separator',
</span><span class="cx">                                                 priority: 40
</span><span class="cx">                                         }),
</span><span class="lines">@@ -1149,7 +1278,7 @@
</span><span class="cx">                                                                 frame.close();
</span><span class="cx">                                                 }
</span><span class="cx">                                         },
</span><del>-                                        separateCancel: new Backbone.View({
</del><ins>+                                        separateCancel: new media.View({
</ins><span class="cx">                                                 className: 'separator',
</span><span class="cx">                                                 priority: 40
</span><span class="cx">                                         }),
</span><span class="lines">@@ -1369,7 +1498,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Modal
</span><span class="cx">          */
</span><del>-        media.view.Modal = Backbone.View.extend({
</del><ins>+        media.view.Modal = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 template: media.template('media-modal'),
</span><span class="cx">
</span><span class="lines">@@ -1445,7 +1574,7 @@
</span><span class="cx">
</span><span class="cx">         // wp.media.view.UploaderWindow
</span><span class="cx">         // ----------------------------
</span><del>-        media.view.UploaderWindow = Backbone.View.extend({
</del><ins>+        media.view.UploaderWindow = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'uploader-window',
</span><span class="cx">                 template: media.template('uploader-window'),
</span><span class="lines">@@ -1524,7 +1653,7 @@
</span><span class="cx">                 }
</span><span class="cx">         });
</span><span class="cx">
</span><del>-        media.view.UploaderInline = Backbone.View.extend({
</del><ins>+        media.view.UploaderInline = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'uploader-inline',
</span><span class="cx">                 template: media.template('uploader-inline'),
</span><span class="lines">@@ -1580,7 +1709,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Toolbar
</span><span class="cx">          */
</span><del>-        media.view.Toolbar = Backbone.View.extend({
</del><ins>+        media.view.Toolbar = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'media-toolbar',
</span><span class="cx">
</span><span class="lines">@@ -1816,7 +1945,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Button
</span><span class="cx">          */
</span><del>-        media.view.Button = Backbone.View.extend({
</del><ins>+        media.view.Button = media.View.extend({
</ins><span class="cx">                 tagName: 'a',
</span><span class="cx">                 className: 'media-button',
</span><span class="cx">                 attributes: { href: '#' },
</span><span class="lines">@@ -1892,7 +2021,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.ButtonGroup
</span><span class="cx">          */
</span><del>-        media.view.ButtonGroup = Backbone.View.extend({
</del><ins>+        media.view.ButtonGroup = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'button-group button-large media-button-group',
</span><span class="cx">
</span><span class="lines">@@ -1920,15 +2049,14 @@
</span><span class="cx">          * wp.media.view.PriorityList
</span><span class="cx">          */
</span><span class="cx">
</span><del>-        media.view.PriorityList = Backbone.View.extend({
</del><ins>+        media.view.PriorityList = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">
</span><span class="cx">                 initialize: function() {
</span><span class="cx">                         this.controller = this.options.controller;
</span><span class="cx">                         this._views = {};
</span><span class="cx">
</span><del>-                        this.add( _.extend( {}, this.views, this.options.views ), { silent: true });
-                        delete this.views;
</del><ins>+                        this.add( _.extend( {}, this._views, this.options.views ), { silent: true });
</ins><span class="cx">                         delete this.options.views;
</span><span class="cx">
</span><span class="cx">                         if ( ! this.options.silent )
</span><span class="lines">@@ -1993,7 +2121,7 @@
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="cx">                 toView: function( options ) {
</span><del>-                        return new Backbone.View( options );
</del><ins>+                        return new media.View( options );
</ins><span class="cx">                 }
</span><span class="cx">         });
</span><span class="cx">
</span><span class="lines">@@ -2026,7 +2154,7 @@
</span><span class="cx">                 }
</span><span class="cx">         });
</span><span class="cx">
</span><del>-        media.view.MenuItem = Backbone.View.extend({
</del><ins>+        media.view.MenuItem = media.View.extend({
</ins><span class="cx">                 tagName: 'li',
</span><span class="cx">                 className: 'media-menu-item',
</span><span class="cx">
</span><span class="lines">@@ -2065,7 +2193,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Attachment
</span><span class="cx">          */
</span><del>-        media.view.Attachment = Backbone.View.extend({
</del><ins>+        media.view.Attachment = media.View.extend({
</ins><span class="cx">                 tagName: 'li',
</span><span class="cx">                 className: 'attachment',
</span><span class="cx">                 template: media.template('attachment'),
</span><span class="lines">@@ -2263,7 +2391,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Attachments
</span><span class="cx">          */
</span><del>-        media.view.Attachments = Backbone.View.extend({
</del><ins>+        media.view.Attachments = media.View.extend({
</ins><span class="cx">                 tagName: 'ul',
</span><span class="cx">                 className: 'attachments',
</span><span class="cx">                 template: media.template('attachments-css'),
</span><span class="lines">@@ -2454,7 +2582,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Search
</span><span class="cx">          */
</span><del>-        media.view.Search = Backbone.View.extend({
</del><ins>+        media.view.Search = media.View.extend({
</ins><span class="cx">                 tagName: 'input',
</span><span class="cx">                 className: 'search',
</span><span class="cx">
</span><span class="lines">@@ -2487,7 +2615,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.AttachmentsBrowser
</span><span class="cx">          */
</span><del>-        media.view.AttachmentsBrowser = Backbone.View.extend({
</del><ins>+        media.view.AttachmentsBrowser = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'attachments-browser',
</span><span class="cx">
</span><span class="lines">@@ -2515,7 +2643,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         if ( this.options.sortable ) {
</span><del>-                                this.toolbar.set( 'dragInfo', new Backbone.View({
</del><ins>+                                this.toolbar.set( 'dragInfo', new media.View({
</ins><span class="cx">                                         el: $( '<div class="instructions">' + l10n.dragInfo + '</div>' )[0],
</span><span class="cx">                                         priority: -40
</span><span class="cx">                                 }) );
</span><span class="lines">@@ -2559,7 +2687,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.SelectionPreview
</span><span class="cx">          */
</span><del>-        media.view.SelectionPreview = Backbone.View.extend({
</del><ins>+        media.view.SelectionPreview = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'selection-preview',
</span><span class="cx">                 template: media.template('media-selection-preview'),
</span><span class="lines">@@ -2610,7 +2738,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Selection
</span><span class="cx">          */
</span><del>-        media.view.Selection = Backbone.View.extend({
</del><ins>+        media.view.Selection = media.View.extend({
</ins><span class="cx">                 tagName: 'div',
</span><span class="cx">                 className: 'media-selection',
</span><span class="cx">                 template: media.template('media-selection'),
</span><span class="lines">@@ -2707,7 +2835,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Settings
</span><span class="cx">          */
</span><del>-        media.view.Settings = Backbone.View.extend({
</del><ins>+        media.view.Settings = media.View.extend({
</ins><span class="cx">                 events: {
</span><span class="cx">                         'click button': 'updateHandler',
</span><span class="cx">                         'change input': 'updateHandler',
</span><span class="lines">@@ -2853,7 +2981,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.AttachmentCompat
</span><span class="cx">          */
</span><del>-        media.view.AttachmentCompat = Backbone.View.extend({
</del><ins>+        media.view.AttachmentCompat = media.View.extend({
</ins><span class="cx">                 tagName: 'form',
</span><span class="cx">                 className: 'compat-item',
</span><span class="cx">
</span><span class="lines">@@ -2901,7 +3029,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Iframe
</span><span class="cx">          */
</span><del>-        media.view.Iframe = Backbone.View.extend({
</del><ins>+        media.view.Iframe = media.View.extend({
</ins><span class="cx">                 className: 'media-iframe',
</span><span class="cx">
</span><span class="cx">                 initialize: function() {
</span><span class="lines">@@ -2917,7 +3045,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.Embed
</span><span class="cx">          */
</span><del>-        media.view.Embed = Backbone.View.extend({
</del><ins>+        media.view.Embed = media.View.extend({
</ins><span class="cx">                 className: 'media-embed',
</span><span class="cx">
</span><span class="cx">                 initialize: function() {
</span><span class="lines">@@ -2928,7 +3056,7 @@
</span><span class="cx">                                 model: this.model
</span><span class="cx">                         }).render();
</span><span class="cx">
</span><del>-                        this._settings = new Backbone.View();
</del><ins>+                        this._settings = new media.View();
</ins><span class="cx">                         this.refresh();
</span><span class="cx">                         this.model.on( 'change:type', this.refresh, this );
</span><span class="cx">                 },
</span><span class="lines">@@ -2970,7 +3098,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * wp.media.view.EmbedUrl
</span><span class="cx">          */
</span><del>-        media.view.EmbedUrl = Backbone.View.extend({
</del><ins>+        media.view.EmbedUrl = media.View.extend({
</ins><span class="cx">                 tagName: 'label',
</span><span class="cx">                 className: 'embed-url',
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/media.php (22647 => 22648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/media.php        2012-11-18 23:49:54 UTC (rev 22647)
+++ trunk/wp-includes/media.php        2012-11-19 00:36:47 UTC (rev 22648)
</span><span class="lines">@@ -1391,6 +1391,13 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_print_media_templates( $attachment ) {
</span><span class="cx">         ?>
</span><ins>+        <script type="text/html" id="tmpl-media-frame">
+                <div class="media-frame-menu"></div>
+                <div class="media-frame-content"></div>
+                <div class="media-frame-sidebar"></div>
+                <div class="media-frame-toolbar"></div>
+        </script>
+
</ins><span class="cx">         <script type="text/html" id="tmpl-media-modal">
</span><span class="cx">                 <div class="media-modal">
</span><span class="cx">                         <h3 class="media-modal-title">{{ data.title }}</h3>
</span></span></pre>
</div>
</div>
</body>
</html>