@@ 7809-7924 (lines=116) @@ | ||
7806 | var rtable = /^t(?:able|d|h)$/i, |
|
7807 | rroot = /^(?:body|html)$/i; |
|
7808 | ||
7809 | if ( "getBoundingClientRect" in document.documentElement ) { |
|
7810 | jQuery.fn.offset = function( options ) { |
|
7811 | var elem = this[0], box; |
|
7812 | ||
7813 | if ( options ) { |
|
7814 | return this.each(function( i ) { |
|
7815 | jQuery.offset.setOffset( this, options, i ); |
|
7816 | }); |
|
7817 | } |
|
7818 | ||
7819 | if ( !elem || !elem.ownerDocument ) { |
|
7820 | return null; |
|
7821 | } |
|
7822 | ||
7823 | if ( elem === elem.ownerDocument.body ) { |
|
7824 | return jQuery.offset.bodyOffset( elem ); |
|
7825 | } |
|
7826 | ||
7827 | try { |
|
7828 | box = elem.getBoundingClientRect(); |
|
7829 | } catch(e) {} |
|
7830 | ||
7831 | var doc = elem.ownerDocument, |
|
7832 | docElem = doc.documentElement; |
|
7833 | ||
7834 | // Make sure we're not dealing with a disconnected DOM node |
|
7835 | if ( !box || !jQuery.contains( docElem, elem ) ) { |
|
7836 | return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; |
|
7837 | } |
|
7838 | ||
7839 | var body = doc.body, |
|
7840 | win = getWindow(doc), |
|
7841 | clientTop = docElem.clientTop || body.clientTop || 0, |
|
7842 | clientLeft = docElem.clientLeft || body.clientLeft || 0, |
|
7843 | scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ), |
|
7844 | scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft), |
|
7845 | top = box.top + scrollTop - clientTop, |
|
7846 | left = box.left + scrollLeft - clientLeft; |
|
7847 | ||
7848 | return { top: top, left: left }; |
|
7849 | }; |
|
7850 | ||
7851 | } else { |
|
7852 | jQuery.fn.offset = function( options ) { |
|
7853 | var elem = this[0]; |
|
7854 | ||
7855 | if ( options ) { |
|
7856 | return this.each(function( i ) { |
|
7857 | jQuery.offset.setOffset( this, options, i ); |
|
7858 | }); |
|
7859 | } |
|
7860 | ||
7861 | if ( !elem || !elem.ownerDocument ) { |
|
7862 | return null; |
|
7863 | } |
|
7864 | ||
7865 | if ( elem === elem.ownerDocument.body ) { |
|
7866 | return jQuery.offset.bodyOffset( elem ); |
|
7867 | } |
|
7868 | ||
7869 | jQuery.offset.initialize(); |
|
7870 | ||
7871 | var computedStyle, |
|
7872 | offsetParent = elem.offsetParent, |
|
7873 | prevOffsetParent = elem, |
|
7874 | doc = elem.ownerDocument, |
|
7875 | docElem = doc.documentElement, |
|
7876 | body = doc.body, |
|
7877 | defaultView = doc.defaultView, |
|
7878 | prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, |
|
7879 | top = elem.offsetTop, |
|
7880 | left = elem.offsetLeft; |
|
7881 | ||
7882 | while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
|
7883 | if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
|
7884 | break; |
|
7885 | } |
|
7886 | ||
7887 | computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; |
|
7888 | top -= elem.scrollTop; |
|
7889 | left -= elem.scrollLeft; |
|
7890 | ||
7891 | if ( elem === offsetParent ) { |
|
7892 | top += elem.offsetTop; |
|
7893 | left += elem.offsetLeft; |
|
7894 | ||
7895 | if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { |
|
7896 | top += parseFloat( computedStyle.borderTopWidth ) || 0; |
|
7897 | left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
|
7898 | } |
|
7899 | ||
7900 | prevOffsetParent = offsetParent; |
|
7901 | offsetParent = elem.offsetParent; |
|
7902 | } |
|
7903 | ||
7904 | if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { |
|
7905 | top += parseFloat( computedStyle.borderTopWidth ) || 0; |
|
7906 | left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
|
7907 | } |
|
7908 | ||
7909 | prevComputedStyle = computedStyle; |
|
7910 | } |
|
7911 | ||
7912 | if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { |
|
7913 | top += body.offsetTop; |
|
7914 | left += body.offsetLeft; |
|
7915 | } |
|
7916 | ||
7917 | if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
|
7918 | top += Math.max( docElem.scrollTop, body.scrollTop ); |
|
7919 | left += Math.max( docElem.scrollLeft, body.scrollLeft ); |
|
7920 | } |
|
7921 | ||
7922 | return { top: top, left: left }; |
|
7923 | }; |
|
7924 | } |
|
7925 | ||
7926 | jQuery.offset = { |
|
7927 | initialize: function() { |
@@ 8901-9014 (lines=114) @@ | ||
8898 | var rtable = /^t(?:able|d|h)$/i, |
|
8899 | rroot = /^(?:body|html)$/i; |
|
8900 | ||
8901 | if ( "getBoundingClientRect" in document.documentElement ) { |
|
8902 | jQuery.fn.offset = function( options ) { |
|
8903 | var elem = this[0], box; |
|
8904 | ||
8905 | if ( options ) { |
|
8906 | return this.each(function( i ) { |
|
8907 | jQuery.offset.setOffset( this, options, i ); |
|
8908 | }); |
|
8909 | } |
|
8910 | ||
8911 | if ( !elem || !elem.ownerDocument ) { |
|
8912 | return null; |
|
8913 | } |
|
8914 | ||
8915 | if ( elem === elem.ownerDocument.body ) { |
|
8916 | return jQuery.offset.bodyOffset( elem ); |
|
8917 | } |
|
8918 | ||
8919 | try { |
|
8920 | box = elem.getBoundingClientRect(); |
|
8921 | } catch(e) {} |
|
8922 | ||
8923 | var doc = elem.ownerDocument, |
|
8924 | docElem = doc.documentElement; |
|
8925 | ||
8926 | // Make sure we're not dealing with a disconnected DOM node |
|
8927 | if ( !box || !jQuery.contains( docElem, elem ) ) { |
|
8928 | return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; |
|
8929 | } |
|
8930 | ||
8931 | var body = doc.body, |
|
8932 | win = getWindow(doc), |
|
8933 | clientTop = docElem.clientTop || body.clientTop || 0, |
|
8934 | clientLeft = docElem.clientLeft || body.clientLeft || 0, |
|
8935 | scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, |
|
8936 | scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, |
|
8937 | top = box.top + scrollTop - clientTop, |
|
8938 | left = box.left + scrollLeft - clientLeft; |
|
8939 | ||
8940 | return { top: top, left: left }; |
|
8941 | }; |
|
8942 | ||
8943 | } else { |
|
8944 | jQuery.fn.offset = function( options ) { |
|
8945 | var elem = this[0]; |
|
8946 | ||
8947 | if ( options ) { |
|
8948 | return this.each(function( i ) { |
|
8949 | jQuery.offset.setOffset( this, options, i ); |
|
8950 | }); |
|
8951 | } |
|
8952 | ||
8953 | if ( !elem || !elem.ownerDocument ) { |
|
8954 | return null; |
|
8955 | } |
|
8956 | ||
8957 | if ( elem === elem.ownerDocument.body ) { |
|
8958 | return jQuery.offset.bodyOffset( elem ); |
|
8959 | } |
|
8960 | ||
8961 | var computedStyle, |
|
8962 | offsetParent = elem.offsetParent, |
|
8963 | prevOffsetParent = elem, |
|
8964 | doc = elem.ownerDocument, |
|
8965 | docElem = doc.documentElement, |
|
8966 | body = doc.body, |
|
8967 | defaultView = doc.defaultView, |
|
8968 | prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, |
|
8969 | top = elem.offsetTop, |
|
8970 | left = elem.offsetLeft; |
|
8971 | ||
8972 | while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
|
8973 | if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { |
|
8974 | break; |
|
8975 | } |
|
8976 | ||
8977 | computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; |
|
8978 | top -= elem.scrollTop; |
|
8979 | left -= elem.scrollLeft; |
|
8980 | ||
8981 | if ( elem === offsetParent ) { |
|
8982 | top += elem.offsetTop; |
|
8983 | left += elem.offsetLeft; |
|
8984 | ||
8985 | if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { |
|
8986 | top += parseFloat( computedStyle.borderTopWidth ) || 0; |
|
8987 | left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
|
8988 | } |
|
8989 | ||
8990 | prevOffsetParent = offsetParent; |
|
8991 | offsetParent = elem.offsetParent; |
|
8992 | } |
|
8993 | ||
8994 | if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { |
|
8995 | top += parseFloat( computedStyle.borderTopWidth ) || 0; |
|
8996 | left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
|
8997 | } |
|
8998 | ||
8999 | prevComputedStyle = computedStyle; |
|
9000 | } |
|
9001 | ||
9002 | if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { |
|
9003 | top += body.offsetTop; |
|
9004 | left += body.offsetLeft; |
|
9005 | } |
|
9006 | ||
9007 | if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { |
|
9008 | top += Math.max( docElem.scrollTop, body.scrollTop ); |
|
9009 | left += Math.max( docElem.scrollLeft, body.scrollLeft ); |
|
9010 | } |
|
9011 | ||
9012 | return { top: top, left: left }; |
|
9013 | }; |
|
9014 | } |
|
9015 | ||
9016 | jQuery.offset = { |
|
9017 |