jquery - change in .appendTo() in jquery1.9.1 -


i trying understand change in behavior of .appendto() api in jquery 1.9.1 version previous versions. in upgrade guide says

as of 1.9, these methods(.appendto, .insertbefore, .insertafter, , .replaceall) return new set, making them consistently usable chaining , .end() method. prior 1.9, return old set if there single target element. note these methods have returned aggregate set of elements appended target elements.

i tried simple usage of api

<div class="test">hello </div> 

var $ = jquery.noconflict(); var =$("<p> hi </p>").appendto("div.test").attr("style","background-color:red"); console.log(a); 

here fiddle link

i appending paragraph element div , changing background of resulting element. tried both 1.7.2 , 1.9.1 in both cases result after appending paragraph element.

but has been explained in document prior 1.9 return old set(in example old set refers div element believe). having wrong idea this.

please in correcting understanding.

"these methods have returned aggregate set of elements appended" means returns jquery collection on appendto() called -- not set passed function.

this paragraph, in case. should return regardless of jquery version using long "div.test" single-element target (and, way, don't mean $('div.test')?), or if using v 1.9, long "div.test" returns at least one element.

this case jquery chaining calls -- funciton returns element called on may continue doing other things it. beleive case all of manipulation subset of jquery functions.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -