Is there a way to make native function chainable?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1099628/how-does-basic-object-function-chaining-work-in-javascript">How does basic object/function chaining work in javascript?</a>  </p>
</blockquote>



<p>Is there a way to make native function chainable?</p>

<p>For example, I want to do this:</p>

<pre><code>var ele = document
            .createElement("div")
            .setAttribute("id", "foo")
            .focus();
</code></pre>

<p>instead of this:</p>

<pre><code>var ele = document.createElement("div");
ele.setAttribute("id", "foo");
ele.focus();
</code></pre>

<p>Is there a way to do that? If it is possible, then it will definitely save me a lot of typing works.</p>
