[TYPO3-dev] HTMLcleaner wrongly cleans JavaScript
Franz Holzinger
franz at fholzinger.com
Mon Aug 14 20:39:08 CEST 2006
Hello,
during debugging of the reason why JavaScript generated in an extension
gets changed wrongly by TYPO3 before output, I came to the function
HTMLcleaner in class.t3lib_parsehtml.php.
The input string parts containing JavaScript
<script type="text/javascript">
/*<![CDATA[*/
<!--
var c = new Array(); // categories
var boxCount = 3; // number of select boxes
...
f ((typeof(subcategories) == "object") && (showSubCategories == 1)) {
sb.options[0] = new Option("", "A");
len = subcategories.length;
for (var k=0; k<len; k++) {
sb.options[k+1] = new Option(c[c[category][2][k]][0], c[category][2][k]);
}
...
}
// -->
/*]]>*/
</script>
gets split into 2 parts in class.t3lib_parsehtml.php on line 635.
$tagContent = substr($tok,$endTag,$tagEnd-$endTag);
part1:
...
if ((typeof(subcategories) == "object") && (showSubCategories == 1)) {
sb.options[0] = new Option("", "A");
len = subcategories.length;
for (var k=0; k
part2:
len; k++) {
sb.options[k+1] = new Option(c[c[category][2][k]][0], c[category][2][k]);
}
} else {
bShowArticle = 1;
}
} else {
bShowArticle = 1;
}
...
This happens in the middle of the for loop.
at
k<len
.
Later the output of part2 gets totally corrupted.
for (var k=0; k<len; k="" sboptionsk1="new" optioncccategory2k0=""
ccategory2k="" else="" bshowarticle="" if="" sboptions0="new"
optionlen="" keineunterkategorie="" var="" data="" array=""
sb="document.getElementById(" pid="" 2="" option="" b=""
tx_ttproducts_pi1="" tt_products_showarticledata="" c=""
sbselectedindex="0;" selectselectedindex="index;"
keinenartikelanzeigen="" test="" --="">
/*]]>*/
What has been the intention of HTMLcleaner? Should it be able to handle
JavaScript code as well?
- Franz
More information about the TYPO3-dev
mailing list