diff --git a/inc/class.page.php b/inc/class.page.php
--- a/inc/class.page.php
+++ b/inc/class.page.php
@@ -218,8 +218,10 @@ class page
           '    '. PHP_EOL .
-          '    '. PHP_EOL;
-
+          '    '. PHP_EOL
+      . '    ' . PHP_EOL;
     // Write out all passed scripts
     foreach ($this->scripts as $i)
       echo '    ' . $this->headCode["$i"] . "\n";
@@ -535,11 +537,29 @@ class page
    */
   public function script_wrap($js, $type = 'text/javascript')
   {
-    return '';
+    return ''
+      . '';
+  }
+
+  /**
+   * \brief
+   *   Wrap something in CDATA or not wrap depending on if we're
+   *   serving HTML.
+   *
+   * Lower-level than Page::script_wrap().
+   * \param $content
+   *   The stuff to wrap in CDATA.
+   * \return
+   *   The wrapped string.
+   */
+  public function cdata_wrap($content)
+  {
+    return ''
+      . ($this->xhtml ? 'xhtml ? ']]>' : '') . PHP_EOL;
   }
 
   /**