<link> - will fire 'load' event twice if the href is changed while in document fragment

Confirmed Issue #7940171 • Assigned to Jose L.

Details

Author
Michael B.
Created
Jun 20, 2016
Privacy
This issue is public.
Found in
  • Internet Explorer
Found in build #
11
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

  1. Create a page with the following:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body id="body">
  <script>
    var frag = document.createDocumentFragment();
    var link = document.createElement('link');

    link.addEventListener('load', function() {
      console.log('load event fired');
    });

    frag.appendChild(link);

    link.rel = 'stylesheet';
    link.href = 'main.css';

    setTimeout(function() {
      link.href = 'main.css?param=value';
      document.head.appendChild(link);
    },100);
  </script>
</body>
</html>
  1. Create a main.css file at the same path.

  2. Load the page in IE11 and view the developer console.

Expected result:
The load event fired message only appears once, as the load event should only fire once.

Actual result:
The message is displayed twice because the load event is fired twice. Notice the event payloads both refer to the edited href, and not the original.

Attachments

1 attachment

Comments and activity

  • After some more research, I’ve noticed it doesn’t necessarily need to be a document fragment. Appending the link to any element not in the DOM causes the issue.

  • Microsoft Edge Team

    Changed Assigned To to “Travis L.”

    Changed Status to “Confirmed”

    Changed Title from “IE11 - Link element will fire 'load' event twice if the href is changed while in document fragment” to “<link> - will fire 'load' event twice if the href is changed while in document fragment”

    Changed Assigned To from “Travis L.” to “Jose L.”

  • Thank
    you for the feedback. We have triaged this issue and given other work in this
    area this wouldn’t make the bug bar for coming release. I have marked your
    feedback for further consideration and we hope to get back to it in one of the
    future releases.

     

    Best
    regards,

    The
    MS Edge Team

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

Sign in