* Applied patch for #204
authorBrandon Aaron <brandon.aaron@gmail.com>
Sat, 7 Oct 2006 20:06:52 +0000 (20:06 +0000)
committerBrandon Aaron <brandon.aaron@gmail.com>
Sat, 7 Oct 2006 20:06:52 +0000 (20:06 +0000)
* Removed references to $ within dimensions.js

src/dimensions/dimensions.js
src/fx/fx.js
src/jquery/jquery.js

index ce87862..6a7d20a 100644 (file)
@@ -9,21 +9,21 @@
  * If used on window, returns the viewport's (window) height\r
  *\r
  * @example $("#testdiv").height()\r
- * @result "200px"
- *
- * @example $(document).height();
- * @result 800
- *
- * @example $(window).height();
+ * @result "200px"\r
+ *\r
+ * @example $(document).height();\r
+ * @result 800\r
+ *\r
+ * @example $(window).height();\r
  * @result 400\r
  * \r
  * @name height\r
  * @type Object\r
  * @cat Dimensions\r
  */\r
-$.fn.height = function() {\r
-       if ( this.get(0) == window )
-               return self.innerHeight ||
+jQuery.fn.height = function() {\r
+       if ( this.get(0) == window )\r
+               return self.innerHeight ||\r
                        jQuery.boxModel && document.documentElement.clientHeight ||\r
                        document.body.clientHeight;\r
        \r
@@ -31,7 +31,7 @@ $.fn.height = function() {
                return Math.max( document.body.scrollHeight, document.body.offsetHeight );\r
        \r
        return this.css("height");\r
-};
+};\r
 \r
 /**\r
  * Returns the css width value for the first matched element.\r
@@ -39,21 +39,21 @@ $.fn.height = function() {
  * If used on window, returns the viewport's (window) width\r
  *\r
  * @example $("#testdiv").width()\r
- * @result "200px"
- *
- * @example $(document).width();
- * @result 800
- *
- * @example $(window).width();
+ * @result "200px"\r
+ *\r
+ * @example $(document).width();\r
+ * @result 800\r
+ *\r
+ * @example $(window).width();\r
  * @result 400\r
  * \r
  * @name width\r
  * @type Object\r
  * @cat Dimensions\r
  */\r
-$.fn.width = function() {\r
-       if ( this.get(0) == window )
-               return self.innerWidth ||
+jQuery.fn.width = function() {\r
+       if ( this.get(0) == window )\r
+               return self.innerWidth ||\r
                        jQuery.boxModel && document.documentElement.clientWidth ||\r
                        document.body.clientWidth;\r
        \r
@@ -61,7 +61,7 @@ $.fn.width = function() {
                return Math.max( document.body.scrollWidth, document.body.offsetWidth );\r
        \r
        return this.css("width");\r
-};
+};\r
 \r
 /**\r
  * Returns the inner height value (without border) for the first matched element.\r
@@ -75,11 +75,11 @@ $.fn.width = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.innerHeight = function() {\r
-       return this.get(0) == window || this.get(0) == document ?
-               this.height() :
+jQuery.fn.innerHeight = function() {\r
+       return this.get(0) == window || this.get(0) == document ?\r
+               this.height() :\r
                this.get(0).offsetHeight - parseInt(this.css("borderTop") || 0) - parseInt(this.css("borderBottom") || 0);\r
-};
+};\r
 \r
 /**\r
  * Returns the inner width value (without border) for the first matched element.\r
@@ -93,11 +93,11 @@ $.fn.innerHeight = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.innerWidth = function() {\r
-       return this.get(0) == window || this.get(0) == document ?
-               this.width() :
+jQuery.fn.innerWidth = function() {\r
+       return this.get(0) == window || this.get(0) == document ?\r
+               this.width() :\r
                this.get(0).offsetWidth - parseInt(this.css("borderLeft") || 0) - parseInt(this.css("borderRight") || 0);\r
-};
+};\r
 \r
 /**\r
  * Returns the outer height value (including border) for the first matched element.\r
@@ -110,11 +110,11 @@ $.fn.innerWidth = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.outerHeight = function() {\r
-       return this.get(0) == window || this.get(0) == document ?
-               this.height() :
+jQuery.fn.outerHeight = function() {\r
+       return this.get(0) == window || this.get(0) == document ?\r
+               this.height() :\r
                this.get(0).offsetHeight;       \r
-};
+};\r
 \r
 /**\r
  * Returns the outer width value (including border) for the first matched element.\r
@@ -127,11 +127,11 @@ $.fn.outerHeight = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.outerWidth = function() {\r
-       return this.get(0) == window || this.get(0) == document ?
-               this.width() :
+jQuery.fn.outerWidth = function() {\r
+       return this.get(0) == window || this.get(0) == document ?\r
+               this.width() :\r
                this.get(0).offsetWidth;        \r
-};
+};\r
 \r
 /**\r
  * Returns how many pixels the user has scrolled to the right (scrollLeft).\r
@@ -144,14 +144,14 @@ $.fn.outerWidth = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.scrollLeft = function() {\r
-       if ( this.get(0) == window || this.get(0) == document )
-               return self.pageXOffset ||
-                       jQuery.boxModel && document.documentElement.scrollLeft ||
-                       document.body.scrollLeft;
+jQuery.fn.scrollLeft = function() {\r
+       if ( this.get(0) == window || this.get(0) == document )\r
+               return self.pageXOffset ||\r
+                       jQuery.boxModel && document.documentElement.scrollLeft ||\r
+                       document.body.scrollLeft;\r
        \r
        return this.get(0).scrollLeft;\r
-};
+};\r
 \r
 /**\r
  * Returns how many pixels the user has scrolled to the bottom (scrollTop).\r
@@ -164,20 +164,15 @@ $.fn.scrollLeft = function() {
  * @type Number\r
  * @cat Dimensions\r
  */\r
-$.fn.scrollTop = function() {\r
-       if ( this.get(0) == window || this.get(0) == document )
-               return self.pageYOffset ||
-                       jQuery.boxModel && document.documentElement.scrollTop ||
-                       document.body.scrollTop;
+jQuery.fn.scrollTop = function() {\r
+       if ( this.get(0) == window || this.get(0) == document )\r
+               return self.pageYOffset ||\r
+                       jQuery.boxModel && document.documentElement.scrollTop ||\r
+                       document.body.scrollTop;\r
 \r
        return this.get(0).scrollTop;\r
 };\r
 \r
-/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)\r
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) \r
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.\r
- */\r
-\r
 /**\r
  * This returns an object with top, left, width, height, borderLeft,\r
  * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, \r
@@ -253,24 +248,24 @@ $.fn.scrollTop = function() {
  * @cat Dimensions\r
  * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)\r
  */\r
-$.fn.offset = function(refElem) {\r
-       if (!this[0]) throw '$.fn.offset requires an element.';\r
+jQuery.fn.offset = function(refElem) {\r
+       if (!this[0]) throw 'jQuery.fn.offset requires an element.';\r
        \r
-       refElem = (refElem) ? $(refElem)[0] : null;\r
+       refElem = (refElem) ? jQuery(refElem)[0] : null;\r
        var x = 0, y = 0, elm = this[0], parent = this[0], pos = null, borders = [0,0], isElm = true, sl = 0, st = 0;\r
        do {\r
                if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {\r
                        // Safari and IE don't add margin for static and relative\r
-                       if (($.browser.safari || $.browser.msie) && pos != 'absolute') {\r
-                               x += parseInt($.css(parent, 'marginLeft')) || 0;\r
-                               y += parseInt($.css(parent, 'marginTop'))  || 0;\r
+                       if ((jQuery.browser.safari || jQuery.browser.msie) && pos != 'absolute') {\r
+                               x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;\r
+                               y += parseInt(jQuery.css(parent, 'marginTop'))  || 0;\r
                        }\r
                        break;\r
                }\r
                \r
-               pos    = $.css(parent, 'position');\r
-               border = [parseInt($.css(parent, 'borderLeftWidth')) || 0,\r
-                                                       parseInt($.css(parent, 'borderTopWidth'))  || 0];\r
+               pos    = jQuery.css(parent, 'position');\r
+               border = [parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0,\r
+                                                       parseInt(jQuery.css(parent, 'borderTopWidth'))  || 0];\r
                sl = parent.scrollLeft;\r
                st = parent.scrollTop;\r
                \r
@@ -278,7 +273,7 @@ $.fn.offset = function(refElem) {
                y += (parent.offsetTop  || 0) + border[1] - st;\r
                \r
                // Safari and Opera include the border already for parents with position = absolute|relative\r
-               if (($.browser.safari || $.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {\r
+               if ((jQuery.browser.safari || jQuery.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {\r
                        x -= border[0];\r
                        y -= border[1];\r
                }\r
@@ -288,7 +283,7 @@ $.fn.offset = function(refElem) {
        } while(parent);\r
        \r
        if (refElem) {\r
-               var offset = $(refElem).offset();\r
+               var offset = jQuery(refElem).offset();\r
                x  = x  - offset.left;\r
                y  = y  - offset.top;\r
                sl = sl - offset.scrollLeft;\r
@@ -300,10 +295,10 @@ $.fn.offset = function(refElem) {
                left: x,\r
                width:  elm.offsetWidth,\r
                height: elm.offsetHeight,\r
-               borderTop:  parseInt($.css(elm, 'borderTopWidth'))  || 0,\r
-               borderLeft: parseInt($.css(elm, 'borderLeftWidth')) || 0,\r
-               marginTop:  parseInt($.css(elm, 'marginTopWidth'))  || 0,\r
-               marginLeft: parseInt($.css(elm, 'marginLeftWidth')) || 0,\r
+               borderTop:  parseInt(jQuery.css(elm, 'borderTopWidth'))  || 0,\r
+               borderLeft: parseInt(jQuery.css(elm, 'borderLeftWidth')) || 0,\r
+               marginTop:  parseInt(jQuery.css(elm, 'marginTopWidth'))  || 0,\r
+               marginLeft: parseInt(jQuery.css(elm, 'marginLeftWidth')) || 0,\r
                scrollTop:  st,\r
                scrollLeft: sl,\r
                pageYOffset: window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop  || 0,\r
index 1dfd31e..4ad2b55 100644 (file)
@@ -447,16 +447,10 @@ jQuery.extend({
                z.a = function(){\r
                        if ( options.step )\r
                                options.step.apply( elem, [ z.now ] );\r
-\r
-                       if ( prop == "opacity" ) {\r
-                               if (jQuery.browser.mozilla && z.now == 1) z.now = 0.9999;\r
-                               if (window.ActiveXObject)\r
-                                       y.filter = "alpha(opacity=" + z.now*100 + ")";\r
-                               else\r
-                                       y.opacity = z.now;\r
-\r
-                       // My hate for IE will never die\r
-                       } else if ( parseInt(z.now) )\r
\r
+                       if ( prop == "opacity" )\r
+                               jQuery.attr(y, "opacity", z.now); // Let attr handle opacity\r
+                       else if ( parseInt(z.now) ) // My hate for IE will never die\r
                                y[prop] = parseInt(z.now) + "px";\r
                                \r
                        y.display = "block";\r
@@ -490,8 +484,12 @@ jQuery.extend({
 \r
                        // Remember where we started, so that we can go back to it later\r
                        z.el.orig[prop] = this.cur();\r
-\r
-                       z.custom( 0, z.el.orig[prop] );\r
+                       \r
+                       // Begin the animation\r
+                       if (prop == "opacity")\r
+                               z.custom(z.el.orig[prop], 1);\r
+                       else\r
+                               z.custom(0, z.el.orig[prop]);\r
 \r
                        // Stupid IE, look what you made me do\r
                        if ( prop != "opacity" )\r
@@ -511,10 +509,6 @@ jQuery.extend({
                        z.custom(z.el.orig[prop], 0);\r
                };\r
        \r
-               // IE has trouble with opacity if it does not have layout\r
-               if ( jQuery.browser.msie && !z.el.currentStyle.hasLayout )\r
-                       y.zoom = "1";\r
-       \r
                // Remember  the overflow of the element\r
                if ( !z.el.oldOverlay )\r
                        z.el.oldOverflow = jQuery.css( z.el, "overflow" );\r
@@ -552,7 +546,10 @@ jQuery.extend({
                                        // Reset the property, if the item has been hidden\r
                                        if ( z.o.hide ) {\r
                                                for ( var p in z.el.curAnim ) {\r
-                                                       y[ p ] = z.el.orig[p] + ( p == "opacity" ? "" : "px" );\r
+                                                       if (p == "opacity" && jQuery.browser.msie)\r
+                                                               jQuery.attr(y, p, z.el.orig[p]);\r
+                                                       else\r
+                                                               y[ p ] = z.el.orig[p] + "px";\r
        \r
                                                        // set its height and/or width to auto\r
                                                        if ( p == 'height' || p == 'width' )\r
index 12b342c..9ae399b 100644 (file)
@@ -98,7 +98,7 @@ if ( typeof $ != "undefined" )
  * @desc Creates a div element (and all of its contents) dynamically, \r
  * and appends it to the element with the ID of body. Internally, an\r
  * element is created and it's innerHTML property set to the given markup.\r
- * It is therefore both quite flexible and limited. 
+ * It is therefore both quite flexible and limited. \r
  *\r
  * @name $\r
  * @param String expr An expression to search with, or a string of HTML to create on the fly.\r
@@ -1451,14 +1451,16 @@ jQuery.extend({
                        });\r
 \r
                        return p == "height" ? oHeight : oWidth;\r
-               } else if ( p == "opacity" && jQuery.browser.msie )\r
-                       return parseFloat( jQuery.curCSS(e,"filter").replace(/[^0-9.]/,"") ) || 1;\r
+               }\r
 \r
                return jQuery.curCSS( e, p );\r
        },\r
 \r
        curCSS: function(elem, prop, force) {\r
                var ret;\r
+               \r
+               if (prop == 'opacity' && jQuery.browser.msie)\r
+                       return jQuery.attr(elem.style, 'opacity');\r
 \r
                if (!force && elem.style[prop]) {\r
 \r
@@ -1829,6 +1831,22 @@ jQuery.extend({
                        disabled: "disabled",\r
                        checked: "checked"\r
                };\r
+               \r
+               // IE actually uses filters for opacity ... elem is actually elem.style\r
+               if (name == "opacity" && jQuery.browser.msie && value != undefined) {\r
+                       // IE has trouble with opacity if it does not have layout\r
+                       // Would prefer to check element.hasLayout first but don't have access to the element here\r
+                       elem['zoom'] = 1; \r
+                       if (value == 1) // Remove filter to avoid more IE weirdness\r
+                               return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"");\r
+                       else\r
+                               return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"") + "alpha(opacity=" + value * 100 + ")";\r
+               } else if (name == "opacity" && jQuery.browser.msie) {\r
+                       return elem["filter"] ? parseFloat( elem["filter"].match(/alpha\(opacity=(.*)\)/)[1] )/100 : 1;\r
+               }\r
+               \r
+               // Mozilla doesn't play well with opacity 1\r
+               if (name == "opacity" && jQuery.browser.mozilla && value == 1) value = 0.9999;\r
 \r
                if ( fix[name] ) {\r
                        if ( value != undefined ) elem[fix[name]] = value;\r