Project

General

Profile

Actions

Bug #14988

closed

xhtml_cleaning corrupts javascript in HTML-comment from extension

Added by Bernd Wilke over 18 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2005-09-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

in my extension I want to write some javascript like:

$content.='
<script type="text/javascript">

</script>';

what ends up in the HTML-source of the resulting page is:
<script type="text/javascript">
<!--
function count_to(j) {
var s="";
for (var i=0; i<j; i="" s="i+&quot;" alertscount_to10--="">
</script>

it seems that the cleaning is done inside of the HTML-comment.
Especially the '<' in the loop-header is mis-interpreted as an opening HTML-tag and anything following as parameter to this tag.

unsetting
page.config.xhtml_cleaning = all
leaves all javascript ok.

my workaround for this small part of code is using
for (var i=0; j>i; i++ ) {
instead of
for (var i=0; i<j; i++ ) {

But I think it can go worse if in the javascript a '<' is needed in a string.

BTW: I prepare the proper javascript-code with infos from within PHP, so I can't include the javascript from extern.

(issue imported from #M1477)


Files

parsehtml.diff (1.63 KB) parsehtml.diff Administrator Admin, 2006-08-22 09:01
class.t3lib_parsehtml.diff (2.63 KB) class.t3lib_parsehtml.diff Administrator Admin, 2006-12-06 13:03
bug_1477_stucki.diff (2.77 KB) bug_1477_stucki.diff Administrator Admin, 2007-04-20 17:20

Related issues 5 (0 open5 closed)

Related to TYPO3 Core - Bug #14150: t3lib_parsehtml: tags in comments are handled (incorrectly)ClosedChris topher2004-05-11

Actions
Is duplicate of TYPO3 Core - Bug #14868: xhtml_cleaning cleans HTML comments which is not wanted in any case (working patch included)ClosedSebastian Kurfuerst2005-07-17

Actions
Has duplicate TYPO3 Core - Bug #15913: HTML cleaner corrupts Java Script codeClosedMichael Stucki2006-03-28

Actions
Has duplicate TYPO3 Core - Bug #16170: xhtml_cleaning = 1 disables toolbar in the RTE in my ExtensionClosedMichael Stucki2006-05-22

Actions
Has duplicate TYPO3 Core - Bug #18508: config.xhtml_cleaning = all mixes up inline JavaScript. Should be documented.ClosedMichael Stucki2008-03-28

Actions
Actions

Also available in: Atom PDF