<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -68,9 +68,9 @@ jQuery.fn.extend({
 		});
 	},
 
-	add: function( selector ) {
+	add: function( selector, context ) {
 		var set = typeof selector === &quot;string&quot; ?
-				jQuery( selector ) :
+				jQuery( selector, context || this.context ) :
 				jQuery.makeArray( selector ),
 			all = jQuery.merge( this.get(), set );
 
@@ -185,4 +185,4 @@ jQuery.extend({
 
 		return r;
 	}
-});
\ No newline at end of file
+});</diff>
      <filename>src/traversing.js</filename>
    </modified>
    <modified>
      <diff>@@ -436,6 +436,18 @@ test(&quot;add(String|Element|Array|undefined)&quot;, function() {
 	ok( jQuery([]).add( document.getElementById('form') ).length &gt;= 13, &quot;Add a form (adds the elements)&quot; );
 });
 
+test(&quot;add(String, Context)&quot;, function() {
+	expect(6);
+
+	equals( jQuery(document).add(&quot;#form&quot;).length, 2, &quot;Make sure that using regular context document still works.&quot; );
+	equals( jQuery(document.body).add(&quot;#form&quot;).length, 2, &quot;Using a body context.&quot; );
+	equals( jQuery(document.body).add(&quot;#html&quot;).length, 1, &quot;Using a body context.&quot; );
+
+	equals( jQuery(document).add(&quot;#form&quot;, document).length, 2, &quot;Use a passed in document context.&quot; );
+	equals( jQuery(document).add(&quot;#form&quot;, document.body).length, 2, &quot;Use a passed in body context.&quot; );
+	equals( jQuery(document).add(&quot;#html&quot;, document.body).length, 1, &quot;Use a passed in body context.&quot; );
+});
+
 test(&quot;each(Function)&quot;, function() {
 	expect(1);
 	var div = jQuery(&quot;div&quot;);</diff>
      <filename>test/unit/core.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ef05f44cce870a8b78637b0a88b27087f7f13b37</id>
    </parent>
  </parents>
  <author>
    <name>John Resig</name>
    <email>jeresig@gmail.com</email>
  </author>
  <url>http://github.com/jquery/jquery/commit/b0fe380cf89564305646bbd55d1fd7bd210fd591</url>
  <id>b0fe380cf89564305646bbd55d1fd7bd210fd591</id>
  <committed-date>2009-11-07T07:43:31-08:00</committed-date>
  <authored-date>2009-11-07T07:43:31-08:00</authored-date>
  <message>Make .add() take an optional context and - if a context is specified in the root selector - use that as the base context.</message>
  <tree>ba6cb8ade9535efb386a9c1ec3ecd695ee2a681a</tree>
  <committer>
    <name>John Resig</name>
    <email>jeresig@gmail.com</email>
  </committer>
</commit>
