@@ 10898-10943 (lines=46) @@ | ||
10895 | ||
10896 | ||
10897 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
10898 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
10899 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
|
10900 | function( defaultExtra, funcName ) { |
|
10901 | ||
10902 | // margin is only for outerHeight, outerWidth |
|
10903 | jQuery.fn[ funcName ] = function( margin, value ) { |
|
10904 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
10905 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
10906 | ||
10907 | return access( this, function( elem, type, value ) { |
|
10908 | var doc; |
|
10909 | ||
10910 | if ( jQuery.isWindow( elem ) ) { |
|
10911 | ||
10912 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
|
10913 | // isn't a whole lot we can do. See pull request at this URL for discussion: |
|
10914 | // https://github.com/jquery/jquery/pull/764 |
|
10915 | return elem.document.documentElement[ "client" + name ]; |
|
10916 | } |
|
10917 | ||
10918 | // Get document width or height |
|
10919 | if ( elem.nodeType === 9 ) { |
|
10920 | doc = elem.documentElement; |
|
10921 | ||
10922 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
10923 | // whichever is greatest |
|
10924 | // unfortunately, this causes bug #3838 in IE6/8 only, |
|
10925 | // but there is currently no good, small way to fix it. |
|
10926 | return Math.max( |
|
10927 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
10928 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
10929 | doc[ "client" + name ] |
|
10930 | ); |
|
10931 | } |
|
10932 | ||
10933 | return value === undefined ? |
|
10934 | ||
10935 | // Get width or height on the element, requesting but not forcing parseFloat |
|
10936 | jQuery.css( elem, type, extra ) : |
|
10937 | ||
10938 | // Set width or height on the element |
|
10939 | jQuery.style( elem, type, value, extra ); |
|
10940 | }, type, chainable ? margin : undefined, chainable, null ); |
|
10941 | }; |
|
10942 | } ); |
|
10943 | } ); |
|
10944 | ||
10945 | ||
10946 | jQuery.fn.extend( { |
@@ 9707-9750 (lines=44) @@ | ||
9704 | ||
9705 | ||
9706 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
9707 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
9708 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
|
9709 | function( defaultExtra, funcName ) { |
|
9710 | ||
9711 | // Margin is only for outerHeight, outerWidth |
|
9712 | jQuery.fn[ funcName ] = function( margin, value ) { |
|
9713 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
9714 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
9715 | ||
9716 | return access( this, function( elem, type, value ) { |
|
9717 | var doc; |
|
9718 | ||
9719 | if ( jQuery.isWindow( elem ) ) { |
|
9720 | ||
9721 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
|
9722 | // isn't a whole lot we can do. See pull request at this URL for discussion: |
|
9723 | // https://github.com/jquery/jquery/pull/764 |
|
9724 | return elem.document.documentElement[ "client" + name ]; |
|
9725 | } |
|
9726 | ||
9727 | // Get document width or height |
|
9728 | if ( elem.nodeType === 9 ) { |
|
9729 | doc = elem.documentElement; |
|
9730 | ||
9731 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
9732 | // whichever is greatest |
|
9733 | return Math.max( |
|
9734 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
9735 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
9736 | doc[ "client" + name ] |
|
9737 | ); |
|
9738 | } |
|
9739 | ||
9740 | return value === undefined ? |
|
9741 | ||
9742 | // Get width or height on the element, requesting but not forcing parseFloat |
|
9743 | jQuery.css( elem, type, extra ) : |
|
9744 | ||
9745 | // Set width or height on the element |
|
9746 | jQuery.style( elem, type, value, extra ); |
|
9747 | }, type, chainable ? margin : undefined, chainable, null ); |
|
9748 | }; |
|
9749 | } ); |
|
9750 | } ); |
|
9751 | ||
9752 | ||
9753 | jQuery.fn.extend( { |
@@ 9085-9124 (lines=40) @@ | ||
9082 | ||
9083 | ||
9084 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
9085 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
9086 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { |
|
9087 | // margin is only for outerHeight, outerWidth |
|
9088 | jQuery.fn[ funcName ] = function( margin, value ) { |
|
9089 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
9090 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
9091 | ||
9092 | return access( this, function( elem, type, value ) { |
|
9093 | var doc; |
|
9094 | ||
9095 | if ( jQuery.isWindow( elem ) ) { |
|
9096 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
|
9097 | // isn't a whole lot we can do. See pull request at this URL for discussion: |
|
9098 | // https://github.com/jquery/jquery/pull/764 |
|
9099 | return elem.document.documentElement[ "client" + name ]; |
|
9100 | } |
|
9101 | ||
9102 | // Get document width or height |
|
9103 | if ( elem.nodeType === 9 ) { |
|
9104 | doc = elem.documentElement; |
|
9105 | ||
9106 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
9107 | // whichever is greatest |
|
9108 | return Math.max( |
|
9109 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
9110 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
9111 | doc[ "client" + name ] |
|
9112 | ); |
|
9113 | } |
|
9114 | ||
9115 | return value === undefined ? |
|
9116 | // Get width or height on the element, requesting but not forcing parseFloat |
|
9117 | jQuery.css( elem, type, extra ) : |
|
9118 | ||
9119 | // Set width or height on the element |
|
9120 | jQuery.style( elem, type, value, extra ); |
|
9121 | }, type, chainable ? margin : undefined, chainable, null ); |
|
9122 | }; |
|
9123 | }); |
|
9124 | }); |
|
9125 | ||
9126 | ||
9127 | // The number of elements contained in the matched element set |