var x = $([]).add($("<p id='x1'>xxx</p>")).add($("<p id='x2'>xxx</p>"));\r
ok( x[0].id == "x1", "Check on-the-fly element1" );\r
ok( x[1].id == "x2", "Check on-the-fly element2" );\r
+ \r
+ var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");\r
+ ok( x[0].id == "x1", "Check on-the-fly element1" );\r
+ ok( x[1].id == "x2", "Check on-the-fly element2" );\r
});\r
\r
test("each(Function)", function() {\r
* @param String expr An expression whose matched elements are added
* @cat DOM/Traversing
*/
+
+ /**
+ * Adds the on the fly created elements to the jQuery object.
+ *
+ * @example $("p").add("<span>Again</span>")
+ * @before <p>Hello</p>
+ * @result [ <p>Hello</p>, <span>Again</span> ]
+ *
+ * @name add
+ * @type jQuery
+ * @param String html A string of HTML to create on the fly.
+ * @cat DOM/Traversing
+ */
/**
* Adds one or more Elements to the set of matched elements.
add: function(t) {
return this.set( jQuery.merge(
this.get(),
- typeof t == "string" ? jQuery.find(t) : t )
+ typeof t == "string" ? jQuery(t).get() : t )
);
},