This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSDN says IE11 should use "onload" for script tags. What about this?
Or is it okay to just ignore it for IE11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO that's exactly one of those reasons for which browser sniffing is a bad idea. It's unfortunate if code can break just because a new version of a particular browser is released and the sniffing now takes incorrect assumptions.
If this code used feature detection, it would just work in IE11 without having to introduce any changes post-factum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess prior versions of MSIE didn't fire the load event for script tags which aren't added to the DOM or something? Not really sure, MSDN doesn't really offer much useful information about past versions, and I haven't found any issues about it in previous versions from google --- so I'm curious why we're actually using
onreadystatechange
at all thereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caitp It's needed for IE8 and older, the
load
event is not fired there on script elements.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, jQuery 1.x just sets both: https://github.com/jquery/jquery/blob/1.x-master/src/ajax/script.js#L57-77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why a similar approach couldn't be adopted here until XP disappears from the face of the earth