You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by so...@apache.org on 2019/08/21 09:26:44 UTC

[wicket] branch master updated: [WICKET-6697] wicket.DOM.toggleClass is restored

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 11cb86a  [WICKET-6697] wicket.DOM.toggleClass is restored
11cb86a is described below

commit 11cb86a5655a99e73a94fbc195b40cd5249bb442
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Wed Aug 21 16:26:31 2019 +0700

    [WICKET-6697] wicket.DOM.toggleClass is restored
---
 .../org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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 47ed601..70dd69d 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
@@ -1399,6 +1399,21 @@
 				}
 			},
 
+			/**
+			 * 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);