You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Luke Ma <lu...@lukema.net> on 2008/01/26 22:01:37 UTC

JavascriptStripper bug

Deployment javascript problem: this bug manifests most frequently for apps
that include prototype.js in deployment mode so I'll use it as an example. 
Prototype has this line:

    attr:
/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/

    -----------------------------------------------------------------------^

When JavascriptStripper gets a hold of it, i think it sees that double quote
as the start of a string literal and it will start printing everything as is
after that until it sees a matching closing double quote.  So it interprets
everything after that as a string literal until (much further down in the
prototype.js file)

    document.write("<script id=__onDOMContentLoaded defer
src=//:><\/script>");

The double quote at the beginning of this line ends the string literal,
which means when we get to the double slash at src=//,  it's interpreted as
a comment.  So everything up until this point is actually fine (just not
stripped) but then this line blows up.

I've seen the short answer, which is:
    
    getResourceSettings().setStripJavascriptCommentsAndWhitespace(false); 

Is this a known bug? Should I open a JIRA for it?

Luke
-- 
View this message in context: http://www.nabble.com/JavascriptStripper-bug-tp15112541p15112541.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: JavascriptStripper bug

Posted by Matej Knopp <ma...@gmail.com>.
Please do. I've tested it with prototype (and scriptaculous), but probably
with different version than yo have. The entire quickstart is not needed,
just attach the files that break it.

-Matej

On Jan 26, 2008 10:07 PM, Ryan Sonnek <ry...@gmail.com> wrote:

> this is the second time i've heard of this breaking.  please re-open
> this issue.  if you have a quickstart project that'd be great.
>
> https://issues.apache.org/jira/browse/WICKET-987
>
>
>
> On Jan 26, 2008 3:01 PM, Luke Ma <lu...@lukema.net> wrote:
> >
> > Deployment javascript problem: this bug manifests most frequently for
> apps
> > that include prototype.js in deployment mode so I'll use it as an
> example.
> > Prototype has this line:
> >
> >     attr:
> >
> /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
> >
> >
> -----------------------------------------------------------------------^
> >
> > When JavascriptStripper gets a hold of it, i think it sees that double
> quote
> > as the start of a string literal and it will start printing everything
> as is
> > after that until it sees a matching closing double quote.  So it
> interprets
> > everything after that as a string literal until (much further down in
> the
> > prototype.js file)
> >
> >     document.write("<script id=__onDOMContentLoaded defer
> > src=//:><\/script>");
> >
> > The double quote at the beginning of this line ends the string literal,
> > which means when we get to the double slash at src=//,  it's interpreted
> as
> > a comment.  So everything up until this point is actually fine (just not
> > stripped) but then this line blows up.
> >
> > I've seen the short answer, which is:
> >
> >
> getResourceSettings().setStripJavascriptCommentsAndWhitespace(false);
> >
> > Is this a known bug? Should I open a JIRA for it?
> >
> > Luke
> > --
> > View this message in context:
> http://www.nabble.com/JavascriptStripper-bug-tp15112541p15112541.html
> > Sent from the Wicket - Dev mailing list archive at Nabble.com.
> >
> >
>



-- 
Resizable and reorderable grid components.
http://www.inmethod.com

Re: JavascriptStripper bug

Posted by Ryan Sonnek <ry...@gmail.com>.
this is the second time i've heard of this breaking.  please re-open
this issue.  if you have a quickstart project that'd be great.

https://issues.apache.org/jira/browse/WICKET-987



On Jan 26, 2008 3:01 PM, Luke Ma <lu...@lukema.net> wrote:
>
> Deployment javascript problem: this bug manifests most frequently for apps
> that include prototype.js in deployment mode so I'll use it as an example.
> Prototype has this line:
>
>     attr:
> /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
>
>     -----------------------------------------------------------------------^
>
> When JavascriptStripper gets a hold of it, i think it sees that double quote
> as the start of a string literal and it will start printing everything as is
> after that until it sees a matching closing double quote.  So it interprets
> everything after that as a string literal until (much further down in the
> prototype.js file)
>
>     document.write("<script id=__onDOMContentLoaded defer
> src=//:><\/script>");
>
> The double quote at the beginning of this line ends the string literal,
> which means when we get to the double slash at src=//,  it's interpreted as
> a comment.  So everything up until this point is actually fine (just not
> stripped) but then this line blows up.
>
> I've seen the short answer, which is:
>
>     getResourceSettings().setStripJavascriptCommentsAndWhitespace(false);
>
> Is this a known bug? Should I open a JIRA for it?
>
> Luke
> --
> View this message in context: http://www.nabble.com/JavascriptStripper-bug-tp15112541p15112541.html
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>