@@ -20,38 +20,38 @@ |
||
20 | 20 | |
21 | 21 | // Begin with an HTML stub document (XHTML, actually), and navigate to the title. |
22 | 22 | qp(QueryPath::HTML_STUB, 'title') |
23 | - // Add some text to the title |
|
24 | - ->text('Example of QueryPath.') |
|
25 | - // Now look for the <body> element |
|
26 | - ->top('body') |
|
27 | - // Inside the body, add a title and paragraph. |
|
28 | - ->append('<h1>This is a test page</h1><p>Test text</p>') |
|
29 | - // Now we select the paragraph we just created inside the body |
|
30 | - ->children('p') |
|
31 | - // Add a 'class="some-class"' attribute to the paragraph |
|
32 | - ->attr('class', 'some-class') |
|
33 | - // And add a style attribute, too, setting the background color. |
|
34 | - ->css('background-color', '#eee') |
|
35 | - // Now go back to the paragraph again |
|
36 | - ->parent() |
|
37 | - // Before the paragraph and the title, add an empty table. |
|
38 | - ->prepend('<table id="my-table"></table>') |
|
39 | - // Now let's go to the table... |
|
40 | - ->top('#my-table') |
|
41 | - // Add a couple of empty rows |
|
42 | - ->append('<tr></tr><tr></tr>') |
|
43 | - // select the rows (both at once) |
|
44 | - ->children() |
|
45 | - // Add a CSS class to both rows |
|
46 | - ->addClass('table-row') |
|
47 | - // Now just get the first row (at position 0) |
|
48 | - ->eq(0) |
|
49 | - // Add a table header in the first row |
|
50 | - ->append('<th>This is the header</th>') |
|
51 | - // Now go to the next row |
|
52 | - ->next() |
|
53 | - // Add some data to this row |
|
54 | - ->append('<td>This is the data</td>') |
|
55 | - // Write it all out as HTML |
|
56 | - ->writeHTML(); |
|
23 | + // Add some text to the title |
|
24 | + ->text('Example of QueryPath.') |
|
25 | + // Now look for the <body> element |
|
26 | + ->top('body') |
|
27 | + // Inside the body, add a title and paragraph. |
|
28 | + ->append('<h1>This is a test page</h1><p>Test text</p>') |
|
29 | + // Now we select the paragraph we just created inside the body |
|
30 | + ->children('p') |
|
31 | + // Add a 'class="some-class"' attribute to the paragraph |
|
32 | + ->attr('class', 'some-class') |
|
33 | + // And add a style attribute, too, setting the background color. |
|
34 | + ->css('background-color', '#eee') |
|
35 | + // Now go back to the paragraph again |
|
36 | + ->parent() |
|
37 | + // Before the paragraph and the title, add an empty table. |
|
38 | + ->prepend('<table id="my-table"></table>') |
|
39 | + // Now let's go to the table... |
|
40 | + ->top('#my-table') |
|
41 | + // Add a couple of empty rows |
|
42 | + ->append('<tr></tr><tr></tr>') |
|
43 | + // select the rows (both at once) |
|
44 | + ->children() |
|
45 | + // Add a CSS class to both rows |
|
46 | + ->addClass('table-row') |
|
47 | + // Now just get the first row (at position 0) |
|
48 | + ->eq(0) |
|
49 | + // Add a table header in the first row |
|
50 | + ->append('<th>This is the header</th>') |
|
51 | + // Now go to the next row |
|
52 | + ->next() |
|
53 | + // Add some data to this row |
|
54 | + ->append('<td>This is the data</td>') |
|
55 | + // Write it all out as HTML |
|
56 | + ->writeHTML(); |
|
57 | 57 | ?> |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $splos->rewind(); |
85 | 85 | $first = $splos->current(); |
86 | 86 | if ($first instanceof \DOMDocument) { |
87 | - $this->dom = $first;//->documentElement; |
|
87 | + $this->dom = $first; //->documentElement; |
|
88 | 88 | } else { |
89 | - $this->dom = $first->ownerDocument;//->documentElement; |
|
89 | + $this->dom = $first->ownerDocument; //->documentElement; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->scopeNode = $scopeNode; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | return $this->combineAnyDescendant($node, $selectors, $index); |
265 | 265 | case SimpleSelector::ANOTHER_SELECTOR: |
266 | 266 | // fprintf(STDOUT, "Next selector: %s\n", $selectors[$index]); |
267 | - return $this->matchesSimpleSelector($node, $selectors, $index);; |
|
267 | + return $this->matchesSimpleSelector($node, $selectors, $index); ; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return false; |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | $name = $pseudoClass['name']; |
777 | 777 | // Avoid E_STRICT violation. |
778 | 778 | $value = $pseudoClass['value'] ?? NULL; |
779 | - $ret &= $this->psHandler->elementMatches($name, $node, $this->scopeNode, $value); |
|
779 | + $ret &= $this->psHandler->elementMatches($name, $node, $this->scopeNode, $value); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | return $ret; |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | array_shift($args); |
92 | 92 | } |
93 | 93 | |
94 | - $getter = function ($qp) { |
|
94 | + $getter = function($qp) { |
|
95 | 95 | return $qp->text(); |
96 | 96 | }; |
97 | 97 | |
98 | - $setter = function ($qp, $value) { |
|
98 | + $setter = function($qp, $value) { |
|
99 | 99 | $qp->text($value); |
100 | 100 | }; |
101 | 101 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | $args = array_slice(func_get_args(), 2); |
144 | 144 | } |
145 | 145 | |
146 | - $getter = function ($qp) use ($attrName) { |
|
146 | + $getter = function($qp) use ($attrName) { |
|
147 | 147 | return $qp->attr($attrName); |
148 | 148 | }; |
149 | 149 | |
150 | - $setter = function ($qp, $value) use ($attrName) { |
|
150 | + $setter = function($qp, $value) use ($attrName) { |
|
151 | 151 | return $qp->attr($attrName, $value); |
152 | 152 | }; |
153 | 153 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | protected function prepareArgs($args, $pos): array |
215 | 215 | { |
216 | - $padded = array_pad((array) $args, (0 < $pos) ? $pos - 1 : 0, null); |
|
216 | + $padded = array_pad((array)$args, (0 < $pos) ? $pos - 1 : 0, null); |
|
217 | 217 | array_splice($padded, $pos, 0, array(null)); // insert null as a place holder |
218 | 218 | return $padded; |
219 | 219 | } |