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 2012/07/02 19:28:59 UTC

[6/6] git commit: WICKET-4635 Improve JavaScript files by applying common JSHint rules

WICKET-4635 Improve JavaScript files by applying common JSHint rules

Fix all JSHint problems


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/440003e3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/440003e3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/440003e3

Branch: refs/heads/master
Commit: 440003e364340694ceface550214a8537aeb6de6
Parents: c949193
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jul 2 15:59:10 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jul 2 19:27:27 2012 +0200

----------------------------------------------------------------------
 grunt.js                                           |    6 +++-
 .../wicket/ajax/res/js/wicket-ajax-jquery-debug.js |   18 ++++++++------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |   16 +++++-------
 .../wicket/ajax/res/js/wicket-event-jquery.js      |    4 ---
 4 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/440003e3/grunt.js
----------------------------------------------------------------------
diff --git a/grunt.js b/grunt.js
index d65c62b..384939f 100644
--- a/grunt.js
+++ b/grunt.js
@@ -29,15 +29,17 @@ module.exports = function(grunt) {
 				"eqnull": true,
 				"eqeqeq": true,
 				"expr": true,
+				"evil": true,
 				"jquery": true,
 				"latedef": true,
 				"noarg": true,
-				"onevar": true,
+				"onevar": false,
 				"smarttabs": true,
 				"trailing": true,
 				"undef": true,
+				"strict": true,
 				"predef": [
-					"ActiveXObject"
+					"Wicket"
 				]
 			}
 		},

http://git-wip-us.apache.org/repos/asf/wicket/blob/440003e3/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
index a6cb7d7..03194a5 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
- /*jshint evil: true, nomen: false, onevar: false, regexp: false, strict: true, boss: true, undef: true, maxlen: 160, curly: true, eqeqeq: true */
-/*global document: false, jQuery:false, DOMParser: true, window: false, Wicket: true, console: true */
+/*jshint maxlen: 430 */
+/*global console: true */
 
 
 /*
@@ -83,7 +83,7 @@
 			var $log = jQuery('#'+self.debugWindowLogId);
 			var $child = jQuery("<div>");
 
-			msg = "" + msg;		
+			msg = "" + msg;
 			msg = msg.replace(/&/g, "&amp;");
 			msg = msg.replace(/</g, "&lt;");
 			msg = msg.replace(/>/g, "&gt;");
@@ -138,7 +138,7 @@
 			jQuery('#'+self.debugWindowLogId).empty();
 		},
 
-		init : function() {		
+		init : function() {
 
 			if ( Wicket.Ajax.DebugWindow.enabled) {
 				var self = Wicket.Ajax.DebugWindow;
@@ -153,11 +153,13 @@
 						"	<div style='border: 1px solid black; padding: 1px; background-color: #eee'>"+
 						"		<div style='overflow: auto; width: 100%'>"+
 						"			<div style='float: right; padding: 0.2em; padding-right: 1em; color: black;'>"+
-						"               <a href='javascript:Wicket.Ajax.DebugWindow.switchScrollLock()' id='"+self.debugWindowScrollLockLinkId+"' style='color:blue' onfocus='this.blur();'>scroll lock</a> |"+
+						"               <a href='javascript:Wicket.Ajax.DebugWindow.switchScrollLock()' id='"+self.debugWindowScrollLockLinkId+
+											"' style='color:blue' onfocus='this.blur();'>scroll lock</a> |"+
 						"				<a href='javascript:Wicket.Ajax.DebugWindow.clearLog()' style='color:blue'>clear</a> | "+
 						"				<a href='javascript:Wicket.Ajax.DebugWindow.hideDebugWindow()' style='color:blue'>close</a>"+
 						"			</div>"+
-						"			<div id='"+dwdhid+"' style='padding: 0.2em; background-color: gray; color: white; padding-left: 1em; margin-right: 14em; cursor: move;'>"+
+						"			<div id='"+dwdhid+
+										"' style='padding: 0.2em; background-color: gray; color: white; padding-left: 1em; margin-right: 14em; cursor: move;'>"+
 						"				Wicket Ajax Debug Window (drag me here)"+
 						"			</div>"+
 						"			<div id='"+self.debugWindowLogId+"' style='width: 100%; height: 200px; background-color: white; color: black; overflow: auto; white-space: nowrap; text-align:left;'>"+
@@ -173,12 +175,12 @@
 
 					// Special style for Internet 6 and 7 in quirks mode
 					if (Wicket.Browser.isIE() && (Wicket.Browser.isIEQuirks() || !Wicket.Browser.isIE7())) {
-						html +=	
+						html +=
 							"<a id='"+self.wicketDebugLink+"' style='position:absolute; right: 10px; bottom: 10px; z-index:1000000; padding-top: 0.3em; padding-bottom: 0.3em; line-height: normal ; _padding-top: 0em; width: 12em; border: 1px solid black; background-color: white; text-align: center; opacity: 0.7; filter: alpha(opacity=70); color: blue; " +
 							"                                  left: expression(-10 - wicketDebugLink.offsetWidth + eval(document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) +(document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth));"+
 							"                                  top: expression(-10 - wicketDebugLink.offsetHeight + eval(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight));'";
 					} else {
-						html += 
+						html +=
 							"<a id='"+self.wicketDebugLink+"' style='position:fixed; right: 10px; bottom: 10px; z-index:1000000; padding-top: 0.3em; padding-bottom: 0.3em; line-height: normal ; _padding-top: 0em; width: 12em; border: 1px solid black; background-color: white; text-align: center; opacity: 0.7;  color: blue;'";
 					}
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/440003e3/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index f723637..6b21ba3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -15,9 +15,7 @@
  * limitations under the License.
  */
 
-/*jshint evil: true, nomen: false, onevar: false, regexp: false, strict: true, boss: true, undef: true, maxlen: 160, curly: true, eqeqeq: true */
-/*global document: false, jQuery:false, DOMParser: true, window: false, Wicket: true, ActiveXObject: true */
-
+/*global DOMParser: true, ActiveXObject: true */
 
 /*
  * Wicket Ajax Support
@@ -798,17 +796,17 @@
 
 				// go through the ajax response and execute all priority-invocations first
 				for (var i = 0; i < root.childNodes.length; ++i) {
-					var node = root.childNodes[i];
-					if (node.tagName === "priority-evaluate") {
-						this.processEvaluation(steps, node, attrs);
+					var childNode = root.childNodes[i];
+					if (childNode.tagName === "priority-evaluate") {
+						this.processEvaluation(steps, childNode, attrs);
 					}
 				}
 
 				// go through the ajax response and for every action (component, js evaluation, header contribution)
 				// ad the proper closure to steps
 				var stepIndexOfLastReplacedComponent = -1;
-				for (var i = 0; i < root.childNodes.length; ++i) {
-					var node = root.childNodes[i];
+				for (var c = 0; c < root.childNodes.length; ++c) {
+					var node = root.childNodes[c];
 
 					if (node.tagName === "component") {
 						if (stepIndexOfLastReplacedComponent === -1) {
@@ -912,7 +910,7 @@
 		 * @param node {XmlElement} - the <[priority-]evaluate> element with the script to evaluate
 		 * @param attrs {Object} - the attributes used for the Ajax request
 		 * @param event {jQuery.Event} - the event that caused this Ajax call
- 		 */
+		 */
 		processEvaluation: function (steps, node, attrs, event) {
 			steps.push(function (notify) {
 				// get the javascript body

http://git-wip-us.apache.org/repos/asf/wicket/blob/440003e3/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
index 3c7a56d..e87eda9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
@@ -15,10 +15,6 @@
  * limitations under the License.
  */
 
-/*jshint evil: true, nomen: false, onevar: false, regexp: false, strict: true, boss: true, undef: true, maxlen: 160, curly: true, eqeqeq: true */
-/*global jQuery: false, DOMParser: true, Wicket: true, window: false, document: false  */
-
-
 /*
  * Wicket Ajax Support
  *