chuanxshi / javascript-patterns

JavaScript Design Patterns
http://shichuan.github.io/javascript-patterns
9.39k stars 1.69k forks source link

jQuery.detach() Pattern May Yield Unexpected Results #29

Closed zikes closed 12 years ago

zikes commented 12 years ago

Currently the pattern for detaching an element from the DOM before manipulating and reinserting it does not account for its position within the parent element. In the example given at https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/detach.html if the table were the first child element under the parent it would end up as the last child element once the operation completed.

chuanxshi commented 12 years ago

Thanks for the comment, but this pattern is only a simple demo of the concept. In real life development, developer can take particular factors into consideration.