I am testing in Internet Explorer 8 on Windows XP and am getting into a tedious error. I am trying to check lines with a regex that works fine in firefox and works fine independently in the ie8 console.
But when it is through my close function, the line acts strangely
[Edit] More detailed code: Not as good as the previous snippet.
var m_TableSorter = (function() {
var dateRegEx = new RegExp(
"(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s\\d{4}");
...
...
function greaterThan(left, right) {
window["globalLeft"] = left;
window["globalRight"] = right;
var a = $.trim(left.toLowerCase());
var b = $.trim(right.toLowerCase());
window["globalA"] = a.toString();
window["globalReg"] = dateRegEx;
if (dateRegEx.test(a) && dateRegEx.test(b)) {
var yearA = parseInt(a.substring(4,8), 10);
var yearB = parseInt(b.substring(4,8), 10);
if (yearA > yearB) {
return true;
} else if (yearB > yearA) {
return false;
} else {
var monthA =
$.inArray(a.substring(0,3).toUpperCase(), monthArray);
var monthB =
$.inArray(b.substring(0,3).toUpperCase(), monthArray);
m_Debug.tryAssert(monthA >= 0, "Date string malformed");
m_Debug.tryAssert(monthB >= 0, "Date string malformed");
if (monthA > monthB) {
return true;
} else {
return false;
}
}
}
if ( a.toUpperCase() >= b.toUpperCase() ) {
return true;
}
return false;
}
function mergeArrays(pr_left, pr_right, pr_compareFunction, pr_rowIndex)
{
m_Debug.debugUtilityFunction(arguments);
var results = new Array();
var obj;
while (pr_left.length > 0 || pr_right.length > 0) {
if (pr_left.length > 0 && pr_right.length > 0) {
window["globalLeft1"] = $(pr_left[0].children[pr_rowIndex]).text().toString();
window["globalRight1"] = $(pr_right[0].children[pr_rowIndex]).text().toString();
var bool = pr_compareFunction(
$.trim($(pr_left[0].children[pr_rowIndex]).text()),
$.trim($(pr_right[0].children[pr_rowIndex]).text())
);
if (bool) {
results.push(pr_left.shift());
} else {
results.push(pr_right.shift());
}
} else if (pr_left.length > 0) {
for (obj in pr_left) {
results.push(pr_left[obj]);
}
break;
} else if (pr_right.length > 0) {
for (obj in pr_right) {
results.push(pr_right[obj]);
}
break;
}
}
return results;
}
For function mergeArrays pr_leftu pr_right, a jQuery list of TR objects is presented. and im comparing text in a pr_rowIndex-throw cell for two rows.
pr_compareFunction more.
dateRegEx.test (a) returns false, because string a is listening.
Testing in ie8 console tells me that
globalA.toLowerCase() == "sep 2010"
false. alert(globalA) "sep 2010" alert(globalLeft) "Sep 2010". .length , .
globalLeft1 == globalLeft , .
, JScript . , .
[ ]
javascript, , . , .