} else if ( jQuery.isFunction( selector ) )
return jQuery( document ).ready( selector );
+ // Make sure that old selector state is passed along
+ if ( selector.selector && selector.context ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
return this.setArray(jQuery.makeArray(selector));
},
});
test("selector state", function() {
- expect(26);
+ expect(28);
var test;
test = jQuery("#main", document.body);
equals( test.selector, "#main", "#main Selector" );
equals( test.context, document.body, "#main Context" );
+
+ // Test cloning
+ test = jQuery(test);
+ equals( test.selector, "#main", "#main Selector" );
+ equals( test.context, document.body, "#main Context" );
test = jQuery(document.body).find("#main");
equals( test.selector, "#main", "#main find Selector" );