title: HTML5 validation: field not required but, if filled in, must match pattern?
body: <p>Playing around with HTML5 validation, it occurs to me that it is (seemingly) not possible to validate the input of a field <strong>unless</strong> it is required.</p>
  
  <p>In other words, it's not possible to say "this field is not required, but if you <strong>do</strong> fill it in, it must match pattern X." For example:</p>
  
  <pre><code>&lt;textarea pattern='.{5,10}'&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>With 1-4 characters (inclusive) entered into the textarea, running <code>element.willValidate</code> and <code>element.checkValidity()</code> both return true.</p>
  
  <p>I know HTML5 validation isn't perfect just yet. Is the "validate only if it's filled in" concept not possible with HTML5?</p>