update jQuery.append, prepend, before and after

This commit is contained in:
kimamula
2015-09-30 00:26:52 +09:00
parent ffceea9dd1
commit 83993bac95
2 changed files with 22 additions and 11 deletions
+14 -3
View File
@@ -41,7 +41,7 @@ function test_addClass() {
function test_after() {
$('.inner').after('<p>Test</p>');
$('<div/>').after('<p></p>');
$('<div/>').after('<p></p>').after(document.createDocumentFragment());
$('<div/>').after('<p></p>').addClass('foo')
.filter('p').attr('id', 'bar').html('hello')
.end()
@@ -504,7 +504,7 @@ function test_toggle() {
function test_append() {
$('.inner').append('<p>Test</p>');
$('.container').append($('h2'));
$('.container').append($('h2')).append(document.createDocumentFragment());
var $newdiv1 = $('<div id="object1"/>'),
newdiv2 = document.createElement('div'),
@@ -554,7 +554,7 @@ function test_attributeSelectors() {
function test_before() {
$('.inner').before('<p>Test</p>');
$('.container').before($('h2'));
$('.container').before($('h2')).before(document.createDocumentFragment());
$("<div/>").before("<p></p>");
var $newdiv1 = $('<div id="object1"/>'),
newdiv2 = document.createElement('div'),
@@ -941,6 +941,17 @@ function test_clone() {
.clone());
}
function test_prepend() {
$('.inner').prepend('<p>Test</p>');
$('.container').prepend($('h2')).prepend(document.createDocumentFragment());
var $newdiv1 = $('<div id="object1"/>'),
newdiv2 = document.createElement('div'),
existingdiv1 = document.getElementById('foo');
$('body').prepend($newdiv1, [newdiv2, existingdiv1]);
}
function test_prependTo() {
$("<p>Test</p>").prependTo(".inner");
$("h2").prependTo($(".container"));
+8 -8
View File
@@ -2579,10 +2579,10 @@ interface JQuery {
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
* param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements.
* param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
*/
after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery;
after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
@@ -2593,10 +2593,10 @@ interface JQuery {
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
* param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
* param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
*/
append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery;
append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
@@ -2614,10 +2614,10 @@ interface JQuery {
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
* param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements.
* param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.
*/
before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery;
before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
@@ -2662,10 +2662,10 @@ interface JQuery {
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*
* param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
* param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
*/
prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery;
prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*