You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/11/28 11:43:41 UTC

svn commit: r1039863 - /wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js

Author: mgrigorov
Date: Sun Nov 28 10:43:41 2010
New Revision: 1039863

URL: http://svn.apache.org/viewvc?rev=1039863&view=rev
Log:
WICKET-3154 test for undefined in the same manner throughtout the code.

Always use 'typeof(xyz) <operator> "undefined"'.
It is more safe then using 'xyz <operator> undefined' because window.undefined can be overwritten by buggy/malicious code.

Modified:
    wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js

Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js?rev=1039863&r1=1039862&r2=1039863&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js Sun Nov 28 10:43:41 2010
@@ -1590,7 +1590,7 @@ Wicket.Window.Mask.prototype = {
  * Returns the height of visible area.
  */
 Wicket.Window.getViewportHeight = function() {
-	if (window.innerHeight != window.undefined) 
+	if (typeof(window.innerHeight) != "undefined") 
 		return window.innerHeight;
 	
 	if (document.compatMode == 'CSS1Compat') 
@@ -1599,14 +1599,14 @@ Wicket.Window.getViewportHeight = functi
 	if (document.body) 
 		return document.body.clientHeight;
 		 
-	return window.undefined; 
+	return undefined; 
 }
 
 /**
  * Returns the width of visible area.
  */
 Wicket.Window.getViewportWidth =  function() {
-	if (window.innerWidth != window.undefined) 
+	if (typeof(window.innerWidth) != "undefined") 
 		return window.innerWidth;
 		 
 	if (document.compatMode == 'CSS1Compat') 
@@ -1615,7 +1615,7 @@ Wicket.Window.getViewportWidth =  functi
 	if (document.body) 
 		return document.body.clientWidth;
 		 
-	return window.undefined;
+	return undefined;
 }
 
 /**