Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: using Regular Expressions on Firefox
DOM Testing Library uses instanceof to check whether a query is passed a RegExp, a Function or a string arg. For some reason on Firefox when a RegExp is passed to a query the `arg instanceof RegExp` check is always false, resulting in RegExp arguments being treated like a string. It appears that this is because the RegExp that is created in executeQuery is not the same class as that used in the instanceof check in DTL. I'm not sure exactly what could be causing it, it's possible that this is due to a polyfill or how we are adding DTL to the page, or something completely different. Assigning the RegExp that is in scope in executeQuery to window.RegExp seems to fix the problem, presumably because it overrides whatever modified RegExp class was added by the UMD script.
- Loading branch information