summaryrefslogtreecommitdiffstats
path: root/js/util.js
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-02-11 20:41:14 +0100
committermkanat%bugzilla.org <>2009-02-11 20:41:14 +0100
commit0b4ee129cc3a16943a39f01494f8167791a8d38a (patch)
tree49f07949c5bcb3a67c7fa5df4a17c23cd274c826 /js/util.js
parent9598c5404c3d47c69d7d83545eb447bb39dff078 (diff)
downloadbugzilla-0b4ee129cc3a16943a39f01494f8167791a8d38a.tar.gz
bugzilla-0b4ee129cc3a16943a39f01494f8167791a8d38a.tar.xz
Bug 376673: Add a simple version of the bug entry form (enter_bug.cgi)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=pyrzak, r=LpSolit, a=LpSolit
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js18
1 files changed, 18 insertions, 0 deletions
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);
+ }
+}