miguelgrinberg / Flask-PageDown

Implementation of StackOverflow's "PageDown" markdown editor for Flask and Flask-WTF.
MIT License
244 stars 21 forks source link

Check if document.readyState === 'complete' before trying onload listeners #1

Closed kageurufu closed 10 years ago

kageurufu commented 10 years ago

Add check if the document is already ready, and if so skip the onload handlers. Fixes live loading of markdown forms

Otherwise, continue as normal.

I do a lot of server side form rendering (mainly for CSRF tokens) and loading the forms into the page (lightbox, etc) through jquery.load, and this fixes pagedown in those use cases. Does not cause problems otherwise