Permalink
Browse files

Offset: Eliminate little-used internal function

Fixes gh-3449
Closes gh-3456
  • Loading branch information...
gibson042 committed Dec 19, 2016
1 parent 8cb4cd7 commit bf3a43eff8682b59cec785be6003753fa4b93706
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/offset.js
View
@@ -15,13 +15,6 @@ define( [
"use strict";
/**
* Gets a window from an element
*/
function getWindow( elem ) {
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
}
jQuery.offset = {
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
@@ -86,7 +79,7 @@ jQuery.fn.extend( {
} );
}
var docElem, win, rect, doc,
var doc, docElem, rect, win,
elem = this[ 0 ];
if ( !elem ) {
@@ -104,8 +97,8 @@ jQuery.fn.extend( {
rect = elem.getBoundingClientRect();
doc = elem.ownerDocument;
win = getWindow( doc );
docElem = doc.documentElement;
win = doc.defaultView;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
@@ -183,7 +176,14 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) {
var win = getWindow( elem );
// Coalesce documents and windows
var win;
if ( jQuery.isWindow( elem ) ) {
win = elem;
} else if ( elem.nodeType === 9 ) {
win = elem.defaultView;
}
if ( val === undefined ) {
return win ? win[ prop ] : elem[ method ];

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Feb 28, 2017

Member

What do you mean? If you found a bug please report an issue with steps to reproduce.

@mgol

mgol Feb 28, 2017

Member

What do you mean? If you found a bug please report an issue with steps to reproduce.

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Mar 1, 2017

Member

I don't really understand what you're saying. What exactly would be strange? The only thing that matters (correctness-wise) is what jQuery method for which parameter returns which value - and how it differs from what's expected. But if nothing differs then there's no problem...

@mgol

mgol Mar 1, 2017

Member

I don't really understand what you're saying. What exactly would be strange? The only thing that matters (correctness-wise) is what jQuery method for which parameter returns which value - and how it differs from what's expected. But if nothing differs then there's no problem...

0 comments on commit bf3a43e

Please sign in to comment.