Firefox trunk no longer supports calling RegExp, properly use test and exec

This commit is contained in:
j 2011-03-30 19:38:02 +02:00
parent e3bd260b55
commit cd160622fc

View file

@ -3318,7 +3318,7 @@
function autovalidateListname(value, blur, callback) { function autovalidateListname(value, blur, callback) {
var length = value.length; var length = value.length;
value = $.map(value.split(''), function(v, i) { value = $.map(value.split(''), function(v, i) {
if (new RegExp('[0-9' + Ox.regexp.letters + '\\(\\)' + ((i == 0 || (i == length - 1 && blur)) ? '' : ' \-') + ']', 'i')(v)) { if (new RegExp('[0-9' + Ox.regexp.letters + '\\(\\)' + ((i == 0 || (i == length - 1 && blur)) ? '' : ' \-') + ']', 'i').test(v)) {
return v return v
} else { } else {
return null; return null;
@ -3336,7 +3336,7 @@
function autovalidateUsername(value, blur, callback) { function autovalidateUsername(value, blur, callback) {
var length = value.length; var length = value.length;
value = $.map(value.toLowerCase().split(''), function(v, i) { value = $.map(value.toLowerCase().split(''), function(v, i) {
if (new RegExp('[0-9a-z' + ((i == 0 || (i == length - 1 && blur)) ? '' : '\-_') + ']')(v)) { if (new RegExp('[0-9a-z' + ((i == 0 || (i == length - 1 && blur)) ? '' : '\-_') + ']').test(v)) {
return v return v
} else { } else {
return null; return null;
@ -3839,7 +3839,7 @@
var split = url.split('/'), var split = url.split('/'),
section = new RegExp( section = new RegExp(
'^ˆ(statistics|users)$' '^ˆ(statistics|users)$'
)(split[1]); ).exec(split[1]);
section = section ? section[0] : 'users'; section = section ? section[0] : 'users';
UI.set({ UI.set({
section: 'site', section: 'site',
@ -3867,7 +3867,7 @@
'^(' + $.map(app.config.itemViews, function(v) { '^(' + $.map(app.config.itemViews, function(v) {
return v.id return v.id
}).join('|') + ')$' }).join('|') + ')$'
)(split[1]); ).exec(split[1]);
view = view ? view[0] : app.user.ui.itemView; view = view ? view[0] : app.user.ui.itemView;
UI.set({ UI.set({
section: 'items', section: 'items',
@ -3900,7 +3900,7 @@
$.each(regexps, function(re, fn) { $.each(regexps, function(re, fn) {
//Ox.print(url, 're', re) //Ox.print(url, 're', re)
re = new RegExp(re); re = new RegExp(re);
if (re(url)) { if (re.test(url)) {
Ox.print('URL re ' + re) Ox.print('URL re ' + re)
fn(url); fn(url);
return false; return false;
@ -3965,7 +3965,7 @@
} }
$.each(regexps, function(re, fn) { $.each(regexps, function(re, fn) {
re = new RegExp(re); re = new RegExp(re);
if (re(url)) { if (re.test(url)) {
fn(); fn();
match = true; match = true;
return false; return false;