Changeset 11955

Show
Ignore:
Timestamp:
01/04/08 13:01:53 (8 months ago)
Author:
peller
Message:

Fixes bidi in quirks mode (thanks, makin) Fixes #3721 and backs out change from [11944] Refs #5509. Plus some size reductions. !strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/html.js

    r11944 r11955  
    4141                        }else{ 
    4242                                var eles = _d.all[id]; 
    43                                 if(!eles){ return; } 
    44                                 if(!eles.length){ return eles; } 
     43                                if(!eles || !eles.length){ return eles; } 
    4544                                // if more than 1, choose first with the correct id 
    4645                                var i=0; 
     
    5554}else{ 
    5655        dojo.byId = function(id, doc){ 
    57                 if(dojo.isString(id)){ 
    58                         return (doc || dojo.doc).getElementById(id); 
    59                 }else{ 
    60                         return id; // DomNode 
    61                 } 
     56                return dojo.isString(id) ? (doc || dojo.doc).getElementById(id) : id; // DomNode 
    6257        } 
    6358} 
     
    190185                                if(refNode.firstChild){ 
    191186                                        return _insertBefore(node, refNode.firstChild); //      boolean 
    192                                 }else{ 
    193                                         refNode.appendChild(node); 
    194                                         return true;    //      boolean 
    195187                                } 
    196                                 break; 
     188                                // else fallthrough... 
    197189                        default: // aka: last 
    198190                                refNode.appendChild(node); 
     
    222214                var _dcm = document.compatMode; 
    223215                // client code may have to adjust if compatMode varies across iframes 
    224                 dojo.boxModel = (_dcm=="BackCompat")||(_dcm=="QuirksMode")||(dojo.isIE<6) ? "border-box" : "content-box"; 
     216                dojo.boxModel = _dcm == "BackCompat" || _dcm == "QuirksMode" || dojo.isIE<6 ? "border-box" : "content-box"; // FIXME: remove IE < 6 support? 
    225217        } 
    226218 
     
    334326        =====*/ 
    335327 
    336         dojo._getOpacity = (dojo.isIE ? function(node){ 
    337                         try{ 
    338                                 return (node.filters.alpha.opacity / 100); // Number 
    339                         }catch(e){ 
    340                                 return 1; // Number 
    341                         } 
    342                 } : function(node){ 
    343                         return dojo.getComputedStyle(node).opacity; 
    344                 } 
    345         ); 
     328        dojo._getOpacity = dojo.isIE ? function(node){ 
     329                try{ 
     330                        return node.filters.alpha.opacity / 100; // Number 
     331                }catch(e){ 
     332                        return 1; // Number 
     333                } 
     334        } : function(node){ 
     335                return dojo.getComputedStyle(node).opacity; 
     336        }; 
    346337 
    347338        /*===== 
     
    359350        =====*/ 
    360351 
    361         dojo._setOpacity = (dojo.isIE ? function(/*DomNode*/node, /*Number*/opacity){ 
    362                         if(opacity == 1){ 
    363                                 // on IE7 Alpha(Filter opacity=100) makes text look fuzzy so remove it altogether (bug #2661) 
    364                                 node.style.cssText = node.style.cssText.replace(/FILTER:[^;]*;?/i, ""); 
    365                                 if(node.nodeName.toLowerCase() == "tr"){ 
    366                                         dojo.query("> td", node).forEach(function(i){ 
    367                                                 i.style.cssText = i.style.cssText.replace(/FILTER:[^;]*;?/i, ""); 
    368                                         }); 
    369                                 } 
    370                         }else{ 
    371                                 var o = "Alpha(Opacity="+(opacity*100)+")"; 
    372                                 node.style.filter = o; 
    373                         } 
     352        dojo._setOpacity = dojo.isIE ? function(/*DomNode*/node, /*Number*/opacity){ 
     353                if(opacity == 1){ 
     354                        // on IE7 Alpha(Filter opacity=100) makes text look fuzzy so remove it altogether (bug #2661) 
     355                        var filterRE = /FILTER:[^;]*;?/i; 
     356                        node.style.cssText = node.style.cssText.replace(filterRE, ""); 
    374357                        if(node.nodeName.toLowerCase() == "tr"){ 
    375358                                dojo.query("> td", node).forEach(function(i){ 
    376                                         i.style.filter = o; 
     359                                        i.style.cssText = i.style.cssText.replace(filterRE, ""); 
    377360                                }); 
    378361                        } 
    379                         return opacity; 
    380                 } : function(node, opacity){ 
    381                         return node.style.opacity = opacity; 
    382                 } 
    383         ); 
     362                }else{ 
     363                        var o = "Alpha(Opacity="+ opacity * 100 +")"; 
     364                        node.style.filter = o; 
     365                } 
     366                if(node.nodeName.toLowerCase() == "tr"){ 
     367                        dojo.query("> td", node).forEach(function(i){ 
     368                                i.style.filter = o; 
     369                        }); 
     370                } 
     371                return opacity; 
     372        } : function(node, opacity){ 
     373                return node.style.opacity = opacity; 
     374        }; 
    384375 
    385376        var _pixelNamesCache = { 
     
    397388                        } 
    398389                        if( 
    399                                 (type.indexOf("margin") >= 0) || 
    400                                 // (type.indexOf("border") >= 0) || 
    401                                 (type.indexOf("padding") >= 0) || 
    402                                 (type.indexOf("width") >= 0) || 
    403                                 (type.indexOf("height") >= 0) || 
    404                                 (type.indexOf("max") >= 0) || 
    405                                 (type.indexOf("min") >= 0) || 
    406                                 (type.indexOf("offset") >= 0) 
     390                                type.indexOf("margin") >= 0 || 
     391                                // type.indexOf("border") >= 0 || 
     392                                type.indexOf("padding") >= 0 || 
     393                                type.indexOf("width") >= 0 || 
     394                                type.indexOf("height") >= 0 || 
     395                                type.indexOf("max") >= 0 || 
     396                                type.indexOf("min") >= 0 || 
     397                                type.indexOf("offset") >= 0 
    407398                        ){ 
    408399                                _pixelNamesCache[type] = true; 
     
    669660                //      u: optional. unit measure to use for other measures. Defaults to "px". 
    670661                u = u || "px"; 
    671                 with(node.style){ 
    672                         if(!isNaN(l)){ left = l+u; } 
    673                         if(!isNaN(t)){ top = t+u; } 
    674                         if(w>=0){ width = w+u; } 
    675                         if(h>=0){ height = h+u; } 
    676                 } 
     662                var s = node.style; 
     663                if(!isNaN(l)){ s.left = l+u; } 
     664                if(!isNaN(t)){ s.top = t+u; } 
     665                if(w>=0){ s.width = w+u; } 
     666                if(h>=0){ s.height = h+u; } 
    677667        } 
    678668 
     
    826816 
    827817                var de = dojo.doc.documentElement; 
    828                 if(dojo.isIE >= 7){ 
    829                         return {x: de.getBoundingClientRect().left, y: de.getBoundingClientRect().top}; // Object 
    830                 }else{ 
     818//FIXME: use this instead?                      var de = d.compatMode == "BackCompat" ? d.body : d.documentElement; 
     819 
     820                return (dojo.isIE >= 7) ? 
     821                        {x: de.getBoundingClientRect().left, y: de.getBoundingClientRect().top} 
     822                : 
    831823                        // IE 6.0 
    832                         return {x: dojo._isBodyLtr() || window.parent == window ? 
     824                        {x: dojo._isBodyLtr() || window.parent == window ? 
    833825                                de.clientLeft : de.offsetWidth - de.clientWidth - de.clientLeft,  
    834826                                y: de.clientTop}; // Object 
    835                 } 
    836827        }; 
    837828         
     
    841832                // must call this function to fix this error, otherwise the position 
    842833                // will offset to right when there is a horizontal scrollbar. 
     834                var d = dojo.doc; 
    843835                if(dojo.isIE && !dojo._isBodyLtr()){ 
    844                         var de = dojo.doc.body; 
    845                         return de.clientWidth - de.offsetWidth; // Integer 
     836                        var de = d.compatMode == "BackCompat" ? d.body : d.documentElement; 
     837                        return scrollLeft + de.clientWidth - de.scrollWidth; // Integer 
    846838                } 
    847839                return scrollLeft; // Integer 
    848840        } 
    849          
     841 
    850842        dojo._abs = function(/*DomNode*/node, /*Boolean?*/includeScroll){ 
    851843                //      summary: