Author: nbelaevski
Date: 2009-05-08 12:43:07 -0400 (Fri, 08 May 2009)
New Revision: 14085
Modified:
trunk/framework/impl/src/main/javascript/jquery/jquery-1.3.2.js
Log:
https://jira.jboss.org/jira/browse/RF-7056
Modified: trunk/framework/impl/src/main/javascript/jquery/jquery-1.3.2.js
===================================================================
--- trunk/framework/impl/src/main/javascript/jquery/jquery-1.3.2.js 2009-05-08 16:41:25
UTC (rev 14084)
+++ trunk/framework/impl/src/main/javascript/jquery/jquery-1.3.2.js 2009-05-08 16:43:07
UTC (rev 14085)
@@ -4339,53 +4339,74 @@
this[0][ method ];
};
});
-// Create innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function(i, name){
- var tl = i ? "Left" : "Top", // top or left
- br = i ? "Right" : "Bottom", // bottom or right
- lower = name.toLowerCase();
-
- // innerHeight and innerWidth
- jQuery.fn["inner" + name] = function(){
- return this[0] ?
- jQuery.css( this[0], lower, false, "padding" ) :
- null;
+(function() {
+ var safariCompatMode;
+ var getCompatMode = function() {
+ var compatMode = document.compatMode;
+ if (!compatMode && jQuery.browser.safari) {
+ if (!safariCompatMode) {
+ //detect compatMode as described in
http://code.google.com/p/doctype/wiki/ArticleCompatMode
+ var width = jQuery(document.createElement("div")).attr('style',
'position:absolute;width:0;height:0;width:1')
+ .css('width');
+ safariCompatMode = compatMode = (width == '1px' ? 'BackCompat' :
'CSS1Compat');
+ } else {
+ compatMode = safariCompatMode;
+ }
+ }
+
+ return compatMode;
};
-
- // outerHeight and outerWidth
- jQuery.fn["outer" + name] = function(margin) {
- return this[0] ?
- jQuery.css( this[0], lower, false, margin ? "margin" : "border" )
:
- null;
- };
- var type = name.toLowerCase();
+
+ // Create innerHeight, innerWidth, outerHeight and outerWidth methods
+ jQuery.each([ "Height", "Width" ], function(i, name){
- jQuery.fn[ type ] = function( size ) {
- // Get window width or height
- return this[0] == window ?
- // Everyone else use document.documentElement or document.body depending on Quirks vs
Standards mode
- document.compatMode == "CSS1Compat" && document.documentElement[
"client" + name ] ||
- document.body[ "client" + name ] :
+ var tl = i ? "Left" : "Top", // top or left
+ br = i ? "Right" : "Bottom", // bottom or right
+ lower = name.toLowerCase();
- // Get document width or height
- this[0] == document ?
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- Math.max(
- document.documentElement["client" + name],
- document.body["scroll" + name],
document.documentElement["scroll" + name],
- document.body["offset" + name],
document.documentElement["offset" + name]
- ) :
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function(){
+ return this[0] ?
+ jQuery.css( this[0], lower, false, "padding" ) :
+ null;
+ };
- // Get or set width or height on the element
- size === undefined ?
- // Get width or height on the element
- (this.length ? jQuery.css( this[0], type ) : null) :
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function(margin) {
+ return this[0] ?
+ jQuery.css( this[0], lower, false, margin ? "margin" : "border" )
:
+ null;
+ };
+
+ var type = name.toLowerCase();
- // Set the width or height on the element (default to pixels if value is unitless)
- this.css( type, typeof size === "string" ? size : size + "px"
);
- };
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ return this[0] == window ?
+ // Everyone else use document.documentElement or document.body depending on Quirks vs
Standards mode
+ getCompatMode() == "CSS1Compat" && document.documentElement[
"client" + name ] ||
+ document.body[ "client" + name ] :
-});
+ // Get document width or height
+ this[0] == document ?
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ document.documentElement["client" + name],
+ document.body["scroll" + name],
document.documentElement["scroll" + name],
+ document.body["offset" + name],
document.documentElement["offset" + name]
+ ) :
+
+ // Get or set width or height on the element
+ size === undefined ?
+ // Get width or height on the element
+ (this.length ? jQuery.css( this[0], type ) : null) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, typeof size === "string" ? size : size + "px"
);
+ };
+
+ });
+}());
})();