Changeset 1143
- Timestamp:
- 09/25/06 16:42:51 (2 years ago)
- Files:
-
- mochikit/trunk/MochiKit/Base.js (modified) (1 diff)
- mochikit/trunk/doc/html/MochiKit/Base.html (modified) (1 diff)
- mochikit/trunk/doc/html/MochiKit/VersionHistory.html (modified) (1 diff)
- mochikit/trunk/doc/html/MochiKit/index.html (modified) (1 diff)
- mochikit/trunk/doc/rst/MochiKit/Base.rst (modified) (1 diff)
- mochikit/trunk/doc/rst/MochiKit/VersionHistory.rst (modified) (1 diff)
- mochikit/trunk/packed/MochiKit/MochiKit.js (modified) (1 diff)
- mochikit/trunk/tests/test_Base.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mochikit/trunk/MochiKit/Base.js
r1142 r1143 1085 1085 for (var k in o) { 1086 1086 var v = o[k]; 1087 if (typeof(v) != "function") { 1087 if (typeof(v) == "function") { 1088 continue; 1089 } else if (typeof(v.length) == "number") { 1090 for (var i = 0; i < v.length; i++) { 1091 names.push(k); 1092 values.push(v[i]); 1093 } 1094 } else { 1088 1095 names.push(k); 1089 1096 values.push(v); mochikit/trunk/doc/html/MochiKit/Base.html
r1117 r1143 1361 1361 for the case where a poorly designed library has modified 1362 1362 <tt class="docutils literal"><span class="pre">Object.prototype</span></tt> and inserted "convenience functions".</p> 1363 <p>Values that are Array-like will be expanded as if they were multiply 1364 defined HTML elements. For example:</p> 1365 <pre class="literal-block"> 1366 assert( queryString({a: [1,2]}) === "a=1&a=2" ); 1367 </pre> 1363 1368 <dl class="docutils"> 1364 1369 <dt><em>Availability</em>:</dt> mochikit/trunk/doc/html/MochiKit/VersionHistory.html
r1142 r1143 16 16 <p>2006-XX-XX v1.4</p> 17 17 <ul class="simple"> 18 <li>MochiKit.Base.queryString now handles array values in the same way HTML 19 forms handle multiple elements of the same name.</li> 18 20 <li>MochiKit.Base.parseQueryString now returns {} for empty query string instead 19 21 of {"": "undefined"}</li> mochikit/trunk/doc/html/MochiKit/index.html
r1142 r1143 69 69 <p>2006-XX-XX v1.4</p> 70 70 <ul class="simple"> 71 <li>MochiKit.Base.queryString now handles array values in the same way HTML 72 forms handle multiple elements of the same name.</li> 71 73 <li>MochiKit.Base.parseQueryString now returns {} for empty query string instead 72 74 of {"": "undefined"}</li> mochikit/trunk/doc/rst/MochiKit/Base.rst
r1117 r1143 1149 1149 ``Object.prototype`` and inserted "convenience functions". 1150 1150 1151 Values that are Array-like will be expanded as if they were multiply 1152 defined HTML elements. For example:: 1153 1154 assert( queryString({a: [1,2]}) === "a=1&a=2" ); 1155 1151 1156 *Availability*: 1152 1157 Available in MochiKit 1.3.1+ mochikit/trunk/doc/rst/MochiKit/VersionHistory.rst
r1142 r1143 1 1 2006-XX-XX v1.4 2 2 3 - MochiKit.Base.queryString now handles array values in the same way HTML 4 forms handle multiple elements of the same name. 3 5 - MochiKit.Base.parseQueryString now returns {} for empty query string instead 4 6 of {"": "undefined"} mochikit/trunk/packed/MochiKit/MochiKit.js
r1142 r1143 837 837 for(var k in o){ 838 838 var v=o[k]; 839 if(typeof (v)!="function"){ 839 if(typeof (v)=="function"){ 840 continue; 841 }else{ 842 if(typeof (v.length)=="number"){ 843 for(var i=0;i<v.length;i++){ 844 _125.push(k); 845 _126.push(v[i]); 846 } 847 }else{ 840 848 _125.push(k); 841 849 _126.push(v); 850 } 842 851 } 843 852 } mochikit/trunk/tests/test_Base.js
r1142 r1143 484 484 t.is( serializeJSON(parseQueryString("")), "{}", "parseQueryString('')" ); 485 485 t.is( serializeJSON(parseQueryString("", true)), "{}", "parseQueryString('', true)" ); 486 487 /* #109 */ 488 t.is( queryString({ids: [1,2,3]}), "ids=1&ids=2&ids=3", "queryString array value" ); 486 489 };
