From 065768ec6baa59cb0699bc64129d4a4687f556ba Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Thu, 9 Jan 2014 23:44:16 +0100 Subject: [PATCH] Use typeof var == 'undefined' instead var === undefined. This is a more robust solution, because we aren't affected by definition of undefined like `var undefined = 7;`. --- src/hints.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hints.js b/src/hints.js index 5c60125..48b98e2 100644 --- a/src/hints.js +++ b/src/hints.js @@ -92,7 +92,7 @@ var VbHint = (function(){ function helper(win, offsets) { /* document may be undefined for frames out of the same origin */ /* policy and will break the whole code - so we check this before */ - if (win.document === undefined) { + if (typeof win.document == "undefined") { return; } @@ -101,7 +101,7 @@ var VbHint = (function(){ offsets.bottom = win.innerHeight - offsets.bottom; function isVisible(e) { - if (e === undefined) { + if (typeof e == "undefined") { return false; } var rect = e.getBoundingClientRect(); @@ -398,7 +398,7 @@ var VbHint = (function(){ evObj.initMouseEvent( name, true, true, e.contentWindow, 0, 0, 0, 0, 0, - ctrl !== undefined ? ctrl : false, false, false, false, 0, null + (typeof ctrl != "undefined") ? ctrl : false, false, false, false, 0, null ); e.dispatchEvent(evObj); } -- 2.20.1