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:
parent
8ac6e7bf9b
commit
4c556a39a1
@ -87,10 +87,15 @@ export default class Regexper {
|
|||||||
detectBuggyHash() {
|
detectBuggyHash() {
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
if (typeof window.URL !== 'undefined') {
|
if (typeof window.URL === 'function') {
|
||||||
|
try {
|
||||||
url = new URL('http://regexper.com/#%25');
|
url = new URL('http://regexper.com/#%25');
|
||||||
this.buggyHash = (url.hash === '#%');
|
this.buggyHash = (url.hash === '#%');
|
||||||
}
|
}
|
||||||
|
catch(e) {
|
||||||
|
this.buggyHash = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the URL hash. This method exists to facilitate automated testing
|
// Set the URL hash. This method exists to facilitate automated testing
|
||||||
|
Loading…
Reference in New Issue
Block a user