blob: 213d8935b72520d537e8391fcf1c4e8779c14a89 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
namespace HTML5\Parser;
class EventStack implements EventHandler {
protected $stack;
public function __construct() {
$this->stack = array();
}
/**
* Get the event stack.
*/
public function events() {
return $this->stack;
}
public function depth() {
return count($this->stack);
}
protected function store($event, $data = NULL) {
$stack[] = array(
'name' => $event,
'data' => $data,
);
}
public function doctype($name, $publicId, $systemID, $quirks = FALSE) {
$args = func_get_args();
$this->store('doctype', $args);
}
public function startTag($name, $attributes = array(), $selfClosing = FALSE) {
$args = func_get_args();
$this->store('startTag', $args);
}
public function endTag($name) {
$this->store('endTag', array($name));
}
public function comment($cdata) {
$this->store('comment', array($cdata));
}
public function text($cdata) {
$this->store('character', array($cdata));
}
public function eof() {
$this->store('eof');
}
}
|