Use inlineScript() instead of element() to write inline javascript

This commit is contained in:
Craig Andrews 2009-12-04 20:33:41 -05:00
parent 675e32ac9a
commit d41a0a5ed0
2 changed files with 3 additions and 7 deletions

View File

@ -477,13 +477,10 @@ class HTMLOutputter extends XMLOutputter
*/ */
function autofocus($id) function autofocus($id)
{ {
$this->elementStart('script', array('type' => 'text/javascript')); $this->inlineScript(
$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');
} }
} }

View File

@ -352,8 +352,7 @@ class MobileProfilePlugin extends WAP20Plugin
$contentLimit = Notice::maxContent(); $contentLimit = Notice::maxContent();
$form->out->element('script', array('type' => 'text/javascript'), $form->out->inlineScript('maxLength = ' . $contentLimit . ';');
'maxLength = ' . $contentLimit . ';');
if ($contentLimit > 0) { if ($contentLimit > 0) {
$form->out->element('div', array('id' => 'notice_text-count'), $form->out->element('div', array('id' => 'notice_text-count'),