summaryrefslogtreecommitdiff
path: root/src/HTML5.php
blob: 31db307f05dbb16bbc7a027709979d1d739a1900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

/**
 * The main HTML5 front end.
 *
 * This class offers convenience methods for parsing and serializing HTML5.
 *
 * EXPERIMENTAL. This may change or be completely replaced.
 */
class HTML5 extends \HTML5\Parser {
  // Inherit parse() and parseFragment().

  /**
   * Save a DOM into a given file as HTML5.
   */
  public static function save($dom, $file) {
    $serializer = new \HTML5\Serializer\Serializer($dom);
    return $serializer->save($file);
  }

  /**
   * Convert a DOM into an HTML5 string.
   */
  public static function saveHTML($dom) {
    $serializer = new \HTML5\Serializer\Serializer($dom);
    return $serializer->saveHTML();
  }
}