]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Using CDATA for autofocus script
authorSarven Capadisli <csarven@status.net>
Sat, 3 Oct 2009 22:06:51 +0000 (22:06 +0000)
committerSarven Capadisli <csarven@status.net>
Sat, 3 Oct 2009 22:06:51 +0000 (22:06 +0000)
lib/htmloutputter.php

index 64be745bebe85daa14998d451df7eb5bddda4701..2ff9380cc15bc16183e738e084b8ab6628a31cb1 100644 (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');
     }
 }