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:44:35 UTC

svn commit: r1039864 - /wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js

Author: mgrigorov
Date: Sun Nov 28 10:44:34 2010
New Revision: 1039864

URL: http://svn.apache.org/viewvc?rev=1039864&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/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js

Modified: wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js?rev=1039864&r1=1039863&r2=1039864&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js (original)
+++ wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js Sun Nov 28 10:44:34 2010
@@ -1560,7 +1560,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') 
@@ -1569,14 +1569,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') 
@@ -1585,7 +1585,7 @@ Wicket.Window.getViewportWidth =  functi
 	if (document.body) 
 		return document.body.clientWidth;
 		 
-	return window.undefined;
+	return undefined;
 }
 
 /**