Be a candidate

 

See the Pen Test election by dupont (@dupontcodepen) on CodePen.

insertion dans le DOM : comparaison

  1. <body>
  2.     <script>
  3.         function strToDom(str){
  4.             return document.createRange().createContextualFragment(str).firstChild;
  5.         }
  6.         const mydiv = strToDom(`<div class="div">document.createRange().createContextualFragment</div>`);
  7.         document.body.appendChild(mydiv);

  8.         document.body.insertAdjacentHTML(`afterBegin`,`<div class="div"> document.insertAdjacentHTML</div>`)
  9.     </script>
  10. </body>