Changeset 3979 for BreadCrumbs

Show
Ignore:
Timestamp:
05/13/09 13:39:10 (3 years ago)
Author:
skruk
Message:

added getText() to provide compatibility fallback
tested on FF2, FF3, Safari4, Opera, IE8
unfixed: IE6/7

Location:
BreadCrumbs/js
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • BreadCrumbs/js/breadcrumbslist.js

    r3978 r3979  
    9797                return {  
    9898                        fontSize: parseInt(cont.getStyle("font-size")), 
    99                         len:  cont.textContent.length,  
    100                         text: cont.textContent 
     99                        len:  cont.getText().length,  
     100                        text: cont.getText() 
    101101                }; 
    102102                 
     
    131131                var span = document.createElement("span"); 
    132132                span.style.fontSize = maxEl.fontSize; 
    133                 span.innerHTML = maxEl.text; 
     133                span.innerHTML = maxEl.text.gsub(/\s+/, " "); 
    134134                span.hide(); 
    135135                $$("body")[0].appendChild(span); 
  • BreadCrumbs/js/crumb.js

    r3978 r3979  
    114114                        var len = Math.floor(this.dimensions.width/fsize); 
    115115 
    116                         console.log("TEXT: "+this.text); 
    117                          
    118116                        if ( len > this.text.length ) 
    119117                        { 
     
    183181                } 
    184182 
    185                 console.log("CRUMB: "+this.acrumb.textContent); 
    186                  
    187                 this.text = ( this.acrumb != null ) ? ( this.acrumb.textContent ) : ""; 
     183                this.text = ( this.acrumb != null ) ? ( this.acrumb.getText() ) : ""; 
    188184                 
    189185                Event.observe(this.licrumb, "mouseover", this.breadcrumbs.focusOn.bindAsEventListener(this.breadcrumbs, this, this)); 
     
    191187        } 
    192188}); 
     189 
     190Object.extend(Element.prototype, { 
     191        getText: function(){ 
     192                return (!Object.isUndefined(this.textContent)) ? this.textContent : this.innerText; 
     193        } 
     194}); 
     195