changeset 116:374e3eff07fd

Branch merge
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 17 Mar 2016 22:34:49 +0100
parents b9668126e52e (diff) f498ea087d67 (current diff)
children e01ce5722f2b
files InputParser.inc
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/InputParser.inc	Wed Mar 16 13:02:06 2016 +0100
+++ b/InputParser.inc	Thu Mar 17 22:34:49 2016 +0100
@@ -63,9 +63,23 @@
       }
     }
     $this->master = self::getFiles($this->master, $this->options);
+    self::removeCommentsFromDOM($this->master);
     $cache->setMaxAge(0);
   }
 
+  /**
+   * Removes all comments from the DOM
+   *
+   * @param $dom A DOMDocument for processing
+   */
+  static function removeCommentsFromDOM($dom)
+  {
+    $xpath = new DOMXPath($dom);
+    foreach ($xpath->query('//comment()') as $comment) {
+      $comment->parentNode->removeChild($comment);
+    }
+  }
+
   function cacheCheck()
   {
     return $this->options->getCacheable();