-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Allow setting the Fallback via global #29
Comments
If I remember, TypeScript wouldn't allow you to re-declare something. |
After https://github.com/g-plane/typed-query-selector/releases/tag/v2.9.0 , you don't need that helper to shim |
In the end I didn't use this because I had altered my types to accept arrays of selectors too: However 4534a0c isn't technically correct because any HTML5 document can still contain SVG tags. Try this on https://developer.mozilla.org/en-US/ document.querySelector('svg') instanceof HTMLElement // => false document.querySelector('svg') instanceof SVGElement // => true |
In practice however this only happens when both of these are true:
|
Oh, I didn't realize that. You're right, but we can leave it and re-consider it once we receive feedback about the types. |
This also happens if the user selects inside MathML (which does not use HTMLElement either). It would be great to move those "unsafe" fallbacks to a separate shim file to make them opt-in |
@g-plane is there any plan to split those unsafe fallbacks to a separate shim ? |
It's better to revert this change and default to |
I'm also fine with a complete revert, as that would bring back correctness |
It's reverted in v2.10.0. |
Thanks |
The current solution to change the fallback from
Element
toHTMLElement
is to copy the contents of the shim and make a change, like I did in https://github.com/refined-github/refined-github/blob/71c16f38d5d7853e57bd3e36852175b30eed89c3/source/helpers/types.d.ts#LL7This also currently isn't possible in the strict parser:
StrictlyParseSelector
#28What do you think about using a global like
SelectorFallback
in this module so that I can override it globally by just using:The text was updated successfully, but these errors were encountered: