Re: M2: protect embedded javascript against DollarDot Plugin

Jonathan Swartz <[email protected]>
Newsgroups gmane.comp.web.mason.user
Message-ID <[email protected]>
Oliver - in answer to your original question, I don't have any good ideas about the best way to "escape" $. in code, but I'm open to ideas you have and would be willing to put some kind of escaping syntax in, as long as it didn't break something else in the process :)

On Apr 1, 2012, at 7:49 AM, Roman Daniel wrote:

> I would use Moose (and Mason) modifiers
> 
> If you really need the return value of javascript
> 
> <%around javascript>
> % my $added;
> % $.Capture(\$added) {{
> $.get("/news", {}, function(d) {
>                $("#news").append(d);
>        });
> % }}
> return $orig->($self). $added;
> </%around>
> 
> It is a bit cumbersome.
> 
> But If you dont' need the return value and the only usage of $.javascript is to immediately output it
> 
> <% $.javascript %>
> 
> things go much simpler
> 
> <%after javascript>
> $.get("/news", {}, function(d) {
>                $("#news").append(d);
>        }); 
> </%after>
> 
> and you can replace <% $.javascript %> with
> % $.javascript;
> (<% $.javascript %> still works, but I think is confusing because the value is output as a side effect)
> 
> Roman Daniel
> 
> Dne 31. března 2012 20:26 Oliver Paukstadt <[email protected]> napsal(a):
> Hello,
> 
> I am using H::M for a long time and started to play with M2 now.
> While doing some experiments porting one of my sites I had to embed some
> jQuery code:
> <%class>
> method javascript {return $self->SUPER::javascript() . q{
> $.get("/news", {}, function(d) {
>                $("#news").append(d);
>        });
> }; };
> </%class>
> This results in
>  $self->get ("/news", {}, function(d) {
> after processing.
> Any idea how to protect or preserve the jquery DollarDot inside single
> quotes?
> $}.q{.get("/news", ... is really ugly and octal encodings are only
> available in interpolating double quotes.
> 
> Greetings
> Oliver
> --
> Oliver Paukstadt <[email protected]>
> 
> 
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Mason-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-users
> 
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here 
> http://p.sf.net/sfu/sfd2d-msazure_______________________________________________
> Mason-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-users

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev

_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.