You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2019/05/15 21:24:50 UTC

[wicket] 10/16: WICKET-6667 JS removed toggleClass()

This is an automated email from the ASF dual-hosted git repository.

svenmeier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit bcd08e074af312da747fa03455e493a8a618c9b8
Author: Sven Meier <sv...@apache.org>
AuthorDate: Wed May 8 16:02:49 2019 +0200

    WICKET-6667 JS removed toggleClass()
    
    was not used
---
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       | 21 --------------
 wicket-core/src/test/js/dom.js                     | 32 ----------------------
 2 files changed, 53 deletions(-)

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 401468d..fddc251 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
@@ -38,18 +38,12 @@
 
 	var getAjaxBaseUrl,
 		isUndef,
-		replaceAll,
 		nodeListToArray;
 
 	isUndef = function (target) {
 		return (typeof(target) === 'undefined' || target === null);
 	};
 
-	replaceAll = function (str, from, to) {
-		var regex = new RegExp(from.replace( /\W/g ,'\\$&' ), 'g');
-		return str.replace(regex,to);
-	};
-
 	/**
 	 * A safe getter for Wicket's Ajax base URL.
 	 * If the value is not defined or is empty string then
@@ -1442,21 +1436,6 @@
 				}
 			},
 
-			/**
-			 * Add or remove one or more classes from each element in the
-			 * set of matched elements, depending on either the class's presence
-			 * or the value of the switch argument.
-			 *
-			 * @param {String} elementId The markup id of the element that will be manipulated.
-			 * @param {String} cssClass One or more class names (separated by spaces)
-			 *        to be toggled for each element in the matched set.
-			 * @param {Boolean} Switch A Boolean (not just truthy/falsy) value to
-			 *        determine whether the class should be added or removed.
-			 */
-			toggleClass: function(elementId, cssClass, Switch) {
-				jQuery('#'+elementId).toggleClass(cssClass, Switch);
-			},
-
 			/** call-counting implementation of Wicket.DOM.show() */
 			showIncrementally: function (e) {
 				e = Wicket.$(e);
diff --git a/wicket-core/src/test/js/dom.js b/wicket-core/src/test/js/dom.js
index aa6be0a..86e3b2f 100644
--- a/wicket-core/src/test/js/dom.js
+++ b/wicket-core/src/test/js/dom.js
@@ -112,38 +112,6 @@ jQuery(document).ready(function() {
 		equal( el.style.display, '', "Wicket.DOM.show should set .style.display to ''." );
 	});
 
-	test("toggleClass() - single CSS class", function() {
-		var cssClass = 'testCssClass';
-		var element = jQuery('#' + existingId);
-		equal(false, element.hasClass(cssClass), "The element doesn't have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass);
-		equal(true, element.hasClass(cssClass), "The element does have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass);
-		equal(false, element.hasClass(cssClass), "The element doesn't have the CSS class");
-	});
-
-	test("toggleClass() - multiple CSS classes", function() {
-		var cssClass1 = 'testCssClass1';
-		var cssClass2 = 'testCssClass2';
-		var cssClass = cssClass1 + ' ' + cssClass2;
-		var element = jQuery('#' + existingId);
-		equal(false, element.hasClass(cssClass1), "The element doesn't have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass);
-		equal(true, element.hasClass(cssClass1), "The element does have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass);
-		equal(false, element.hasClass(cssClass1), "The element doesn't have the CSS class");
-	});
-
-	test("toggleClass() - switch argument", function() {
-		var cssClass = 'testCssClass';
-		var element = jQuery('#' + existingId);
-		equal(false, element.hasClass(cssClass), "The element doesn't have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass, true);
-		equal(true, element.hasClass(cssClass), "The element does have the CSS class");
-		Wicket.DOM.toggleClass(existingId, cssClass, false);
-		equal(false, element.hasClass(cssClass), "The element doesn't have the CSS class");
-	});
-
 	test("(show|hide)Incrementally() an element", function() {
 		var el = Wicket.$(existingId);
 		Wicket.DOM.hideIncrementally(el);