-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I'm hoping someone can clarify intent and correct behavior when loading a document using document.open.
Step 23 of https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open says to set the URL of the open()ed document to that of the "responsible document" and we do that by setting the URL from the document we're loading. However, if the responsible document has a fragment identifier, that gets set on the document.open(). This is problematic for the empty fragment which tries to scroll the iframe into view (the scroll into view algorithm specified to use for fragment navigation is recursive for frames). So any page loaded with an empty fragment will always try to scroll any document.open()'d iframes into view.
Should the document-open algorithm specify we should clear fragments? I've noticed a frame loaded via document.open in Firefox keeps the fragment on document.URL and document.baseURI but window.location is about:blank. In contrast, Chrome keeps the URL with fragment on window.location (as well as document.{URL,baseURI}. That seems like a discrepancy too but I'm not sure if it's the cause or incidental.