Changeset 5511
- Timestamp:
- 11/13/06 10:32:12 (2 years ago)
- Files:
-
- spinoffs/scriptaculous/CHANGELOG (modified) (1 diff)
- spinoffs/scriptaculous/lib/prototype.js (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/scriptaculous/CHANGELOG
r5468 r5511 1 * Update to Prototype 1.5.0_rc2 2 1 3 *V1.6.5* (November 8, 2006) 2 4 spinoffs/scriptaculous/lib/prototype.js
r5468 r5511 1 /* Prototype JavaScript framework, version 1.5.0_rc 12 * (c) 2005 Sam Stephenson <sam@conio.net>1 /* Prototype JavaScript framework, version 1.5.0_rc2 2 * (c) 2005, 2006 Sam Stephenson <sam@conio.net> 3 3 * 4 4 * Prototype is freely distributable under the terms of an MIT-style license. … … 8 8 9 9 var Prototype = { 10 Version: '1.5.0_rc 1',10 Version: '1.5.0_rc2', 11 11 BrowserFeatures: { 12 12 XPath: !!document.evaluate … … 101 101 var returnValue; 102 102 103 for (var i = 0 ; i < arguments.length; i++) {103 for (var i = 0, length = arguments.length; i < length; i++) { 104 104 var lambda = arguments[i]; 105 105 try { … … 222 222 }, 223 223 224 toQueryParams: function( ) {225 var match = this.strip().match(/ [^?]*$/)[0];224 toQueryParams: function(separator) { 225 var match = this.strip().match(/([^?#]*)(#.*)?$/); 226 226 if (!match) return {}; 227 var pairs = match.split('&'); 228 return pairs.inject({}, function(params, pairString) { 229 var pair = pairString.split('='); 230 var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; 231 params[decodeURIComponent(pair[0])] = value; 232 return params; 227 228 return match[1].split(separator || '&').inject({}, function(hash, pair) { 229 if ((pair = pair.split('='))[0]) { 230 var name = decodeURIComponent(pair[0]); 231 var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; 232 233 if (hash[name] !== undefined) { 234 if (hash[name].constructor != Array) 235 hash[name] = [hash[name]]; 236 if (value) hash[name].push(value); 237 } 238 else hash[name] = value; 239 } 240 return hash; 233 241 }); 234 242 }, … … 603 611 toQueryString: function() { 604 612 return this.map(function(pair) { 605 if (!pair.value && pair.value !== 0) pair[1] = ''; 606 if (!pair.key) return; 613 if (!pair.key) return null; 614 615 if (pair.value && pair.value.constructor == Array) { 616 pair.value = pair.value.compact(); 617 618 if (pair.value.length < 2) { 619 pair.value = pair.value.reduce(); 620 } else { 621 var key = encodeURIComponent(pair.key); 622 return pair.value.map(function(value) { 623 return key + '=' + encodeURIComponent(value); 624 }).join('&'); 625 } 626 } 627 628 if (pair.value == undefined) pair[1] = ''; 607 629 return pair.map(encodeURIComponent).join('='); 608 630 }).join('&'); … … 806 828 807 829 if (typeof extras.push == 'function') 808 for (var i = 0 ; i < extras.length; i += 2)830 for (var i = 0, length = extras.length; i < length; i += 2) 809 831 headers[extras[i]] = extras[i+1]; 810 832 else … … 978 1000 var query = document.evaluate(expression, $(parentElement) || document, 979 1001 null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 980 for (var i = 0, len = query.snapshotLength; i < len; i++)1002 for (var i = 0, length = query.snapshotLength; i < length; i++) 981 1003 results.push(query.snapshotItem(i)); 982 1004 return results; … … 1017 1039 Object.extend(methods, Form.Element.Methods); 1018 1040 1041 Object.extend(methods, Element.Methods.Simulated); 1042 1019 1043 for (var property in methods) { 1020 1044 var value = methods[property]; 1021 if (typeof value == 'function') 1022 element[property] = cache.findOrStore(value); 1023 } 1024 1025 var methods = Object.clone(Element.Methods.Simulated), cache = Element.extend.cache; 1026 for (var property in methods) { 1027 var value = methods[property]; 1028 if ('function' == typeof value && !(property in element)) 1045 if (typeof value == 'function' && !(property in element)) 1029 1046 element[property] = cache.findOrStore(value); 1030 1047 } … … 1120 1137 }, 1121 1138 1139 immediateDescendants: function(element) { 1140 if (!(element = $(element).firstChild)) return []; 1141 while (element && element.nodeType != 1) element = element.nextSibling; 1142 if (element) return [element].concat($(element).nextSiblings()); 1143 return []; 1144 }, 1145 1122 1146 previousSiblings: function(element) { 1123 1147 return $(element).recursivelyCollect('previousSibling'); … … 1164 1188 element = $(element); 1165 1189 return document.getElementsByClassName(className, element); 1190 }, 1191 1192 readAttribute: function(element, name) { 1193 return $(element).getAttribute(name); 1166 1194 }, 1167 1195 … … 1344 1372 html = typeof html == 'undefined' ? '' : html.toString(); 1345 1373 var tagName = element.tagName.toUpperCase(); 1346 if (['THEAD','TBODY','TR','TD'].in dexOf(tagName) > -1) {1374 if (['THEAD','TBODY','TR','TD'].include(tagName)) { 1347 1375 var div = document.createElement('div'); 1348 1376 switch (tagName) { … … 1429 1457 this.element.insertAdjacentHTML(this.adjacency, this.content); 1430 1458 } catch (e) { 1431 var tagName = this.element.tagName.to LowerCase();1432 if ( tagName == 'tbody' || tagName == 'tr') {1459 var tagName = this.element.tagName.toUpperCase(); 1460 if (['TBODY', 'TR'].include(tagName)) { 1433 1461 this.insertContent(this.contentFromAnonymousTable()); 1434 1462 } else { … … 1591 1619 conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); 1592 1620 if ((clause = params.classNames).length > 0) 1593 for (var i = 0 ; i < clause.length; i++)1621 for (var i = 0, length = clause.length; i < length; i++) 1594 1622 conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')'); 1595 1623 if (clause = params.attributes) { … … 1870 1898 selectMany: function(element) { 1871 1899 var value = []; 1872 for (var i = 0 ; i < element.length; i++) {1900 for (var i = 0, length = element.length; i < length; i++) { 1873 1901 var opt = Element.extend(element.options[i]); 1874 1902 if (opt.selected)