Skip to content

Commit bd9779c

Browse files
committed
All: inline jQuery.isWindow as it'll be removed in jQuery 4.0
1 parent e4720e2 commit bd9779c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ui/position.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ function parseCss( element, property ) {
4848
return parseInt( $.css( element, property ), 10 ) || 0;
4949
}
5050

51+
function isWindow( obj ) {
52+
return obj != null && obj === obj.window;
53+
}
54+
5155
function getDimensions( elem ) {
5256
var raw = elem[ 0 ];
5357
if ( raw.nodeType === 9 ) {
@@ -57,7 +61,7 @@ function getDimensions( elem ) {
5761
offset: { top: 0, left: 0 }
5862
};
5963
}
60-
if ( $.isWindow( raw ) ) {
64+
if ( isWindow( raw ) ) {
6165
return {
6266
width: elem.width(),
6367
height: elem.height(),
@@ -119,12 +123,12 @@ $.position = {
119123
},
120124
getWithinInfo: function( element ) {
121125
var withinElement = $( element || window ),
122-
isWindow = $.isWindow( withinElement[ 0 ] ),
126+
isElemWindow = isWindow( withinElement[ 0 ] ),
123127
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
124-
hasOffset = !isWindow && !isDocument;
128+
hasOffset = !isElemWindow && !isDocument;
125129
return {
126130
element: withinElement,
127-
isWindow: isWindow,
131+
isWindow: isElemWindow,
128132
isDocument: isDocument,
129133
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
130134
scrollLeft: withinElement.scrollLeft(),

0 commit comments

Comments
 (0)