3

In the newly released Safari 10.1 (macOS Sierra), the browser seems to fire the load events (document.DOMContentLoaded and window.load) before flexbox is done calculating widths and heights.

I have a script that calculates the height of an element in order to decide whether the content should be split into multiple elements.

The solution renders invoices that are printed on dead trees which is why the content needs to be split into separat actual elements.

Is there any other event that I can listen to in order to execute the script once flexbox has done it's magic?

The solution works perfectly on Chrome, Internet Explorer, Firefox, Opera and older versions of Safari.I can make it work in Safari 10.1 by using setTimeout of 100ms but that feels kind of hacky.

  • You can probably use a setTimeout of 0ms as well. I experienced a similair problem, and that is how it resolved for me. See for more explanation about the huh, wtf, why, how!? > https://www.youtube.com/watch?v=8aGhZQkoFbQ – user007 May 21 '17 at 12:36
  • Hey, did you find something less hacky by any chance? I have the exact same printing context, and exactly the same problem :) `DOMContentLoaded` is triggered way too early and the text isn't even rendered :( – sjahan Oct 14 '19 at 12:45
  • I'm afraid not. I'm not longer at the company but I believe we ended up using the setTimeout. – Carl-Fredrik Herö Oct 14 '19 at 21:07

0 Answers0