1/*jshint strict:true, browser:true, curly:true, eqeqeq:true, expr:true, forin:true, latedef:true, newcap:true, noarg:true, trailing: true, undef:true, unused:true */ 2/** 3 * File: clientside_validation.ie8.js 4 * Version: 7.x-1.x 5 * Description: ECMA-262, 5th edition support for IE <= 8 6 * Language: Javascript 7 * Project: clientside_validation 8 * @module clientside_validation 9 */ 10(function(){ 11"use strict"; 12 13/* 14 * Support for String.trim 15 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim#Compatibility 16 */ 17if(!String.prototype.trim) { 18 String.prototype.trim = function () { 19 return this.replace(/^\s+|\s+$/g,''); 20 }; 21} 22 23/* 24 * Support for Array.indexOf 25 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf#Compatibility 26 */ 27if (!Array.prototype.indexOf) { 28 Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { 29 if (this === null) { 30 throw new TypeError(); 31 } 32 var t = Object(this); 33 var len = t.length >>> 0; 34 if (len === 0) { 35 return -1; 36 } 37 var n = 0; 38 if (arguments.length > 0) { 39 n = Number(arguments[1]); 40 if (n !== n) { // shortcut for verifying if it's NaN 41 n = 0; 42 } else if (n !== 0 && n !== Infinity && n !== -Infinity) { 43 n = (n > 0 || -1) * Math.floor(Math.abs(n)); 44 } 45 } 46 if (n >= len) { 47 return -1; 48 } 49 var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); 50 for (; k < len; k++) { 51 if (k in t && t[k] === searchElement) { 52 return k; 53 } 54 } 55 return -1; 56 }; 57} 58 59/* 60 * Support for Array.lastIndexOf 61 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf#Compatibility 62 */ 63if (!Array.prototype.lastIndexOf) 64{ 65 Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) 66 { 67 68 if (this === null) { 69 throw new TypeError(); 70 } 71 72 var t = Object(this); 73 var len = t.length >>> 0; 74 if (len === 0) { 75 return -1; 76 } 77 78 var n = len; 79 if (arguments.length > 1) 80 { 81 n = Number(arguments[1]); 82 if (n !== n) { 83 n = 0; 84 } 85 else if (n !== 0 && n !== Infinity && n !== -Infinity) { 86 n = (n > 0 || -1) * Math.floor(Math.abs(n)); 87 } 88 } 89 90 var k = n >= 0 91 ? Math.min(n, len - 1) 92 : len - Math.abs(n); 93 94 for (; k >= 0; k--) 95 { 96 if (k in t && t[k] === searchElement) { 97 return k; 98 } 99 } 100 return -1; 101 }; 102} 103 104/* 105 * Support for Array.filter 106 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter#Compatibility 107 */ 108if (!Array.prototype.filter) 109{ 110 Array.prototype.filter = function(fun /*, thisp */) 111 { 112 113 if (this === null) { 114 throw new TypeError(); 115 } 116 117 var t = Object(this); 118 var len = t.length >>> 0; 119 if (typeof fun !== "function") { 120 throw new TypeError(); 121 } 122 123 var res = []; 124 var thisp = arguments[1]; 125 for (var i = 0; i < len; i++) 126 { 127 if (i in t) 128 { 129 var val = t[i]; // in case fun mutates this 130 if (fun.call(thisp, val, i, t)) { 131 res.push(val); 132 } 133 } 134 } 135 136 return res; 137 }; 138} 139 140/* 141 * Support for Array.map 142 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map#Browser_compatibility 143 */ 144// Production steps of ECMA-262, Edition 5, 15.4.4.19 145// Reference: http://es5.github.com/#x15.4.4.19 146if (!Array.prototype.map) { 147 Array.prototype.map = function(callback, thisArg) { 148 149 var T, A, k; 150 151 if (this === null) { 152 throw new TypeError(" this is null or not defined"); 153 } 154 155 // 1. Let O be the result of calling ToObject passing the |this| value as the argument. 156 var O = Object(this); 157 158 // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". 159 // 3. Let len be ToUint32(lenValue). 160 var len = O.length >>> 0; 161 162 // 4. If IsCallable(callback) is false, throw a TypeError exception. 163 // See: http://es5.github.com/#x9.11 164 if ({}.toString.call(callback) !== "[object Function]") { 165 throw new TypeError(callback + " is not a function"); 166 } 167 168 // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. 169 if (thisArg) { 170 T = thisArg; 171 } 172 173 // 6. Let A be a new array created as if by the expression new Array(len) where Array is 174 // the standard built-in constructor with that name and len is the value of len. 175 A = new Array(len); 176 177 // 7. Let k be 0 178 k = 0; 179 180 // 8. Repeat, while k < len 181 while(k < len) { 182 183 var kValue, mappedValue; 184 185 // a. Let Pk be ToString(k). 186 // This is implicit for LHS operands of the in operator
187 // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. 188 // This step can be combined with c 189 // c. If kPresent is true, then 190 if (k in O) { 191 192 // i. Let kValue be the result of calling the Get internal method of O with argument Pk. 193 kValue = O[ k ]; 194 195 // ii. Let mappedValue be the result of calling the Call internal method of callback 196 // with T as the this value and argument list containing kValue, k, and O. 197 mappedValue = callback.call(T, kValue, k, O); 198 199 // iii. Call the DefineOwnProperty internal method of A with arguments 200 // Pk, Property Descriptor {Value: mappedValue, Writable: true, Enumerable: true, Configurable: true}, 201 // and false. 202 203 // In browsers that support Object.defineProperty, use the following: 204 // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); 205 206 // For best browser support, use the following: 207 A[ k ] = mappedValue; 208 } 209 // d. Increase k by 1. 210 k++; 211 } 212 213 // 9. return A 214 return A; 215 }; 216} 217})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.