Mercurial > SimpleWebPresenter
changeset 115:b9668126e52e
Remove comments.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 17 Mar 2016 22:32:33 +0100 |
| parents | 6f5939bf53c3 |
| children | 374e3eff07fd |
| files | InputParser.inc |
| diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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();
