title: How to extend XMLHttpRequest object in JavaScript?
body: <p>I would like to extend the existing <code>XMLHttpRequest</code> object so that it should work with all the browsers. Now I have been trough with <a href="http://javascript.crockford.com/prototypal.html" rel="nofollow noreferrer">JS inheritance</a> and things however before starting I would like to see good example of it.</p>
  <p>HTML5 has upload and progress events stuff which I would like to implement in inherited new object which can behave even if the feature is not supported by not introducing JS errors to client side. So I would like to achieve something like this:</p>
  <pre><code>Class XMLHttpRequest{}
  Class UploadXMLHttpRequest: XMLHttpRequest{}
  </code></pre>
  <p>Where additional methods can be attached to <code>UploadXMLHttpRequest</code> class like following.</p>
  <pre><code>UploadXMLHttpRequest.prototype.uploadFile = function(file){
  
  }
  </code></pre>
  <p>Considering YUI, jQuery and others are good in market no one really wants to do this made it little difficult for me to find good resources.</p>