adobe-webplatform / dropcap.js

Beautiful CSS drop caps made easy
Other
929 stars 70 forks source link

`dropcapRef instanceof HTMLElement` fails in Chrome when using iframes #12

Open BrendanBerkley opened 9 years ago

BrendanBerkley commented 9 years ago

Here's an edge case for you!

Working with this library in conjunction with another JS library that uses iframes. It was working fine in Firefox but crashing Chrome. Debugged for awhile and learned that Chrome handles objects inside of an iframe differently than Firefox, as is discussed in this answer on Stack Overflow.

My super-quick solution was to add a fourth parameter to Dropcap.layout called "disableCheck" - if set to True, it'll ignore the check. Figured that wouldn't fly as a pull request, but I'm not sure how to do it better.