PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.6
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.6
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / simplehtmldom / manual / docs / api / definitions.md

definitions.md in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.6, at simplehtmldom/manual/docs/api/definitions.md

100 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ---
2 title: Definitions
3 ---
4
5 # Definitions
6
7 The definitions below are an essential part of the parser.
8
9 ## Node Types
10
11 The type of a node is determined during parsing and represented by one of the elements in the list below.
12
13 | Type | Description
14 | ---- | -----------
15 | `HDOM_TYPE_ELEMENT` | Start tag (i.e. `<html>`)
16 | `HDOM_TYPE_COMMENT` | HTML comment (i.e. `<!-- Hello, World! -->`)
17 | `HDOM_TYPE_TEXT` | Plain text (i.e. `Hello, World!`)
18 | `HDOM_TYPE_ENDTAG` | End tag (i.e. `</html>`)
19 | `HDOM_TYPE_ROOT` | Root element. There can always only be one root element in the DOM.
20 | `HDOM_TYPE_UNKNOWN` | Unknown type (i.e. CDATA, DOCTYPE, etc...)
21
22 ### Example
23
24 ```html
25 <!DOCTYPE html><html><!-- Hello, World! --></html>Hello, World!
26 ```
27
28 _Note_: `HDOM_TYPE_ROOT` always exists regardless of the actual document structure.
29
30 | HTML | Node Type
31 | ---- | ---------
32 | | `HDOM_TYPE_ROOT`
33 | `<!DOCTYPE html>` | `HDOM_TYPE_UNKNOWN`
34 | `<html>` | `HDOM_TYPE_ELEMENT`
35 | `<!-- Hello, World! -->` | `HDOM_TYPE_COMMENT`
36 | `</html>` | `HDOM_TYPE_ENDTAG`
37 | `Hello, World!` | `HDOM_TYPE_TEXT`
38
39 ## Quote Types
40
41 Identifies the quoting type on attribute values.
42
43 | Type | Description
44 | ---- | -----------
45 | `HDOM_QUOTE_DOUBLE` | Double quotes (`""`)
46 | `HDOM_QUOTE_SINGLE` | Single quotes (`''`)
47 | `HDOM_QUOTE_NO` | Not quoted (flag)
48
49 _Note_: Attributes with no values (flags) are stored as `HDOM_QUOTE_NO`.
50
51 ### Example
52
53 ```html
54 <p class="paragraph" id='info1' hidden>Hello, World!</p>
55 ```
56
57 | Attribute | Description
58 | --------- | -----------
59 | `class="paragraph"` | `HDOM_QUOTE_DOUBLE`
60 | `id='info1'` | `HDOM_QUOTE_SINGLE`
61 | `hidden` | `HDOM_QUOTE_NO`
62
63 ## Node Info Types
64
65 Each node stores additional information (metadata) that is identified by the elements below.
66
67 | Type | Description
68 | ---- | -----------
69 | `HDOM_INFO_BEGIN` | Cursor position for the start tag of a node.
70 | `HDOM_INFO_END` | Cursor position for the end tag of a node. A value of zero indicates a node with no end tag (missing closing tag).
71 | `HDOM_INFO_QUOTE` | Quote type for attribute values. The value must be an element of [](#quote-typesQuote Type](#quote-types](#quote-types).
72 | `HDOM_INFO_SPACE` | Array of whitespace around attributes (see [](#attribute-whitespaceAttribute Whitespace](#attribute-whitespace](#attribute-whitespace)).
73 | `HDOM_INFO_TEXT` | Non-HTML text in tags (i.e. comments, doctype, etc...).
74 | `HDOM_INFO_INNER` | Inner text of a node.
75 | `HDOM_INFO_OUTER` | Outer text of a node.
76 | `HDOM_INFO_ENDSPACE` | Whitespace at the end of a tag before the closing bracket.
77
78 ## Attribute Whitespace
79
80 Whitespace around attributes is stored in the form of an array with three elements:
81
82 | Element | Description
83 | ------- | -----------
84 | `0` | Whitespace before the attribute name.
85 | `1` | Whitespace between attribute name and the equal sign.
86 | `2` | Whitespace between the equal sign and the attribute value
87
88 ### Example
89
90 ```html
91 <p class="paragraph" id = 'info1'hidden>Hello, World!</p>
92 ```
93
94 _Note_: Whitespace before attribute names is not displayed in the browser. It is, however, part of the attributes.
95
96 | Attribute | Description
97 | --------- | -----------
98 | ` class="paragraph"` | `[0] => ' ', [1] => '', [2] => ''`
99 | ` id = 'info1'` | `[0] => ' ', [1] => ' ', [2] => ' '`
100 | `hidden` | `[0] => '', [1] => '', [2] => ''`