Skip to content

Commit

Permalink
DomQuery: removed warning for invalid tags [Closes #354[Closes #416]
Browse files Browse the repository at this point in the history
It now allows SVG, MathML and Custom Elements.
  • Loading branch information
dg committed Feb 19, 2020
1 parent 20b7c0b commit 0b33a93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/Framework/DomQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public static function fromHtml(string $html): self
$errors = libxml_get_errors();
libxml_use_internal_errors($old);

$re = '#Tag (article|aside|audio|bdi|canvas|data|datalist|figcaption|figure|footer|header|keygen|main|mark'
. '|meter|nav|output|picture|progress|rb|rp|rt|rtc|ruby|section|source|template|time|track|video|wbr) invalid#';
foreach ($errors as $error) {
if (!preg_match($re, $error->message)) {
if (!preg_match('#Tag \S+ invalid#', $error->message)) {
trigger_error(__METHOD__ . ": $error->message on line $error->line.", E_USER_WARNING);
}
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Framework/DomQuery.fromHtml.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ $q = DomQuery::fromHtml("<script>\nvar s = '</div>';</script> <br> <script type
Assert::true($q->has('script'));
Assert::true($q->has('br'));
Assert::true($q->has('script[type]'));

$q = @DomQuery::fromHtml('<custom-element></custom-element>');
Assert::true($q->has('custom-element'));

0 comments on commit 0b33a93

Please sign in to comment.