Changeset 8505


Ignore:
Timestamp:
May 24, 2009, 1:29:03 AM (12 years ago)
Author:
charles
Message:

(trunk web) #2052: when adding new torrents to the list (such as on startup), batch together all the additions to prevent unnecessary dom reflows

Location:
trunk/web/javascript
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/javascript/torrent.js

    r8504 r8505  
    77 */
    88
    9 function Torrent(controller,data) {
    10     this.initialize(controller,data);
     9function Torrent(domParent,controller,data) {
     10    this.initialize(domParent,controller,data);
    1111}
    1212
     
    2424         * Constructor
    2525         */
    26         initialize: function(controller, data) {
     26        initialize: function(domParent,controller, data) {
    2727                this._id            = data.id;
    2828                this._is_private    = data.isPrivate;
     
    103103               
    104104                // insert the element
    105                 this._controller._torrent_list.appendChild( top_e );
     105                domParent.appendChild(top_e);
    106106
    107107                this.initializeTorrentFilesInspectorGroup();
  • trunk/web/javascript/transmission.js

    r8502 r8505  
    11551155
    11561156        addTorrents: function( new_torrents ){
    1157                 var tr = this;
    1158 
    1159                 $.each( new_torrents, function(){
    1160                         var torrent = this;
    1161                         tr._torrents.push( new Torrent( tr, torrent ) );
    1162                 });
    1163 
    1164                 this.refilter();
     1157                var fragment = document.createDocumentFragment( );
     1158                for( var i=0, row; row=new_torrents[i]; ++i )
     1159                        this._torrents.push( new Torrent( fragment, this, row ) );
     1160                this._torrent_list.appendChild( fragment );
     1161                this.refilter( );
    11651162        },
    11661163
Note: See TracChangeset for help on using the changeset viewer.