cloneNode called on an image element does not clone before element was added to dom (if using relative url)

Issue #13696469 • Assigned to travil


Simon S.
Sep 12, 2017
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

While working on code for the openlayers library ( I found this issue. The following code reproduces the issue:

<!DOCTYPE html>
    <canvas id="cnvs" width="100" height="100"></canvas>
      var img = document.createElement('img');
      img.src = 'images/icon.png'; // it has to be a relative url
      var canvas = document.getElementById('cnvs');
      var context = canvas.getContext('2d');
      img.addEventListener('load', () => {
        var clone = img.cloneNode(true);
        //document.body.appendChild(clone); // if this line is uncommented it works
        context.drawImage(clone, 0, 0);

This -might- be related to


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “travil”

    You need to sign in to your Microsoft account to add a comment.

    Sign in