url.js
// NOTE: Doesn't do the encoding/decoding dance
Doesn't do the encoding/decoding dance
Doesn ' t do the encoding / decoding dance
function parse(input, isindex) {
      var sequences = input.split('&');
      if (isindex && sequences[0].indexOf('=') === -1)
        sequences[0] = '=' + sequences[0];
      var pairs = [];
      sequences.forEach(function(bytes) {
        if (bytes.length === 0) return;
        var index = bytes.indexOf('=');
        if (index !== -1) {
          var name = bytes.substring(0, index);
          var value = bytes.substring(index + 1);
        } else {
          name = bytes;
          value = '';
        }
        name = name.replace('+', ' ');
        value = value.replace('+', ' ');
        pairs.push({name:name, value:value});
      });
      var output = [];
      pairs.forEach(function(pair) {
        output.push({
          name: decodeURIComponent(pair.name),
          value: decodeURIComponent(pair.value)
        });
      });
      return output; 
    }
function parse ( input , isindex ) { var sequences = input . split ( '&' ) ; if ( isindex && sequences [ 0 ] . indexOf ( '=' ) === - 1 ) sequences [ 0 ] = '=' + sequences [ 0 ] ; var pairs = [ ] ; sequences . forEach ( function ( bytes ) { if ( bytes . length === 0 ) return ; var index = bytes . indexOf ( '=' ) ; if ( index !== - 1 ) { var name = bytes . substring ( 0 , index ) ; var value = bytes . substring ( index + 1 ) ; } else { name = bytes ; value = '' ; } name = name . replace ( '+' , ' ' ) ; value = value . replace ( '+' , ' ' ) ; pairs . push ( { name : name , value : value } ) ; } ) ; var output = [ ] ; pairs . forEach ( function ( pair ) { output . push ( { name : decodeURIComponent ( pair . name ) , value : decodeURIComponent ( pair . value ) } ) ; } ) ; return output ; }
NOTE: Doesn't do the encoding/decoding dance
NOTE : Doesn ' t do the encoding / decoding dance
// Spec bug?