diff options
author | Byron Jones <bjones@mozilla.com> | 2013-11-25 09:21:03 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-11-25 09:21:03 +0100 |
commit | ba0765bf4dc468815e4fa45509010c0cd675e5b2 (patch) | |
tree | 32d979d1172495770a326f87f294c6f10a1eaa68 /js/util.js | |
parent | 0aade93cebf4192b240347e092a7e53a62436ea2 (diff) | |
download | bugzilla-ba0765bf4dc468815e4fa45509010c0cd675e5b2.tar.gz bugzilla-ba0765bf4dc468815e4fa45509010c0cd675e5b2.tar.xz |
Bug 793963: add the ability to tag comments with arbitrary tags
r=dkl, a=glob
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js index 6d1f88938..d3a34477b 100644 --- a/js/util.js +++ b/js/util.js @@ -125,10 +125,7 @@ function bz_overlayBelow(item, parent) { */ function bz_isValueInArray(aArray, aValue) { - var run = 0; - var len = aArray.length; - - for ( ; run < len; run++) { + for (var run = 0, len = aArray.length ; run < len; run++) { if (aArray[run] == aValue) { return true; } @@ -138,6 +135,26 @@ function bz_isValueInArray(aArray, aValue) } /** + * Checks if a specified value is in the specified array by performing a + * case-insensitive comparison. + * + * @param aArray Array to search for the value. + * @param aValue Value to search from the array. + * @return Boolean; true if value is found in the array and false if not. + */ +function bz_isValueInArrayIgnoreCase(aArray, aValue) +{ + var re = new RegExp(aValue.replace(/([^A-Za-z0-9])/g, "\\$1"), 'i'); + for (var run = 0, len = aArray.length ; run < len; run++) { + if (aArray[run].match(re)) { + return true; + } + } + + return false; +} + +/** * Create wanted options in a select form control. * * @param aSelect Select form control to manipulate. |