X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/b37ceabb82336ee82757cd32efe353cfab8ec267..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/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..a99d3e72 100644 --- a/src/ext-core/src/core/Element.style.js +++ b/src/ext-core/src/core/Element.style.js @@ -1,20 +1,21 @@ /*! - * Ext JS Library 3.2.2 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license */ /** * @class Ext.Element */ 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; } :