mirror of
https://github.com/jquery/jquery.git
synced 2026-02-02 09:35:09 -05:00
Conflicts: Gruntfile.js README.md src/ajax.js src/ajax/xhr.js src/attributes.js src/core.js src/css.js src/data.js src/effects.js src/event.js src/manipulation.js src/offset.js src/selector-native.js src/traversing.js test/unit/core.js test/unit/data.js
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
define([
|
||||
"./core",
|
||||
"./var/strundefined",
|
||||
"./css",
|
||||
"./selector"
|
||||
], function( jQuery, strundefined ) {
|
||||
|
||||
var docElem = window.document.documentElement;
|
||||
|
||||
jQuery.fn.offset = function( options ) {
|
||||
if ( arguments.length ) {
|
||||
return options === undefined ?
|
||||
@@ -25,7 +34,7 @@ jQuery.fn.offset = function( options ) {
|
||||
|
||||
// If we don't have gBCR, just use 0,0 rather than error
|
||||
// BlackBerry 5, iOS 3 (original iPhone)
|
||||
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
|
||||
if ( typeof elem.getBoundingClientRect !== strundefined ) {
|
||||
box = elem.getBoundingClientRect();
|
||||
}
|
||||
win = getWindow( doc );
|
||||
@@ -132,6 +141,16 @@ jQuery.fn.extend({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets a window from an element
|
||||
*/
|
||||
function getWindow( elem ) {
|
||||
return jQuery.isWindow( elem ) ?
|
||||
elem :
|
||||
elem.nodeType === 9 ?
|
||||
elem.defaultView || elem.parentWindow :
|
||||
false;
|
||||
}
|
||||
|
||||
// Create scrollLeft and scrollTop methods
|
||||
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
|
||||
@@ -160,10 +179,4 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me
|
||||
};
|
||||
});
|
||||
|
||||
function getWindow( elem ) {
|
||||
return jQuery.isWindow( elem ) ?
|
||||
elem :
|
||||
elem.nodeType === 9 ?
|
||||
elem.defaultView || elem.parentWindow :
|
||||
false;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user