The following html code is working (Chrome 44, Firefox 37) :
<svg width="100" height="100">
<script>
function test() {
var l= [0,1,2,3];
console.log(l.length);
}
</script>
<text x="20" y="20" onclick="test()">CLICK ME</text>
</svg>
but this is not :
<svg width="100" height="100">
<script>
function test() {
var l= [0,1,2,3];
console.log(l.length);
/*for (var i=0; i<l.length; i++) {
console.log(i);
}*/
}
</script>
<text x="20" y="20" onclick="test()">CLICK ME</text>
</svg>
The svg text tag 'CLICK ME' won't even be visible. And the only difference is commented code ! What is the problem ?