# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1458250353 -3600 # Node ID b9668126e52e795d7835821c47fde769bd34df69 # Parent 6f5939bf53c3bdeeecf32c1cabcec24b8a6662f9 Remove comments. diff -r 6f5939bf53c3 -r b9668126e52e InputParser.inc --- a/InputParser.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/InputParser.inc Thu Mar 17 22:32:33 2016 +0100 @@ -63,9 +63,23 @@ } } $this->master = self::getFiles($this->master, $this->options); + self::removeCommentsFromDOM($this->master); $cache->setMaxAge(20); } + /** + * 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();