r2456 - Fixes a bug whereby String[i] was returning undefined in IE6/7.

r2456 - Fixes a bug whereby String[i] was returning undefined in IE6/7.


Author: powella
Date: Wed Apr 15 14:08:57 2009
New Revision: 2456
Modified:
branches/dev/mask/ui/ui.mask.js
Log:
Fixes a bug whereby String[i] was returning undefined in IE6/7.
Modified: branches/dev/mask/ui/ui.mask.js
==============================================================================
--- branches/dev/mask/ui/ui.mask.js    (original)
+++ branches/dev/mask/ui/ui.mask.js    Wed Apr 15 14:08:57 2009
@@ -143,6 +143,7 @@
            focusText = input.val();
            
        function keydownEvent(e) {
+            e = e || window.event;
            var pos = self.caret(),
                k = e.keyCode,
                keyCode = $.ui.keyCode;
@@ -167,6 +168,8 @@
        function keypressEvent(e) {
+            e = e || window.event;
+            
            var k = e.charCode || e.keyCode || e.which,
                keyCode = $.ui.keyCode,
                len = self.options.mask.length;
@@ -176,7 +179,7 @@
                //Fixes Mac FF bug on backspace
                return (e.keyCode == keyCode.BACKSPACE) ? false : null;
            }
-            e = e || window.event;
+            
            var pos = self.caret();
            if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
@@ -336,9 +339,9 @@
        var mask = this.options.mask,
            literals = [],
            replacements = [];
-        
+                
        for(var i = 0; i < mask.length; i++){
-            var c, temp = mask[i];
+            var c, temp = mask[i] || mask.charAt(i);
            if(temp != "\\" || mask[i-1] == "\\"){
                if(mask[i-1] == "\\"){
                    c = "\t";