X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/b37ceabb82336ee82757cd32efe353cfab8ec267..f5240829880f87e0cf581c6a296e436fdef0ef80:/src/ext-core/src/core/Element.style.js diff --git a/src/ext-core/src/core/Element.style.js b/src/ext-core/src/core/Element.style.js index 2c402e57..c15e6c2a 100644 --- a/src/ext-core/src/core/Element.style.js +++ b/src/ext-core/src/core/Element.style.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.2.2 + * Ext JS Library 3.3.0 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -9,12 +9,13 @@ */ Ext.Element.addMethods(function(){ // local style camelizing for speed - var propCache = {}, + var supports = Ext.supports, + propCache = {}, camelRe = /(-[a-z])/gi, view = document.defaultView, - propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat', opacityRe = /alpha\(opacity=(.*)\)/i, trimRe = /^\s+|\s+$/g, + EL = Ext.Element, spacesRe = /\s+/, wordsRe = /\w/g, PADDING = "padding", @@ -45,7 +46,7 @@ Ext.Element.addMethods(function(){ } function chkCache(prop) { - return propCache[prop] || (propCache[prop] = prop == 'float' ? propFloat : prop.replace(camelRe, camelFn)); + return propCache[prop] || (propCache[prop] = prop == 'float' ? (supports.cssFloat ? 'cssFloat' : 'styleFloat') : prop.replace(camelRe, camelFn)); } return { @@ -197,29 +198,26 @@ Ext.Element.addMethods(function(){ v, cs, out, - display, - wk = Ext.isWebKit, display; if(el == document){ return null; } prop = chkCache(prop); - // Fix bug caused by this: https://bugs.webkit.org/show_bug.cgi?id=13343 - if(wk && (/marginRight/.test(prop))) { - display = this.getStyle('display'); - el.style.display = 'inline-block'; - } out = (v = el.style[prop]) ? v : (cs = view.getComputedStyle(el, "")) ? cs[prop] : null; - - // Webkit returns rgb values for transparent. - if(wk){ - if(out == 'rgba(0, 0, 0, 0)'){ - out = 'transparent'; - }else if(display){ - el.style.display = display; - } + + // Ignore cases when the margin is correctly reported as 0, the bug only shows + // numbers larger. + if(prop == 'marginRight' && out != '0px' && !supports.correctRightMargin){ + display = el.style.display; + el.style.display = 'inline-block'; + out = view.getComputedStyle(el, '').marginRight; + el.style.display = display; + } + + if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.correctTransparentColor){ + out = 'transparent'; } return out; } :