Skip to content

Commit 9ae6fed

Browse files
committed
Minor performance improvements.
1 parent c93faef commit 9ae6fed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

html_scraper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,26 @@ public function xpath_textContent(string $expr, int $item = 0) {
9898
}
9999
}
100100

101-
public function querySelector_innerHTML(string $expr, int $item = 0) {
102-
$node = $this->querySelector($expr, $item);
101+
public function querySelector_innerHTML(string $selector, int $item = 0) {
102+
$node = $this->xpath(static::CSS_to_Xpath($selector), $item);
103103
if($node === NULL) {
104104
return NULL;
105105
} else {
106106
return static::innerHTML($node);
107107
}
108108
}
109109

110-
public function querySelector_outerHTML(string $expr, int $item = 0) {
111-
$node = $this->querySelector($expr, $item);
110+
public function querySelector_outerHTML(string $selector, int $item = 0) {
111+
$node = $this->xpath(static::CSS_to_Xpath($selector), $item);
112112
if($node === NULL) {
113113
return NULL;
114114
} else {
115115
return static::outerHTML($node);
116116
}
117117
}
118118

119-
public function querySelector_textContent(string $expr, int $item = 0) {
120-
$node = $this->querySelector($expr, $item);
119+
public function querySelector_textContent(string $selector, int $item = 0) {
120+
$node = $this->xpath(static::CSS_to_Xpath($selector), $item);
121121
if($node === NULL) {
122122
return NULL;
123123
} else {

0 commit comments

Comments
 (0)