Changeset 5313


Ignore:
Timestamp:
Apr 16, 2010, 8:36:35 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1483: The "Display long text=On click" option doens't work in Internet explorer 8

The problem was that IE no longer provides size information for hidden parts of the document. We used to hide the document while checking the texts because performance was very bad otherwise. The performance issue has partly been improved by first checking all texts and then fixing them in a separate step instead of fixing each text immediately as it is found, but performance in IE is still about 5 times slower than in Firefox.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.15-stable/www/include/scripts/main.js

    r5288 r5313  
    27702770  {
    27712771    this.tags = Main.getElementsByTagAndClassName(tagName, className);
    2772     if (this.tags.length > 300)
    2773     {
    2774       this.checkAllDelayed();
    2775       return;
    2776     }
    2777     if (Browser.isIE)
    2778     {
    2779       document.body.style.display = 'none';
    2780     }
    27812772    for (var i = 0; i < this.tags.length; i++)
    27822773    {
    27832774      this.checkTag(this.tags[i]);
    27842775    }
    2785     if (Browser.isIE)
    2786     {
    2787       document.body.style.display = 'block';
    2788     }
    2789   }
    2790  
    2791   this.checkAllDelayed = function()
    2792   {
    2793     var self = this;
    2794     var f = function()
    2795     {
    2796       if (self.checkNextTag()) setTimeout(f, 5);
    2797     };
    2798     setTimeout(f, 5);
    2799   }
    2800  
    2801   this.checkNextTag = function()
    2802   {
    2803     if (this.tags.length <= this.nextTag) return false;
    2804     this.checkTag(this.tags[this.nextTag]);
    2805     this.nextTag++;
    2806     return true;
     2776    for (var i = 0; i < this.tags.length; i++)
     2777    {
     2778      this.fixTag(this.tags[i]);
     2779    }
    28072780  }
    28082781 
     
    28112784    var isWidthOverflowed = tag.clientWidth < tag.scrollWidth;
    28122785    var isHeightOverflowed = tag.clientHeight +5 < tag.scrollHeight;
    2813     var isOverflowed = isWidthOverflowed || isHeightOverflowed;
    2814    
     2786    //alert("checkTag: " + tag + ':' + ':' + tag.clientWidth + ':' + tag.scrollWidth + ':' + tag.clientHeight + ':' + tag.scrollHeight);
     2787    tag.isWidthOverflowed = isWidthOverflowed;
     2788    tag.isHeightOverflowed = isHeightOverflowed;
     2789    tag.isOverflowed = isWidthOverflowed || isHeightOverflowed;
     2790  }
     2791 
     2792  this.fixTag = function(tag)
     2793  {
    28152794    var className = 'constrained';
    2816     if (isOverflowed)
     2795    if (tag.isOverflowed)
    28172796    {
    28182797      className += ' overflowed';
    2819       tag.isWidthOverflowed = isWidthOverflowed;
    2820       tag.isHeightOverflowed = isHeightOverflowed;
    28212798      var self = this;
    28222799      var onClickListener = function() { self.showOverflowedText(tag); };
Note: See TracChangeset for help on using the changeset viewer.