You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #59 from UMB-CS-682-Team-03/fix_browser_strangeness
addresses the different behaviors of the browsers when opening a popup and populating the popup DOM through the main window.
In Linux Firefox and Linux Chrome, this behavior deferred as popup.document.readyState was not complete in Firefox while it was in Linux Chrome.
While developing I primarily used Firefox as the main browser neglecting to verify in Chrome resulting in a solution of using DOM event "load" to populate the popup with javascript-generated DOM.
very late into the project, this issue was found in some browsers getting the load event handler working while some browsers were left with blank popup. (windows chrome, edge, brave, linux chrome).
The best possible guess I think is the speed of the js executed in Chrome V8 resulting in the load event being already fired when the event handler was successfully attached to listen for "load" event.
To solve this bizarre case the merge request in openPopup method generates a document fragment and dispatches customEvent to replace the empty popup DOM with one inside the document Fragment.
if popup document readyState is not "completed" the load event will be fired next (MDN)[https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState#complete]
multiple event being fired is possible when "load" event callback was executed before the manually dispatching of custom event but, the subsequent call will have the documentFragment content consumed and the event handler is just a no-op.
0 commit comments