Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36
Chrome 54
Mac OS X 10.11.2
Other
8 years ago
Test name Executions per second
Creation with src 6052.7 Ops/sec
Creation without src 264909.7 Ops/sec
Clone with src 4786.9 Ops/sec
Clone without src 357631.4 Ops/sec
Script Preparation code:
x
 
function makeImage( src ) {
  var img = document.createElement( 'img' );
  img.className='nail';
  if ( src ) {
    img.src='data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
  }
  return img;
}
withSrc = makeImage( true );
withoutSrc = makeImage( false );
Tests:
  • Creation with src

     
    makeImage( true );
  • Creation without src

     
    makeImage( false );
  • Clone with src

     
    withSrc.cloneNode();
  • Clone without src

     
    withoutSrc.cloneNode();