-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Remove old IE support #3277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove old IE support #3277
Conversation
| function matches(elt, selector) { | ||
| // @ts-ignore: non-standard properties for browser compatibility | ||
| // noinspection JSUnresolvedVariable | ||
| const matchesFunction = elt instanceof Element && (elt.matches || elt.matchesSelector || elt.msMatchesSelector || elt.mozMatchesSelector || elt.webkitMatchesSelector || elt.oMatchesSelector) |
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.
all supported browsers have long since moved to support .matches in the last 10 years so we don't need this fallback now
src/htmx.js
Outdated
| return | ||
| } | ||
| // Ensure only valid Elements and not shadow DOM roots are inited | ||
| if (elt instanceof Element) return |
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.
ensure only elements that can have attribute which need hashing and can have hx-attributes are processed to avoid processing shadow dom root nodes
| } else if (console.log) { | ||
| console.log('ERROR: ', msg) | ||
| } | ||
| console.error(msg) |
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.
console.error is standard in all supported browsers now
Telroshan
left a comment
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.
Good riddance if you ask me!
Description
I've looked at all cases of IE fallbacks that can be removed now that IE 11 is no longer supported by htmx 2.x.
I've included all possible old browser compatibility checks I could find but it may be possible to roll back some of these changes
As well as just safely removing dead un-needed fallbacks I also found three bugs that the removals have also forced me to address
1st is NormalizePath() which does not function at all as calling new URL(path) without an origin domain added as a second parameter is designed to throw errors every time causing the IE11 fallback to happen for ALL calls to normalizePath and this fallback does zero normalization. I don't think this lost functionality would have caused big issues as this function is only used to set and restore paths to history so even if it is broken it was consistently broken so broken paths going into history cache came out with the same non normalized path most of the time. After this change it normalizes properly again
2nd I found shadow dom tests were calling process/init node on the shadow dom root node itself which are not possible to init properly because this node can't have attributes. The IE fallback was preventing any errors but it was leaving rubbish htmx internal data on the shadow root nodes then. only processing elements resolved the shadow dom tests failing.
3rd there is a minor issue where after removing the IE fallback for if verifyPath() I found situations where new URL() will fail if things like srcdoc iframes have invalid origins. Found using window.origin as a fallback when these null origins from
about:protocol situations resolved the issue.Corresponding issue:
Testing
Performed extensive testing with the test suite and used my work on the loc coverage reporting to track down and test the dead branches.
Checklist
masterfor website changes,devforsource changes)
approved via an issue
npm run test) and verified that it succeeded