title: jQuery - split() arrays with only one match = undefined
body: <p>I have a problem with the <code>split()</code> function. 
  I get the error undefined but it dont know why :/</p>
  
  <p>It is easier to explain with a working example: <a href="http://www.jsfiddle.net/V9Euk/415/" rel="nofollow noreferrer">http://www.jsfiddle.net/V9Euk/415/</a></p>
  
  <pre><code>$(function start()
  {
      css('#div { font-color:#ff0000; border:1px solid #00ff00; }', '#div_2 { font-color:#ff0000; }', '#line2 { font-color:#00ffff; }');
  });
  
  
  function css(c0,c1,c2)
  {
      if(c0 != 'undefined')
      {
          c0_selector = c0.match(/^.*{/);
          c0 = c0.replace(/^.*{/,'');
          c0 = c0.replace(/}/,'');
          c0_arr = c0.split(';');        
          values = new Array();
          values[0] = new Array();
          values[0][0] = c0_selector;  
          for (i = 1; i &lt; c0_arr.length; i++)
          {
              values[0][i]= c0_arr[i].split(':');
          }
      }
  
      if(c1 != 'undefined')
      {
          c1_selector = c1.match(/^.*{/);
          c1 = c1.replace(/^.*{/,'');
          c1 = c1.replace(/}/,'');
          c1_arr = c1.split(';');  
          values[1] = new Array();        
          values[1][0] = c1_selector;
          for (i = 1; i &lt; c1_arr.length; i++)
          {
              values[1][i]= c1_arr[i].split(':');
          }
      }
  
      $('#log').append(''+values[0][0]+'&lt;br /&gt;');  
      $('#log').append(''+values[0][1][0]+'&lt;br /&gt;');          
      $('#log').append(''+values[0][1][1]+'&lt;br /&gt;');   
      $('#log').append('&lt;hr /&gt;');  
      $('#log').append(''+values[1][0]+'&lt;br /&gt;');      
      $('#log').append(''+values[1][1][0]+'&lt;br /&gt;');          
      $('#log').append(''+values[1][1][1]+'&lt;br /&gt;');       
  
      $.ajax({
              url: 'test.php',
              type: 'POST',
              dataType: 'json',
              data: $.toJSON(values),
              contentType: 'application/json; charset=utf-8',
              success: function() {
                  alert('success');
              }
      });
  
  }
  </code></pre>
  
  <p>Thanks in advance!
  Peter</p>