Skip to content

Commit

Permalink
stringify closer to the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 7, 2014
1 parent f3248d6 commit 09a549a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/Mojo/DOM.pm
Expand Up @@ -133,7 +133,7 @@ sub parent {
return _build($self, $self->_parent, $self->xml);
}

sub parse { shift->_delegate(parse => "$_[0]") }
sub parse { shift->_delegate(parse => @_) }

sub prepend { shift->_add(0, @_) }

Expand All @@ -147,7 +147,7 @@ sub remove { shift->replace('') }
sub replace {
my ($self, $new) = @_;
return $self->parse($new) if (my $tree = $self->tree)->[0] eq 'root';
return $self->_replace($self->_parent, $tree, $self->_parse("$new"));
return $self->_replace($self->_parent, $tree, $self->_parse($new));
}

sub root {
Expand Down Expand Up @@ -211,7 +211,7 @@ sub _add {

my $parent = $self->_parent;
splice @$parent, _offset($parent, $tree) + $offset, 0,
_link($self->_parse("$new"), $parent);
_link($self->_parse($new), $parent);

return $self;
}
Expand Down Expand Up @@ -264,7 +264,7 @@ sub _content {

$start = $start ? ($#$tree + 1) : _start($tree);
$offset = $offset ? $#$tree : 0;
splice @$tree, $start, $offset, _link($self->_parse("$new"), $tree);
splice @$tree, $start, $offset, _link($self->_parse($new), $tree);

return $self;
}
Expand Down Expand Up @@ -386,7 +386,7 @@ sub _wrap {

# Find innermost tag
my $current;
my $first = $new = $self->_parse("$new");
my $first = $new = $self->_parse($new);
$current = $first while $first = first { $_->[0] eq 'tag' } _nodes($first);
return $self unless $current;

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/CSS.pm
Expand Up @@ -78,7 +78,7 @@ sub _combinator {
}

sub _compile {
my $css = shift;
my $css = "$_[0]";

my $pattern = [[]];
while ($css =~ /$TOKEN_RE/go) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/HTML.pm
Expand Up @@ -101,7 +101,7 @@ my %BLOCK = map { $_ => 1 } (
);

sub parse {
my ($self, $html) = @_;
my ($self, $html) = (shift, "$_[0]");

my $xml = $self->xml;
my $current = my $tree = ['root'];
Expand Down

0 comments on commit 09a549a

Please sign in to comment.