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()
.