Using CDATA for autofocus script

This commit is contained in:
Sarven Capadisli 2009-10-03 22:06:51 +00:00
parent 1e7df7fbab
commit 5528c0cd3d
1 changed files with 6 additions and 10 deletions

View File

@ -427,16 +427,12 @@ class HTMLOutputter extends XMLOutputter
function autofocus($id)
{
$this->elementStart('script', array('type' => 'text/javascript'));
$this->raw('
<!--
$(document).ready(function() {
var el = $("#' . $id . '");
if (el.length) {
el.focus();
}
});
-->
');
$this->raw('/*<![CDATA[*/'.
' $(document).ready(function() {'.
' var el = $("#' . $id . '");'.
' if (el.length) { el.focus(); }'.
' });'.
' /*]]>*/');
$this->elementEnd('script');
}
}