-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Unclear "iframe load event steps" for initial load of about:blank in an iframe #490
Copy link
Copy link
Closed
Labels
compatStandard is not web compatible or proprietary feature needs standardizingStandard is not web compatible or proprietary feature needs standardizingtopic: navigation
Description
The spec says that an iframe with no src attribute on first time through process the iframe attributes will queue a task to run iframe load event steps, which dispatches the load event at the iframe element.
For the following test hosted on joshmatthews.net:
<script>var sync_event1 = true;</script>
<iframe id="first" onload="console.log('first - onload from inline: ' + document.querySelector('#first').contentWindow.location + ' ' + sync_event1)"></iframe>
<script>
var iframe1 = document.querySelector('#first');
iframe1.addEventListener('load', function() {
console.log('first - onload during script execution: ' + iframe1.contentWindow.location + ' ' + sync_event1);
});
sync_event1 = false;
</script>
<script>var sync_event2 = true;</script>
<iframe id="second" onload="console.log('second - onload from inline: ' + document.querySelector('#second').contentWindow.location + ' ' + sync_event2)"></iframe>
<script>
var iframe2 = document.querySelector('#second');
iframe2.addEventListener('load', function() {
console.log('second - onload during script execution: ' + iframe2.contentWindow.location + ' ' + sync_event2);
});
iframe2.src = "http://joshmatthews.net";
sync_event2 = false;
</script>I get this output from browsers -
Firefox, Edge:
first - onload from inline: about:blank false
first - onload during script execution: about:blank false
second - onload from inline: http://www.joshmatthews.net/ false
second - onload during script execution: http://www.joshmatthews.net/ false
Chrome, Safari:
first - onload from inline: about:blank true
second - onload from inline: about:blank true
second - onload from inline: http://www.joshmatthews.net/ false
second - onload during script execution: http://www.joshmatthews.net/ false
Specifically, Firefox appears to skip the initial load event for about:blank if the iframe's src is changed before the queued task executes, while Chrome's load event for the initial about:blank load is dispatched synchronously.
What is the intended behaviour here?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
compatStandard is not web compatible or proprietary feature needs standardizingStandard is not web compatible or proprietary feature needs standardizingtopic: navigation