From 0b4ee129cc3a16943a39f01494f8167791a8d38a Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 11 Feb 2009 19:41:14 +0000 Subject: Bug 376673: Add a simple version of the bug entry form (enter_bug.cgi) Patch By Max Kanat-Alexander r=pyrzak, r=LpSolit, a=LpSolit --- js/util.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'js/util.js') diff --git a/js/util.js b/js/util.js index 8e787847a..666f2666b 100644 --- a/js/util.js +++ b/js/util.js @@ -253,3 +253,21 @@ function bz_fireEvent(anElement, anEvent) { evt.initEvent(anEvent, true, true); // event type, bubbling, cancelable return !anElement.dispatchEvent(evt); } + +/** + * Adds a CSS class to an element if it doesn't have it. Removes the + * CSS class from the element if the element does have the class. + * + * Requires YUI's Dom library. + * + * @param anElement The element to toggle the class on + * @param aClass The name of the CSS class to toggle. + */ +function bz_toggleClass(anElement, aClass) { + if (YAHOO.util.Dom.hasClass(anElement, aClass)) { + YAHOO.util.Dom.removeClass(anElement, aClass); + } + else { + YAHOO.util.Dom.addClass(anElement, aClass); + } +} -- cgit v1.2.3-24-g4f1b