aboutsummaryrefslogtreecommitdiffstats
path: root/ui/position.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/position.js')
-rw-r--r--ui/position.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/position.js b/ui/position.js
index 3994e9acc..2d1969599 100644
--- a/ui/position.js
+++ b/ui/position.js
@@ -48,6 +48,10 @@ function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
+function isWindow( obj ) {
+ return obj != null && obj === obj.window;
+}
+
function getDimensions( elem ) {
var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
@@ -57,7 +61,7 @@ function getDimensions( elem ) {
offset: { top: 0, left: 0 }
};
}
- if ( $.isWindow( raw ) ) {
+ if ( isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
@@ -119,12 +123,12 @@ $.position = {
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
- isWindow = $.isWindow( withinElement[ 0 ] ),
+ isElemWindow = isWindow( withinElement[ 0 ] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
- hasOffset = !isWindow && !isDocument;
+ hasOffset = !isElemWindow && !isDocument;
return {
element: withinElement,
- isWindow: isWindow,
+ isWindow: isElemWindow,
isDocument: isDocument,
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),