1

I'm just a hobbyist programmer, please bear with me.

I want to change an HTML5 table row's position in a certain table (let's say, from the 5th position to the 22nd) via plain JavaScript (no JQuery etc.). I see 2 possibilities:

A) copy the element's innerHTML and paste it after the 21st row (one can use range for that);
B) append the node somewhere else (e.g., document.getElementById('my-parent-node').appendChild(document.getElementById('my-child-row-node')) ).

What I want to know is: what is faster for the browser to render, option A (changing an element's innerHTML) or option B (appending the existing node somewhere else in the page)? Is there a performance difference at all?

Thank you very much

flen
  • 1,905
  • 1
  • 21
  • 44
  • 1
    Thank you for pointing out the duplicate! I swear I searched for it in google and SO, but couldn'i find it before. I marked it as duplicate for future users that can't find it – flen May 28 '17 at 01:48

0 Answers0