From bf3a43eff8682b59cec785be6003753fa4b93706 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 19 Dec 2016 12:00:46 -0500 Subject: Offset: Eliminate little-used internal function Fixes gh-3449 Closes gh-3456 --- src/offset.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/offset.js b/src/offset.js index 5baefdb21..467526d2a 100644 --- a/src/offset.js +++ b/src/offset.js @@ -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 ]; -- cgit v1.2.3 cy Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD: https://github.com/go-gitea/giteawww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/PATENTS
blob: 733099041f84fa1e58611ab2e11af51c1f26d1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22