how to fix jslint message Insecure '.'

前端 未结 3 1935
借酒劲吻你
借酒劲吻你 2021-01-04 06:11

jslint reports message Insecure \'.\'.

at line

html = /([\\s\\S]*)<\\/body>/.exec(responseText);

How to fix th

3条回答
  •  别那么骄傲
    2021-01-04 07:12

    That check in JSLint is there because if you allow for any char (.), or any char except some specified ([^x]), you could get matches you weren't expecting. If you have that check turned on in JSLint, you need to be writing regexes which explicitly state what should be matching.

    If you don't want to turn off that check, and you want an error free LINT, determine what would you consider as OK to be found between the 'y' of 'body' and the closing angle bracket, and write your regex in that manner.

提交回复
热议问题