Skip to content

Commit

Permalink
use prompt() for copy&paste
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.coderepos.org/share/lang/perl/Moxy/trunk@32137 d0d07461-0603-4401-acd4-de1884942a52
  • Loading branch information
tokuhirom committed Apr 8, 2009
1 parent 16c8ad9 commit 4af5334
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/Moxy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ sub rewrite_html {
for my $node ( $tree->findnodes("//$tag") ) {
if ( my $attr = $node->attr($attr_name) ) {
next if $attr =~ /^mailto:/;
if ($attr =~ /^tel:/) {
if ($attr =~ /^tel:([0-9-]+)$/) {
my $tel = $1;
$node->attr(
'onclick' => sprintf(q{alert("%s");return false;},
$attr
)
'onclick' => qq{prompt('tel', '$1');return false;}
);
} else {
# maybe /https?/
Expand Down
2 changes: 1 addition & 1 deletion t/Plugin-Server-rewrite_html.t
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ __END__
--- input
<a href="tel:09044444444" title="foo">bar</a>
--- expected
<html><a href="tel:09044444444" onclick="alert(&quot;tel:09044444444&quot;);return false;" title="foo">bar</a></html>
<html><a href="tel:09044444444" onclick="prompt(&#39;tel&#39;, &#39;09044444444&#39;);return false;" title="foo">bar</a></html>

0 comments on commit 4af5334

Please sign in to comment.