Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support parsing <svg>, <canvas>, etc in Goodie HTML

  • Loading branch information...
commit 926e1424a0a89411291713bbadb466a5f778f725 1 parent 4750116
@moollaza moollaza authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/App/DuckPAN/Web.pm
View
13 lib/App/DuckPAN/Web.pm
@@ -292,11 +292,14 @@ sub request {
my $zci_body = $zci_container->look_down(class => 'zci__body');
# Stick the answer inside $zci_body
- $zci_body->push_content(
- $result->has_html ?
- HTML::TreeBuilder->new_from_content($result->html)->guts :
- $result->answer
- );
+ my $answer = $result->answer;
+ if ($result->has_html) {
+ my $tb = HTML::TreeBuilder->new();
+ # Specifically allow unknown tags to support <svg> and <canvas>
+ $tb->ignore_unknown(0);
+ $answer = $tb->parse_content($result->html)->guts;
+ }
+ $zci_body->push_content($answer);
my $zci_wrapper = $root->look_down(id => "zero_click_wrapper");
$zci_wrapper->insert_element($zci_container);
Please sign in to comment.
Something went wrong with that request. Please try again.