Tweaking buggy hash detection
This should more appropriately detect the presence of the URL constructor, and will silently ignore any exceptions (and assume the hash isn't buggy)
This commit is contained in:
+8
-3
@@ -87,9 +87,14 @@ export default class Regexper {
|
||||
detectBuggyHash() {
|
||||
var url;
|
||||
|
||||
if (typeof window.URL !== 'undefined') {
|
||||
url = new URL('http://regexper.com/#%25');
|
||||
this.buggyHash = (url.hash === '#%');
|
||||
if (typeof window.URL === 'function') {
|
||||
try {
|
||||
url = new URL('http://regexper.com/#%25');
|
||||
this.buggyHash = (url.hash === '#%');
|
||||
}
|
||||
catch(e) {
|
||||
this.buggyHash = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user