Bug Tracker

Changes between Version 1 and Version 2 of Ticket #7871, comment 2


Ignore:
Timestamp:
Jan 1, 2011, 7:44:57 PM (10 years ago)
Author:
SLogic
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7871, comment 2

    v1 v2  
    5959It will fix problem in 1.4.4 , and it will get "left:30px" for block#2 in my example, like jQuery 1.4.2.
    6060 But only I don't know which method is better "ret = jQuery.style( elem, name );" of "ret = computedStyle.getPropertyValue( name );". If first - than it will only good changes for 1.4.4. If second way is faster - than it will be more slower, after change. But more right :)
     61
     62
     63Update:
     64Maybe even more better to do that way:
     65{{{
     66  #!js
     67if ( document.defaultView && document.defaultView.getComputedStyle ) {
     68        getComputedStyle = function( elem, newName, name ) {
     69                var ret, defaultView, computedStyle, style = elem.style;
     70
     71               
     72
     73                if ( !(defaultView = elem.ownerDocument.defaultView) ) {
     74                        return undefined;
     75                }
     76
     77                if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
     78                        if (style && style[ name ] ) {
     79                                ret = jQuery.style( elem, name );
     80                        } else {
     81                        name = name.replace( rupper, "-$1" ).toLowerCase();
     82                        ret = computedStyle.getPropertyValue( name );
     83                        }
     84
     85                }
     86
     87                return ret;
     88        };
     89}
     90  }}}
     91
     92It's resolve other broken things by 1.4.4 (and 1.4.3), for example it's fix the http://bugs.jquery.com/ticket/7746
     93This example will work even better than with 1.4.2 because now with that fix for 1.4.4 we can get all border-colors of the all 4 blocks(only 2 block in 1.4.2+FF, and 0 blocks in 1.4.4+FF)
     94Also I checked Opera and IE, all works fine with that fix. But as I said before, maybe it's not the fastest way, but it shows where problem is.