</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.1
- * 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
*/
-<div id="cls-Ext.Element"></div>/**
+/**
* @class Ext.Element
*/
Ext.Element.addMethods(function(){
// local style camelizing for speed
- var propCache = {},
+ var supports = Ext.supports,
+ propCache = {},
camelRe = /(-[a-z])/gi,
- classReCache = {},
view = document.defaultView,
- propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat',
opacityRe = /alpha\(opacity=(.*)\)/i,
trimRe = /^\s+|\s+$/g,
+ EL = Ext.Element,
spacesRe = /\s+/,
wordsRe = /\w/g,
- EL = Ext.Element,
PADDING = "padding",
MARGIN = "margin",
BORDER = "border",
}
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 {
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;
} :
color = (typeof prefix != 'undefined') ? prefix : '#',
h;
- if(!v || /transparent|inherit/.test(v)){
+ if(!v || (/transparent|inherit/.test(v))) {
return defaultValue;
}
if(/^r/.test(v)){
* @return {Ext.Element} this
*/
setStyle : function(prop, value){
- var tmp,
- style,
- camel;
+ var tmp, style;
+
if (typeof prop != 'object') {
tmp = {};
tmp[prop] = value;
},
margins : margins
- }
+ };
}()
);
</pre>