Using CDATA for autofocus script

This commit is contained in:
Sarven Capadisli 2009-10-03 22:06:51 +00:00
parent 1e7df7fbab
commit 5528c0cd3d

View File

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