[ Index ] |
|
Code source de Seagull 0.6.1 |
1 /** 2 * Compat functions 3 * @category HTML 4 * @package AJAX 5 * @author Joshua Eichorn <josh@bluga.net> 6 * @copyright 2005 Joshua Eichorn 7 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL 8 */ 9 /** 10 * Functions for compatibility with older browsers 11 */ 12 if (!String.fromCharCode && !String.prototype.fromCharCode) { 13 String.prototype.fromCharCode = function(code) 14 { 15 var h = code.toString(16); 16 if (h.length == 1) { 17 h = '0' + h; 18 } 19 return unescape('%' + h); 20 } 21 } 22 if (!String.charCodeAt && !String.prototype.charCodeAt) { 23 String.prototype.charCodeAt = function(index) 24 { 25 var c = this.charAt(index); 26 for (i = 1; i < 256; i++) { 27 if (String.fromCharCode(i) == c) { 28 return i; 29 } 30 } 31 } 32 } 33 // http://www.crockford.com/javascript/remedial.html 34 if (!Array.splice && !Array.prototype.splice) { 35 Array.prototype.splice = function(s, d) 36 { 37 var max = Math.max, 38 min = Math.min, 39 a = [], // The return value array 40 e, // element 41 i = max(arguments.length - 2, 0), // insert count 42 k = 0, 43 l = this.length, 44 n, // new length 45 v, // delta 46 x; // shift count 47 48 s = s || 0; 49 if (s < 0) { 50 s += l; 51 } 52 s = max(min(s, l), 0); // start point 53 d = max(min(typeof d == 'number' ? d : l, l - s), 0); // delete count 54 v = i - d; 55 n = l + v; 56 while (k < d) { 57 e = this[s + k]; 58 if (!e) { 59 a[k] = e; 60 } 61 k += 1; 62 } 63 x = l - s - d; 64 if (v < 0) { 65 k = s + i; 66 while (x) { 67 this[k] = this[k - v]; 68 k += 1; 69 x -= 1; 70 } 71 this.length = n; 72 } else if (v > 0) { 73 k = 1; 74 while (x) { 75 this[n - k] = this[l - k]; 76 k += 1; 77 x -= 1; 78 } 79 } 80 for (k = 0; k < i; ++k) { 81 this[s + k] = arguments[k + 2]; 82 } 83 return a; 84 } 85 } 86 if (!Array.push && !Array.prototype.push) { 87 Array.prototype.push = function() 88 { 89 for (var i = 0, startLength = this.length; i < arguments.length; i++) { 90 this[startLength + i] = arguments[i]; 91 } 92 return this.length; 93 } 94 } 95 if (!Array.pop && !Array.prototype.pop) { 96 Array.prototype.pop = function() 97 { 98 return this.splice(this.length - 1, 1)[0]; 99 } 100 } 101 /* 102 From IE7, version 0.9 (alpha) (2005-08-19) 103 Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) 104 */ 105 if (!DOMParser.parseFromString && window.ActiveXObject) 106 { 107 function DOMParser() {/* empty constructor */}; 108 DOMParser.prototype = { 109 parseFromString: function(str, contentType) { 110 var xmlDocument = new ActiveXObject('Microsoft.XMLDOM'); 111 xmlDocument.loadXML(str); 112 return xmlDocument; 113 } 114 }; 115 116 function XMLSerializer() {/* empty constructor */}; 117 XMLSerializer.prototype = { 118 serializeToString: function(root) { 119 return root.xml || root.outerHTML; 120 } 121 }; 122 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 01:27:52 2007 | par Balluche grâce à PHPXref 0.7 |