ded / domready

lets you know when the dom is ready
MIT License
874 stars 129 forks source link

fix support for ie10 #59

Open mikaelkristiansson opened 5 years ago

mikaelkristiansson commented 5 years ago

doScroll in ie10 needs to be called as a function for hack to work properly.

Fix for issue #53

andrejpavlovic commented 4 years ago

This fix seems to scroll the page down as soon as it loads due to call to doc.documentElement.doScroll(). I'm not sure how this fixes anything. I've logged the bug on gatsby as well: https://github.com/gatsbyjs/gatsby/issues/20582

mikaelkristiansson commented 4 years ago

@andrejpavlovic this fix is because ie10 doesn't support window.onload. we need to create this hack to poll for document to be ready. When it does not return as an error document is ready. What we could do is change it from doScroll() to doScroll('left') to prevent scrolling down.

andrejpavlovic commented 4 years ago

I've seen doScroll('left') being used, so that should work in most cases. I'm not clear where the polling happens, since I don't see a loop in the code. My understanding is that the documentElement.doScroll check is there just to determine if it is <= ie10. Does calling the doScroll function trigger the domloaded event somehow?