+ jQuery('#sap').prepend(val( jQuery("#yahoo, #first") ));
+ equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" );
+};
+
+test("prepend(String|Element|Array<Element>|jQuery)", function() {
+ testPrepend(bareObj);
+});
+
+test("prepend(Function)", function() {
+ testPrepend(functionReturningObj);
+});
+
+test("prepend(Function) with incoming value", function() {
+ expect(10);
+
+ var defaultText = 'Try them out:', old = jQuery('#first').html();
+ var result = jQuery('#first').prepend(function(i, val) {
+ equals( val, old, "Make sure the incoming value is correct." );
+ return '<b>buga</b>';
+ });
+ equals( result.text(), 'buga' + defaultText, 'Check if text prepending works' );
+
+ old = jQuery("#select3").html();
+
+ equals( jQuery('#select3').prepend(function(i, val) {
+ equals( val, old, "Make sure the incoming value is correct." );
+ return '<option value="prependTest">Prepend Test</option>';
+ }).find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element');
+
+ QUnit.reset();
+ var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
+ old = jQuery('#sap').html();
+
+ jQuery('#sap').prepend(function(i, val) {
+ equals( val, old, "Make sure the incoming value is correct." );
+ return document.getElementById('first');
+ });
+
+ equals( jQuery('#sap').text(), expected, "Check for prepending of element" );
+
+ QUnit.reset();
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
+ old = jQuery('#sap').html();
+
+ jQuery('#sap').prepend(function(i, val) {
+ equals( val, old, "Make sure the incoming value is correct." );
+ return [document.getElementById('first'), document.getElementById('yahoo')];
+ });
+
+ equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" );
+
+ QUnit.reset();
+ expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
+ old = jQuery('#sap').html();
+
+ jQuery('#sap').prepend(function(i, val) {
+ equals( val, old, "Make sure the incoming value is correct." );
+ return jQuery("#yahoo, #first");
+ });
+
+ equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" );