Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mention that all mojo.* stash values are reserved for internal use
  • Loading branch information
kraih committed Jul 4, 2012
1 parent 247a934 commit b973403
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/Mojolicious/Controller.pm
Expand Up @@ -933,7 +933,8 @@ Non persistent data storage and exchange, application wide default values can
be set with L<Mojolicious/"defaults">. Many stash values have a special
meaning and are reserved, the full list is currently C<action>, C<app>, C<cb>,
C<controller>, C<data>, C<extends>, C<format>, C<handler>, C<json>, C<layout>,
C<namespace>, C<partial>, C<path>, C<status>, C<template> and C<text>.
C<namespace>, C<partial>, C<path>, C<status>, C<template> and C<text>. Note
that all stash values with a C<mojo.*> prefix are reserved for internal use.
# Manipulate stash
$c->stash->{foo} = 'bar';
Expand Down
15 changes: 8 additions & 7 deletions t/mojo/dom.t
Expand Up @@ -210,10 +210,11 @@ is $dom->at('[id="snowm\000021an"]'), undef, 'no result';
is $dom->at('[id="snowm\000021 an"]'), undef, 'no result';

# Unicode and escaped selectors
my $unicode = encode 'UTF-8',
qq#<html><div id="☃x">Snowman</div><div class="x ♥">Heart</div></html>#;
my $chars
= qq#<html><div id="☃x">Snowman</div><div class="x ♥">Heart</div></html>#;
my $bytes = encode 'UTF-8', $chars;
$dom = Mojo::DOM->new->charset('UTF-8');
$dom->parse($unicode);
$dom->parse($bytes);
is $dom->at("#\\\n\\002603x")->text, 'Snowman', 'right text';
is $dom->at('#\\2603 x')->text, 'Snowman', 'right text';
is $dom->at("#\\\n\\2603 x")->text, 'Snowman', 'right text';
Expand Down Expand Up @@ -275,11 +276,11 @@ is $dom->at('[class~=x]')->text, 'Heart', 'right text';
is $dom->at('div[class~=x]')->text, 'Heart', 'right text';
is $dom->at('html div[class~=x]')->text, 'Heart', 'right text';
is $dom->at('html > div[class~=x]')->text, 'Heart', 'right text';
is $dom->to_xml, $unicode, 'XML is equal';
is $dom->content_xml, $unicode, 'XML is equal';
is $dom->to_xml, $bytes, 'XML is encoded';
is $dom->content_xml, $bytes, 'XML is encoded';
$dom->charset(undef);
isnt $dom->to_xml, $unicode, 'XML is not equal';
isnt $dom->content_xml, $unicode, 'XML is not equal';
is $dom->to_xml, $chars, 'XML is not encoded';
is $dom->content_xml, $chars, 'XML is not encoded';

# Looks remotely like HTML
$dom = Mojo::DOM->new->parse(
Expand Down

0 comments on commit b973403

Please sign in to comment.