Make WordPress Core

Changeset 23079


Ignore:
Timestamp:
12/05/2012 09:21:17 PM (13 years ago)
Author:
ryan
Message:

Fix uploads in IE9

Props koopersmith
fixes #22762

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/plupload/wp-plupload.js

    r23053 r23079  
    294294        complete: function() {},
    295295        refresh:  function() {
    296             var node, enabled, container;
     296            var node, attached, container, id;
    297297
    298298            if ( this.browser ) {
    299299                node = this.browser[0];
    300300
     301                // Check if the browser node is in the DOM.
    301302                while ( node ) {
    302303                    if ( node === document.body ) {
    303                         enabled = true;
     304                        attached = true;
    304305                        break;
    305306                    }
     
    307308                }
    308309
    309                 this.uploader.disableBrowse( ! enabled );
    310                 // Toggle all auto-created file containers.
    311                 this._container().toggle( enabled );
     310                // If the browser node is not attached to the DOM, use a
     311                // temporary container to house it, as the browser button
     312                // shims require the button to exist in the DOM at all times.
     313                if ( ! attached ) {
     314                    id = 'wp-uploader-browser-' + this.uploader.id;
     315
     316                    container = $( '#' + id );
     317                    if ( ! container.length ) {
     318                        container = $('<div class="wp-uploader-browser" />', {
     319                            id: 'wp-uploader-browser-' + this.uploader.id,
     320                            css: {
     321                                position: 'fixed',
     322                                top: '-1000px',
     323                                left: '-1000px',
     324                                height: 0,
     325                                width: 0
     326                            }
     327                        }).appendTo('body');
     328                    }
     329
     330                    container.append( this.browser );
     331                }
    312332            }
    313333
    314334            this.uploader.refresh();
    315         },
    316 
    317         _container: function() {
    318             var runtime = this.uploader.runtime;
    319 
    320             if ( this._$container && this._$container.length )
    321                 return this._$container;
    322 
    323             if ( 'html4' === runtime )
    324                 return $('[target="' + this.uploader.id + '_iframe"]');
    325 
    326             if ( 'html5' !== runtime && 'flash' !== runtime && 'silverlight' !== runtime )
    327                 return $();
    328 
    329             this._$container = $( '#' + this.uploader.id + '_' + runtime + '_container' );
    330             return this._$container;
    331335        }
    332336    });
Note: See TracChangeset for help on using the changeset viewer.