Changeset 1143

Show
Ignore:
Timestamp:
09/25/06 16:42:51 (2 years ago)
Author:
bob@redivi.com
Message:

resolve #109

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mochikit/trunk/MochiKit/Base.js

    r1142 r1143  
    10851085            for (var k in o) { 
    10861086                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 { 
    10881095                    names.push(k); 
    10891096                    values.push(v); 
  • mochikit/trunk/doc/html/MochiKit/Base.html

    r1117 r1143  
    13611361for the case where a poorly designed library has modified 
    13621362<tt class="docutils literal"><span class="pre">Object.prototype</span></tt> and inserted &quot;convenience functions&quot;.</p> 
     1363<p>Values that are Array-like will be expanded as if they were multiply 
     1364defined HTML elements. For example:</p> 
     1365<pre class="literal-block"> 
     1366assert( queryString({a: [1,2]}) === &quot;a=1&amp;a=2&quot; ); 
     1367</pre> 
    13631368<dl class="docutils"> 
    13641369<dt><em>Availability</em>:</dt> 
  • mochikit/trunk/doc/html/MochiKit/VersionHistory.html

    r1142 r1143  
    1616<p>2006-XX-XX      v1.4</p> 
    1717<ul class="simple"> 
     18<li>MochiKit.Base.queryString now handles array values in the same way HTML 
     19forms handle multiple elements of the same name.</li> 
    1820<li>MochiKit.Base.parseQueryString now returns {} for empty query string instead 
    1921of {&quot;&quot;: &quot;undefined&quot;}</li> 
  • mochikit/trunk/doc/html/MochiKit/index.html

    r1142 r1143  
    6969<p>2006-XX-XX      v1.4</p> 
    7070<ul class="simple"> 
     71<li>MochiKit.Base.queryString now handles array values in the same way HTML 
     72forms handle multiple elements of the same name.</li> 
    7173<li>MochiKit.Base.parseQueryString now returns {} for empty query string instead 
    7274of {&quot;&quot;: &quot;undefined&quot;}</li> 
  • mochikit/trunk/doc/rst/MochiKit/Base.rst

    r1117 r1143  
    11491149    ``Object.prototype`` and inserted "convenience functions". 
    11501150 
     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     
    11511156    *Availability*: 
    11521157        Available in MochiKit 1.3.1+ 
  • mochikit/trunk/doc/rst/MochiKit/VersionHistory.rst

    r1142 r1143  
    112006-XX-XX      v1.4 
    22 
     3- MochiKit.Base.queryString now handles array values in the same way HTML 
     4  forms handle multiple elements of the same name. 
    35- MochiKit.Base.parseQueryString now returns {} for empty query string instead 
    46  of {"": "undefined"} 
  • mochikit/trunk/packed/MochiKit/MochiKit.js

    r1142 r1143  
    837837for(var k in o){ 
    838838var v=o[k]; 
    839 if(typeof (v)!="function"){ 
     839if(typeof (v)=="function"){ 
     840continue; 
     841}else{ 
     842if(typeof (v.length)=="number"){ 
     843for(var i=0;i<v.length;i++){ 
     844_125.push(k); 
     845_126.push(v[i]); 
     846
     847}else{ 
    840848_125.push(k); 
    841849_126.push(v); 
     850} 
    842851} 
    843852} 
  • mochikit/trunk/tests/test_Base.js

    r1142 r1143  
    484484    t.is( serializeJSON(parseQueryString("")), "{}", "parseQueryString('')" ); 
    485485    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" ); 
    486489};