[TYPO3-core] RFC: Bug #8518: Wrong JavaScript inclusion in t3lib_TCEforms

Oliver Hader oliver at typo3.org
Wed Jul 30 17:03:32 CEST 2008


Hi Masi,

Martin Kutschker schrieb:
> Oliver Hader schrieb:
>> This is a SVN patch request.
>>
>> Problem:
>> There are superfluos inclusions of javascript resources in
>> t3lib_TCEforms. Thus, it might happen that prototype.js is defined in
>> the HEAD part of the document and again somewhere in the BODY.
>>
>> Solution:
>> Use template::loadJavascriptLib() to include a javascipt library only once.
>>
>> Comments:
>> Before this patch the JS libs where included somewhere in the BODY tag,
>> on using the mentioned function the libs will be included in the HEAD
>> tag now. However, this is no problem for the affected resources.
>> The patch removes a superfluos inclusion of scriptaculous that was
>> introduced in rev. 2628 - scriptaculous is not required for the
>> functionalities of that SVN revision.
>> Thanks to Benni Mack for writing the initial patch to utilize
>> template::loadJavascriptLib().
> 
> +1 for the described changes from reading, but there are two more changes:
> 
> 1) you remove a "spacer"

Thanks, I'm going to readd the line-break and tab.

> 2) in alt_doc.php you don't instantiate the template class.

When the file typo3/template.php is included, an instance of the 
template object is put to $GLOBALS['TBE_TEMPLATE']. Thus, there are two 
possibilities for that:

1) Use $GLOBALS['SOBE']->doc->loadJavascriptLib() in t3lib_TCEforms
2) Use $GLOBALS['TBE_TEMPLATE']->loadJavascriptLib() like in the patch 
and use the already existing template instance which is always available

olly
-- 
Oliver Hader
TYPO3 4.3 Release Manager


More information about the TYPO3-team-core mailing list