Hello community,

here is the log from the commit of package perl-Mojolicious for 
openSUSE:Factory checked in at 2018-05-03 12:33:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Mojolicious"

Thu May  3 12:33:28 2018 rev:96 rq:603036 version:7.77

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes        
2018-04-26 13:38:27.971123951 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes   
2018-05-03 12:33:30.417876702 +0200
@@ -1,0 +2,13 @@
+Wed May  2 05:35:20 UTC 2018 - [email protected]
+
+- updated to 7.77
+   see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+  7.77  2018-04-28
+    - Added support for namespace selectors like "ns|*" to Mojo::DOM::CSS.
+      (jberger)
+    - Added support for :link and :visited pseudo-classes to Mojo::DOM::CSS.
+    - Added support for hyphen-separated list attribute selectors like
+      "[heflang|=en]" to Mojo::DOM::CSS.
+
+-------------------------------------------------------------------

Old:
----
  Mojolicious-7.76.tar.gz

New:
----
  Mojolicious-7.77.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.2JxKYs/_old  2018-05-03 12:33:31.309844932 +0200
+++ /var/tmp/diff_new_pack.2JxKYs/_new  2018-05-03 12:33:31.309844932 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Mojolicious
-Version:        7.76
+Version:        7.77
 Release:        0
 %define cpan_name Mojolicious
 Summary:        Real-time web framework

++++++ Mojolicious-7.76.tar.gz -> Mojolicious-7.77.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/Changes new/Mojolicious-7.77/Changes
--- old/Mojolicious-7.76/Changes        2018-04-23 22:35:18.000000000 +0200
+++ new/Mojolicious-7.77/Changes        2018-04-30 00:08:39.000000000 +0200
@@ -1,7 +1,14 @@
 
+7.77  2018-04-28
+  - Added support for namespace selectors like "ns|*" to Mojo::DOM::CSS.
+    (jberger)
+  - Added support for :link and :visited pseudo-classes to Mojo::DOM::CSS.
+  - Added support for hyphen-separated list attribute selectors like
+    "[heflang|=en]" to Mojo::DOM::CSS.
+
 7.76  2018-04-23
   - Due to lack of domain experts on the team, Windows is no longer officially
-    supported. Moving foward, we will try to keep Mojolicious installable on
+    supported. Moving forward, we will try to keep Mojolicious installable on
     Windows, but cannot make any promises regarding security and/or 
reliability.
   - Fixed a bug in Mojolicious::Plugin::Config where the config stash value was
     not available when the config_override feature was used. (tim)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/META.json 
new/Mojolicious-7.77/META.json
--- old/Mojolicious-7.76/META.json      2018-04-24 18:54:58.000000000 +0200
+++ new/Mojolicious-7.77/META.json      2018-05-01 19:17:25.000000000 +0200
@@ -58,6 +58,6 @@
       },
       "x_IRC" : "irc://irc.perl.org/#mojo"
    },
-   "version" : "7.76",
+   "version" : "7.77",
    "x_serialization_backend" : "JSON::PP version 2.97001"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/META.yml 
new/Mojolicious-7.77/META.yml
--- old/Mojolicious-7.76/META.yml       2018-04-24 18:54:58.000000000 +0200
+++ new/Mojolicious-7.77/META.yml       2018-05-01 19:17:25.000000000 +0200
@@ -31,5 +31,5 @@
   homepage: http://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/kraih/mojo.git
-version: '7.76'
+version: '7.77'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/README.md 
new/Mojolicious-7.77/README.md
--- old/Mojolicious-7.76/README.md      2017-12-03 03:34:54.000000000 +0100
+++ new/Mojolicious-7.77/README.md      2018-04-27 20:37:53.000000000 +0200
@@ -71,7 +71,7 @@
 
   Use all the latest Perl and HTML features in beautiful single file
   prototypes like this one, and
-  [grow](http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Differences)
+  
[grow](https://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Differences)
   them easily into well-structured **Model-View-Controller** web applications.
 
 ```perl
@@ -104,4 +104,4 @@
 
 ## Want to know more?
 
-  Take a look at our excellent [documentation](http://mojolicious.org/perldoc)!
+  Take a look at our excellent 
[documentation](https://mojolicious.org/perldoc)!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/lib/Mojo/DOM/CSS.pm 
new/Mojolicious-7.77/lib/Mojo/DOM/CSS.pm
--- old/Mojolicious-7.76/lib/Mojo/DOM/CSS.pm    2018-04-05 18:11:16.000000000 
+0200
+++ new/Mojolicious-7.77/lib/Mojo/DOM/CSS.pm    2018-04-30 15:06:46.000000000 
+0200
@@ -19,7 +19,7 @@
 
 sub matches {
   my $tree = shift->tree;
-  return $tree->[0] ne 'tag' ? undef : _match(_compile(shift), $tree, $tree);
+  return $tree->[0] ne 'tag' ? undef : _match(_compile(@_), $tree, $tree);
 }
 
 sub select     { _select(0, shift->tree, _compile(@_)) }
@@ -74,7 +74,7 @@
 }
 
 sub _compile {
-  my $css = trim "$_[0]";
+  my ($css, %ns) = (trim(shift . ''), @_);
 
   my $group = [[]];
   while (my $selectors = $group->[-1]) {
@@ -103,7 +103,7 @@
       my ($name, $args) = (lc $1, $2);
 
       # ":matches" and ":not" (contains more selectors)
-      $args = _compile($args) if $name eq 'matches' || $name eq 'not';
+      $args = _compile($args, %ns) if $name eq 'matches' || $name eq 'not';
 
       # ":nth-*" (with An+B notation)
       $args = _equation($args) if $name =~ /^nth-/;
@@ -119,7 +119,9 @@
 
     # Tag
     elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/gco) {
-      push @$last, ['tag', _name($1)] unless $1 eq '*';
+      my $alias = (my $name = $1) =~ s/^([^|]*)\|// && $1 ne '*' ? $1 : undef;
+      my $ns = length $alias ? $ns{$alias} // return [['invalid']] : $alias;
+      push @$last, ['tag', $name eq '*' ? undef : _name($name), 
_unescape($ns)];
     }
 
     else {last}
@@ -156,6 +158,21 @@
 
 sub _name {qr/(?:^|:)\Q@{[_unescape(shift)]}\E$/}
 
+sub _namespace {
+  my ($ns, $current) = @_;
+
+  my $attr = $current->[1] =~ /^([^:]+):/ ? "xmlns:$1" : 'xmlns';
+  while ($current) {
+    last if $current->[0] eq 'root';
+    return $current->[2]{$attr} eq $ns if exists $current->[2]{$attr};
+
+    $current = $current->[3];
+  }
+
+  # Failing to match yields true if searching for no namespace, false otherwise
+  return !length $ns;
+}
+
 sub _pc {
   my ($class, $args, $current) = @_;
 
@@ -175,6 +192,12 @@
   # ":root"
   return $current->[3] && $current->[3][0] eq 'root' if $class eq 'root';
 
+  # ":link" and ":visited"
+  if ($class eq 'link' || $class eq 'visited') {
+    return undef unless $current->[0] eq 'tag' && exists $current->[2]{href};
+    return !!grep { $current->[1] eq $_ } qw(a area link);
+  }
+
   # ":nth-child", ":nth-last-child", ":nth-of-type" or ":nth-last-of-type"
   if (ref $args) {
     my $type = $class =~ /of-type$/ ? $current->[1] : undef;
@@ -221,13 +244,19 @@
     my $type = $s->[0];
 
     # Tag
-    if ($type eq 'tag') { return undef unless $current->[1] =~ $s->[1] }
+    if ($type eq 'tag') {
+      return undef if defined $s->[1] && $current->[1] !~ $s->[1];
+      return undef if defined $s->[2] && !_namespace($s->[2], $current);
+    }
 
     # Attribute
     elsif ($type eq 'attr') { return undef unless _attr(@$s[1, 2], $current) }
 
     # Pseudo-class
     elsif ($type eq 'pc') { return undef unless _pc(@$s[1, 2], $current) }
+
+    # Invalid selector
+    else { return undef }
   }
 
   return 1;
@@ -262,7 +291,7 @@
 }
 
 sub _unescape {
-  my $value = shift;
+  return undef unless defined(my $value = shift);
 
   # Remove escaped newlines
   $value =~ s/\\\n//g;
@@ -284,6 +313,9 @@
   # "~=" (word)
   return qr/(?:^|\s+)$value(?:\s+|$)/ if $op eq '~';
 
+  # "|=" (hyphen-separated)
+  return qr/^$value(?:-|$)/ if $op eq '|';
+
   # "*=" (contains)
   return qr/$value/ if $op eq '*';
 
@@ -393,6 +425,13 @@
   my $contains = $css->select('input[name*="fo"]');
   my $contains = $css->select('input[name*=fo]');
 
+=head2 E[foo|="en"]
+
+An C<E> element whose C<foo> attribute has a hyphen-separated list of values
+beginning (from the left) with C<en>.
+
+  my $english = $css->select('link[hreflang|=en]');
+
 =head2 E:root
 
 An C<E> element, root of the document.
@@ -477,6 +516,20 @@
 
   my $empty = $css->select(':empty');
 
+=head2 E:link
+
+An C<E> element being the source anchor of a hyperlink of which the target is
+not yet visited (C<:link>) or already visited (C<:visited>). Note that
+L<Mojo::DOM::CSS> is not stateful, therefore C<:link> and C<:visited> yield
+exactly the same results.
+
+  my $links = $css->select(':link');
+  my $links = $css->select(':visited');
+
+=head2 E:visited
+
+Alias for L</"E:link">.
+
 =head2 E:checked
 
 A user interface element C<E> which is checked (for instance a radio-button or
@@ -519,6 +572,19 @@
 L<Selectors Level 4|http://dev.w3.org/csswg/selectors-4>, which is still a work
 in progress.
 
+=head2 A|E
+
+An C<E> element that belongs to the namespace alias C<A> from
+L<CSS Namespaces Module Level 3|https://www.w3.org/TR/css-namespaces-3/>.
+Key/value pairs passed to selector methods are used to declare namespace
+aliases.
+
+  my $elem = $css->select('lq|elem', lq => 'http://example.com/q-markup');
+
+Using an empty alias searches for an element that belongs to no namespace.
+
+  my $div = $c->select('|div');
+
 =head2 E F
 
 An C<F> element descendant of an C<E> element.
@@ -575,20 +641,27 @@
 =head2 matches
 
   my $bool = $css->matches('head > title');
+  my $bool = $css->matches('svg|line', svg => 'http://www.w3.org/2000/svg');
 
-Check if first node in L</"tree"> matches the CSS selector.
+Check if first node in L</"tree"> matches the CSS selector. Trailing key/value
+pairs can be used to declare xml namespace aliases.
 
 =head2 select
 
   my $results = $css->select('head > title');
+  my $results = $css->select('svg|line', svg => 'http://www.w3.org/2000/svg');
 
-Run CSS selector against L</"tree">.
+Run CSS selector against L</"tree">. Trailing key/value pairs can be used to
+declare xml namespace aliases.
 
 =head2 select_one
 
   my $result = $css->select_one('head > title');
+  my $result =
+    $css->select_one('svg|line', svg => 'http://www.w3.org/2000/svg');
 
 Run CSS selector against L</"tree"> and stop as soon as the first node matched.
+Trailing key/value pairs can be used to declare xml namespace aliases.
 
 =head1 SEE ALSO
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/lib/Mojo/DOM.pm 
new/Mojolicious-7.77/lib/Mojo/DOM.pm
--- old/Mojolicious-7.76/lib/Mojo/DOM.pm        2018-02-19 00:56:44.000000000 
+0100
+++ new/Mojolicious-7.77/lib/Mojo/DOM.pm        2018-04-28 23:19:11.000000000 
+0200
@@ -9,7 +9,6 @@
 
 # "Fry: This snow is beautiful. I'm glad global warming never happened.
 #  Leela: Actually, it did. But thank God nuclear winter canceled it out."
-use Carp 'croak';
 use Mojo::Collection;
 use Mojo::DOM::CSS;
 use Mojo::DOM::HTML;
@@ -67,7 +66,10 @@
 
 sub descendant_nodes { $_[0]->_collect(_all(_nodes($_[0]->tree))) }
 
-sub find { $_[0]->_collect($_[0]->_css->select($_[1])) }
+sub find {
+  my $self = shift;
+  return $self->_collect($self->_css->select(@_));
+}
 
 sub following { _select($_[0]->_collect($_[0]->_siblings(1, 1)), $_[1]) }
 sub following_nodes { $_[0]->_collect($_[0]->_siblings(0, 1)) }
@@ -502,6 +504,7 @@
 =head2 at
 
   my $result = $dom->at('div ~ p');
+  my $result = $dom->at('svg|line', svg => 'http://www.w3.org/2000/svg');
 
 Find first descendant element of this element matching the CSS selector and
 return it as a L<Mojo::DOM> object, or C<undef> if none could be found. All
@@ -510,6 +513,12 @@
   # Find first element with "svg" namespace definition
   my $namespace = $dom->at('[xmlns\:svg]')->{'xmlns:svg'};
 
+Trailing key/value pairs can be used to declare xml namespace aliases.
+
+  # "<rect />"
+  $dom->parse('<svg xmlns="http://www.w3.org/2000/svg";><rect /></svg>')
+    ->at('svg|rect', svg => 'http://www.w3.org/2000/svg');
+
 =head2 attr
 
   my $hash = $dom->attr;
@@ -603,6 +612,7 @@
 =head2 find
 
   my $collection = $dom->find('div ~ p');
+  my $collection = $dom->find('svg|line', svg => 'http://www.w3.org/2000/svg');
 
 Find all descendant elements of this element matching the CSS selector and
 return a L<Mojo::Collection> object containing these elements as L<Mojo::DOM>
@@ -620,6 +630,12 @@
   # Find elements with a class that contains dots
   my @divs = $dom->find('div.foo\.bar')->each;
 
+Trailing key/value pairs can be used to declare xml namespace aliases.
+
+  # "<rect />"
+  $dom->parse('<svg xmlns="http://www.w3.org/2000/svg";><rect /></svg>')
+    ->find('svg|rect', svg => 'http://www.w3.org/2000/svg')->first;
+
 =head2 following
 
   my $collection = $dom->following;
@@ -645,6 +661,7 @@
 =head2 matches
 
   my $bool = $dom->matches('div ~ p');
+  my $bool = $dom->matches('svg|line', svg => 'http://www.w3.org/2000/svg');
 
 Check if this element matches the CSS selector. All selectors from
 L<Mojo::DOM::CSS/"SELECTORS"> are supported.
@@ -657,6 +674,12 @@
   $dom->parse('<p class="a">A</p>')->at('p')->matches('.b');
   $dom->parse('<p class="a">A</p>')->at('p')->matches('p[id]');
 
+Trailing key/value pairs can be used to declare xml namespace aliases.
+
+  # True
+  $dom->parse('<svg xmlns="http://www.w3.org/2000/svg";><rect /></svg>')
+    ->matches('svg|rect', svg => 'http://www.w3.org/2000/svg');
+
 =head2 namespace
 
   my $namespace = $dom->namespace;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-7.76/lib/Mojolicious/resources/templates/mojo/menubar.html.ep 
new/Mojolicious-7.77/lib/Mojolicious/resources/templates/mojo/menubar.html.ep
--- 
old/Mojolicious-7.76/lib/Mojolicious/resources/templates/mojo/menubar.html.ep   
    2017-12-22 12:22:45.000000000 +0100
+++ 
new/Mojolicious-7.77/lib/Mojolicious/resources/templates/mojo/menubar.html.ep   
    2018-04-27 20:37:09.000000000 +0200
@@ -51,14 +51,14 @@
     #mojobar-links form { display: inline }
     .animated { transition: all 0.25s ease }
   </style>
-  %= link_to 'http://mojolicious.org' => (id => 'mojobar-brand') => begin
+  %= link_to 'https://mojolicious.org' => (id => 'mojobar-brand') => begin
     <picture>
       <img src="<%= url_for '/mojo/logo-white.png' %>"
         srcset="<%= url_for '/mojo/logo-white-2x.png' %> 2x">
     </picture>
   % end
   <div id="mojobar-links">
-    %= link_to Documentation => 'http://mojolicious.org/perldoc'
+    %= link_to Documentation => 'https://mojolicious.org/perldoc'
     %= link_to Chat => 
'https://chat.mibbit.com/?channel=%23mojo&server=irc.perl.org'
     %= link_to Wiki => 'https://github.com/kraih/mojo/wiki'
     %= link_to GitHub => 'https://github.com/kraih/mojo'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/lib/Mojolicious.pm 
new/Mojolicious-7.77/lib/Mojolicious.pm
--- old/Mojolicious-7.76/lib/Mojolicious.pm     2018-04-21 18:25:19.000000000 
+0200
+++ new/Mojolicious-7.77/lib/Mojolicious.pm     2018-04-30 03:02:24.000000000 
+0200
@@ -65,7 +65,7 @@
 has validator => sub { Mojolicious::Validator->new };
 
 our $CODENAME = 'Doughnut';
-our $VERSION  = '7.76';
+our $VERSION  = '7.77';
 
 sub AUTOLOAD {
   my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.76/t/mojo/dom.t 
new/Mojolicious-7.77/t/mojo/dom.t
--- old/Mojolicious-7.76/t/mojo/dom.t   2018-04-05 18:11:16.000000000 +0200
+++ new/Mojolicious-7.77/t/mojo/dom.t   2018-04-30 00:07:57.000000000 +0200
@@ -1214,6 +1214,27 @@
 $dom->find('div div:only-of-type')->each(sub { push @e, shift->text });
 is_deeply \@e, [qw(J K)], 'found only child';
 
+# Links
+$dom = Mojo::DOM->new(<<EOF);
+<a>A</a>
+<a href=/>B</a>
+<link rel=C>
+<link href=/ rel=D>
+<area alt=E>
+<area href=/ alt=F>
+<div href=borked>very borked</div>
+EOF
+is $dom->find(':link')->map(sub { $_->tag })->join(','), 'a,link,area',
+  'right tags';
+is $dom->find(':visited')->map(sub { $_->tag })->join(','), 'a,link,area',
+  'right tags';
+is $dom->at('a:link')->text,    'B', 'right result';
+is $dom->at('a:visited')->text, 'B', 'right result';
+is $dom->at('link:link')->{rel},    'D', 'right result';
+is $dom->at('link:visited')->{rel}, 'D', 'right result';
+is $dom->at('area:link')->{alt},    'F', 'right result';
+is $dom->at('area:visited')->{alt}, 'F', 'right result';
+
 # Sibling combinator
 $dom = Mojo::DOM->new(<<EOF);
 <ul>
@@ -2346,6 +2367,8 @@
 is $dom->find('a[accesskey~=0]')->[1], undef, 'no result';
 is $dom->find('a[accesskey*=0]')->[0]->text, 'Zero', 'right text';
 is $dom->find('a[accesskey*=0]')->[1], undef, 'no result';
+is $dom->find('a[accesskey|=0]')->[0]->text, 'Zero', 'right text';
+is $dom->find('a[accesskey|=0]')->[1], undef, 'no result';
 is $dom->find('a[accesskey=1]')->[0]->text, 'O&gTn>e', 'right text';
 is $dom->find('a[accesskey=1]')->[1], undef, 'no result';
 is $dom->find('a[accesskey^=1]')->[0]->text, 'O&gTn>e', 'right text';
@@ -2356,6 +2379,8 @@
 is $dom->find('a[accesskey~=1]')->[1], undef, 'no result';
 is $dom->find('a[accesskey*=1]')->[0]->text, 'O&gTn>e', 'right text';
 is $dom->find('a[accesskey*=1]')->[1], undef, 'no result';
+is $dom->find('a[accesskey|=1]')->[0]->text, 'O&gTn>e', 'right text';
+is $dom->find('a[accesskey|=1]')->[1], undef, 'no result';
 is $dom->at('a[accesskey*="."]'), undef, 'no result';
 
 # Empty attribute value
@@ -2387,6 +2412,7 @@
 <p class="foo">A</p>
 <p class="foo bAr">B</p>
 <p class="FOO">C</p>
+<p class="foo-bar">D</p>
 EOF
 is $dom->find('.foo')->map('text')->join(','),            'A,B', 'right 
result';
 is $dom->find('.FOO')->map('text')->join(','),            'C',   'right 
result';
@@ -2399,12 +2425,17 @@
 is $dom->find('[class~=foo]')->map('text')->join(','), 'A,B', 'right result';
 is $dom->find('[class~=foo i]')->map('text')->join(','), 'A,B,C',
   'right result';
-is $dom->find('[class*=f]')->map('text')->join(','),   'A,B',   'right result';
-is $dom->find('[class*=f i]')->map('text')->join(','), 'A,B,C', 'right result';
-is $dom->find('[class^=F]')->map('text')->join(','),   'C',     'right result';
-is $dom->find('[class^=F i]')->map('text')->join(','), 'A,B,C', 'right result';
-is $dom->find('[class$=O]')->map('text')->join(','),   'C',     'right result';
-is $dom->find('[class$=O i]')->map('text')->join(','), 'A,C',   'right result';
+is $dom->find('[class*=f]')->map('text')->join(','), 'A,B,D', 'right result';
+is $dom->find('[class*=f i]')->map('text')->join(','), 'A,B,C,D',
+  'right result';
+is $dom->find('[class^=F]')->map('text')->join(','), 'C', 'right result';
+is $dom->find('[class^=F i]')->map('text')->join(','), 'A,B,C,D',
+  'right result';
+is $dom->find('[class$=O]')->map('text')->join(','),   'C',   'right result';
+is $dom->find('[class$=O i]')->map('text')->join(','), 'A,C', 'right result';
+is $dom->find('[class|=foo]')->map('text')->join(','), 'A,D', 'right result';
+is $dom->find('[class|=foo i]')->map('text')->join(','), 'A,C,D',
+  'right result';
 
 # Nested description lists
 $dom = Mojo::DOM->new(<<EOF);
@@ -2544,4 +2575,85 @@
 is $dom->all_text, 'works', 'right text';
 is "$dom", $huge, 'right result';
 
+# Namespace
+$dom = Mojo::DOM->new->xml(1)->parse(<<EOF);
+<tag xmlns:myns="coolns">
+  <this>foo</this>
+  <myns:this>bar</myns:this>
+</tag>
+EOF
+my %ns = (cool => 'coolns');
+is_deeply $dom->find('cool|this', %ns)->map('text'), ['bar'], 'right result';
+is_deeply $dom->find('cool|*',    %ns)->map('text'), ['bar'], 'right result';
+is_deeply $dom->find('|this',     %ns)->map('text'), ['foo'], 'right result';
+is_deeply $dom->find('*|this', %ns)->map('text'), ['foo', 'bar'],
+  'right result';
+ok !$dom->at('foo|*'), 'no result';
+
+# Namespace declaration on the same tag
+$dom = Mojo::DOM->new->xml(1)->parse('<x:tag xmlns:x="ns" foo="bar" />');
+is $dom->at('ns|tag', ns => 'ns')->{foo}, 'bar', 'right result';
+
+# Explicit no namespace
+$dom = Mojo::DOM->new->xml(1)->parse('<foo xmlns=""><bar /></foo>');
+ok $dom->at('|bar'), 'result';
+
+# Nested namespaces
+$dom = Mojo::DOM->new->xml(1)->parse(<<EOF);
+<foo xmlns="ns:foo">
+  <tag val="1" />
+  <bar xmlns="ns:bar">
+    <tag val="2" />
+    <baz />
+    <yada hreflang="en-US">YADA</yada>
+  </bar>
+</foo>
+EOF
+%ns = (foons => 'ns:foo', barns => 'ns:bar');
+ok $dom->at('foons|foo',                   %ns), 'result';
+ok $dom->at('foons|foo:not(barns|*)',      %ns), 'result';
+ok $dom->at('foo:not(|foo)',               %ns), 'result';
+ok $dom->at('foons|foo:root',              %ns), 'result';
+ok $dom->at('foo:matches(:root, foons|*)', %ns), 'result';
+ok !$dom->at('foons|foo:not(:root)', %ns), 'no result';
+is $dom->at('foons|tag',       %ns)->{val}, 1, 'right value';
+is $dom->at('foons|tag:empty', %ns)->{val}, 1, 'right value';
+ok $dom->at('foons|tag[val="1"]',             %ns), 'result';
+ok $dom->at('foons|tag[val="1"]:empty',       %ns), 'result';
+ok $dom->at('foo > foons|tag[val="1"]',       %ns), 'result';
+ok $dom->at('foons|foo > foons|tag[val="1"]', %ns), 'result';
+ok $dom->at('foo foons|tag[val="1"]',         %ns), 'result';
+ok $dom->at('foons|foo foons|tag[val="1"]',   %ns), 'result';
+ok $dom->at('barns|bar',                      %ns), 'result';
+ok $dom->at('barns|bar:not(foons|*)',         %ns), 'result';
+ok $dom->at('bar:not(|bar)',                  %ns), 'result';
+ok $dom->at('bar:matches(barns|*)',           %ns), 'result';
+ok !$dom->at('barns|bar:root', %ns), 'no result';
+ok $dom->at('barns|bar:not(:root)',              %ns), 'result';
+ok $dom->at('bar:matches(barns|*, :not(:root))', %ns), 'result';
+ok $dom->at('foons|foo barns|bar',               %ns), 'result';
+is $dom->at('barns|tag',       %ns)->{val}, 2, 'right value';
+is $dom->at('barns|tag:empty', %ns)->{val}, 2, 'right value';
+ok $dom->at('barns|tag[val="2"]',                           %ns), 'result';
+ok $dom->at('barns|tag[val="2"]:empty',                     %ns), 'result';
+ok $dom->at('bar > barns|tag[val="2"]',                     %ns), 'result';
+ok $dom->at('barns|bar > barns|tag[val="2"]',               %ns), 'result';
+ok $dom->at('bar barns|tag[val="2"]',                       %ns), 'result';
+ok $dom->at('barns|bar barns|tag[val="2"]',                 %ns), 'result';
+ok $dom->at('foons|foo barns|bar baz',                      %ns), 'result';
+ok $dom->at('foons|foo barns|bar barns|baz',                %ns), 'result';
+ok $dom->at('foons|foo barns|bar barns|tag[val="2"] + baz', %ns), 'result';
+ok $dom->at('foons|foo barns|bar barns|tag[val="2"] + barns|baz', %ns),
+  'result';
+ok $dom->at('foons|foo barns|bar barns|tag[val="2"] ~ baz', %ns), 'result';
+ok $dom->at('foons|foo barns|bar barns|tag[val="2"] ~ barns|baz', %ns),
+  'result';
+ok !$dom->at('foons|bar', %ns), 'no result';
+ok !$dom->at('foons|baz', %ns), 'no result';
+ok $dom->at('baz')->matches('barns|*', %ns), 'match';
+is $dom->at('barns|bar [hreflang|=en]',    %ns)->text, 'YADA', 'right text';
+is $dom->at('barns|bar [hreflang|=en-US]', %ns)->text, 'YADA', 'right text';
+ok !$dom->at('barns|bar [hreflang|=en-US-yada]', %ns), 'no result';
+ok !$dom->at('barns|bar [hreflang|=e]',          %ns), 'no result';
+
 done_testing();


Reply via email to