fix: add error catch for browsers dont support positive lookbehind
This commit is contained in:
parent
06631502ee
commit
5f105fe5d9
2 changed files with 14 additions and 0 deletions
|
@ -688,6 +688,13 @@
|
|||
|
||||
class Heti {
|
||||
constructor (rootSelector) {
|
||||
try {
|
||||
new RegExp(`(?<=\d)\d`, 'g').test('');
|
||||
} catch (err) {
|
||||
console.warn(err.name, '浏览器尚未实现 RegExp positive lookbehind');
|
||||
return
|
||||
}
|
||||
|
||||
this.rootSelector = rootSelector || '.heti';
|
||||
this.REG_FULL = new RegExp(`(?<=[${CJK}])( *[${ANS}]+(?: +[${ANS}]+)* *)(?=[${CJK}])`, 'g');
|
||||
this.REG_START = new RegExp(`([${ANS}]+(?: +[${ANS}]+)* *)(?=[${CJK}])`, 'g');
|
||||
|
|
|
@ -44,6 +44,13 @@ const hasOwn = {}.hasOwnProperty
|
|||
|
||||
class Heti {
|
||||
constructor (rootSelector) {
|
||||
try {
|
||||
new RegExp(`(?<=\d)\d`, 'g').test('')
|
||||
} catch (err) {
|
||||
console.warn(err.name, '浏览器尚未实现 RegExp positive lookbehind')
|
||||
return
|
||||
}
|
||||
|
||||
this.rootSelector = rootSelector || '.heti'
|
||||
this.REG_FULL = new RegExp(`(?<=[${CJK}])( *[${ANS}]+(?: +[${ANS}]+)* *)(?=[${CJK}])`, 'g')
|
||||
this.REG_START = new RegExp(`([${ANS}]+(?: +[${ANS}]+)* *)(?=[${CJK}])`, 'g')
|
||||
|
|
Loading…
Reference in a new issue