I am testing a code I found while reading a book. I get this error while testing it out in JS fiddle, document.write
can be a form of eval.
var text = '<html><body bgcolor=linen><p>' +
'This is <b>bold</b>!</p></body></html>';
var tags = /[^<>]+|<(/?)([A-Za-z]+)([^<>]*)>/g;
var a, i;
while ((a = tags.exec(text))) {
for (i = 0; i < a.length; i += 1) {
document.writeln(('// [' + i + '] ' + a[i]).entityify());
}
document.writeln();
}
I am getting the above JSfiddle warning on both lines with document.writeln()
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…