You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Marcel Offermans <ma...@luminis.nl> on 2012/12/20 13:52:25 UTC

Bug? Concaternating JS files and implicit semi-colons...

We ran into an issue today where we had multiple JS includes that were converted into one big JS file by the ConcatProxyServlet that basically seems to just (as the name implies) concaternate multiple JS files into one. That is fine in principle, but it seems that some of the original minified files do not end with a semi-colon, for example jquery-ui [1]. ECMAscript has rules for implicit semi-colon insertion, one of which is "at the end of the stream" [2]. This means that when you start concaternating streams, you might need to insert an explicit semi-colon. However, the ConcatProxyServlet does not do this and we get JS errors because of it. I would say this is a bug, but I wanted to discuss it on the list first, before reporting it in Jira. WDYT?

Greetings, Marcel

PS: later versions of jquery-ui DO add an explicit semi-colon so possibly authors of such libraries are aware of such concat issues and fixing this issue in a different way, but I still think Shindig should do "the right thing"


[1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
[2] http://stackoverflow.com/a/6252209/260424


Re: Bug? Concaternating JS files and implicit semi-colons...

Posted by Ryan Baxter <rb...@apache.org>.
In theory yes I agree with what you are saying but since I have never run
into this myself I am curious to see the problem.  Let me know when you
have the gadget.


On Thu, Dec 20, 2012 at 4:18 PM, Marcel Offermans <
marcel.offermans@luminis.nl> wrote:

> Hello Ryan,
>
> I'll have to whip something up, as I indeed cannot send you the gadget in
> question unaltered. I will do that tomorrow. In the mean time I was
> wondering what you thought of my analysis:
>
> If JS has semantics that state that "end of stream" is a location for
> implicit semi-colon insertion, would not those semantics change per
> definition once you start concat'ing different JS files into one?
>
> Anyway, more tomorrow! :)
>
> Greetings, Marcel
>
>
> On Dec 20, 2012, at 17:25 , Ryan Baxter <rb...@apache.org> wrote:
>
> > It just saves time so that I make sure I am trying the same thing you are
> > doing that is all.  If you have one handy that is not confidential it
> would
> > help.
> >
> >
> > On Thu, Dec 20, 2012 at 8:45 AM, Marcel Offermans <
> > marcel.offermans@luminis.nl> wrote:
> >
> >> We are working with the latest release, but by looking at trunk I think
> >> the problem is still present there.
> >>
> >> If you just take the jquery-ui in [1] and add some other JS library
> after
> >> that, run it through concat, and save the resulting JS file, your
> browser
> >> will immediately tell you there is an error.
> >>
> >> Do you really want me to publish a gadget on some public URL so you can
> >> add it to Shindig yourself?
> >>
> >> Greetings, Marcel
> >>
> >>
> >> On Dec 20, 2012, at 14:36 PM, Ryan Baxter <rb...@apache.org> wrote:
> >>
> >>> Marcel, which version of Shindig were you working with?  Can you
> provide
> >> a
> >>> sample gadget that illustrated the problem?
> >>>
> >>>
> >>> On Thu, Dec 20, 2012 at 7:52 AM, Marcel Offermans <
> >>> marcel.offermans@luminis.nl> wrote:
> >>>
> >>>> We ran into an issue today where we had multiple JS includes that were
> >>>> converted into one big JS file by the ConcatProxyServlet that
> basically
> >>>> seems to just (as the name implies) concaternate multiple JS files
> into
> >>>> one. That is fine in principle, but it seems that some of the original
> >>>> minified files do not end with a semi-colon, for example jquery-ui
> [1].
> >>>> ECMAscript has rules for implicit semi-colon insertion, one of which
> is
> >> "at
> >>>> the end of the stream" [2]. This means that when you start
> >> concaternating
> >>>> streams, you might need to insert an explicit semi-colon. However, the
> >>>> ConcatProxyServlet does not do this and we get JS errors because of
> it.
> >> I
> >>>> would say this is a bug, but I wanted to discuss it on the list first,
> >>>> before reporting it in Jira. WDYT?
> >>>>
> >>>> Greetings, Marcel
> >>>>
> >>>> PS: later versions of jquery-ui DO add an explicit semi-colon so
> >> possibly
> >>>> authors of such libraries are aware of such concat issues and fixing
> >> this
> >>>> issue in a different way, but I still think Shindig should do "the
> right
> >>>> thing"
> >>>>
> >>>>
> >>>> [1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
> >>>> [2] http://stackoverflow.com/a/6252209/260424
> >>>>
> >>>>
> >>
> >>
>
>

Re: Bug? Concaternating JS files and implicit semi-colons...

Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Ryan,

I'll have to whip something up, as I indeed cannot send you the gadget in question unaltered. I will do that tomorrow. In the mean time I was wondering what you thought of my analysis:

If JS has semantics that state that "end of stream" is a location for implicit semi-colon insertion, would not those semantics change per definition once you start concat'ing different JS files into one?

Anyway, more tomorrow! :)

Greetings, Marcel


On Dec 20, 2012, at 17:25 , Ryan Baxter <rb...@apache.org> wrote:

> It just saves time so that I make sure I am trying the same thing you are
> doing that is all.  If you have one handy that is not confidential it would
> help.
> 
> 
> On Thu, Dec 20, 2012 at 8:45 AM, Marcel Offermans <
> marcel.offermans@luminis.nl> wrote:
> 
>> We are working with the latest release, but by looking at trunk I think
>> the problem is still present there.
>> 
>> If you just take the jquery-ui in [1] and add some other JS library after
>> that, run it through concat, and save the resulting JS file, your browser
>> will immediately tell you there is an error.
>> 
>> Do you really want me to publish a gadget on some public URL so you can
>> add it to Shindig yourself?
>> 
>> Greetings, Marcel
>> 
>> 
>> On Dec 20, 2012, at 14:36 PM, Ryan Baxter <rb...@apache.org> wrote:
>> 
>>> Marcel, which version of Shindig were you working with?  Can you provide
>> a
>>> sample gadget that illustrated the problem?
>>> 
>>> 
>>> On Thu, Dec 20, 2012 at 7:52 AM, Marcel Offermans <
>>> marcel.offermans@luminis.nl> wrote:
>>> 
>>>> We ran into an issue today where we had multiple JS includes that were
>>>> converted into one big JS file by the ConcatProxyServlet that basically
>>>> seems to just (as the name implies) concaternate multiple JS files into
>>>> one. That is fine in principle, but it seems that some of the original
>>>> minified files do not end with a semi-colon, for example jquery-ui [1].
>>>> ECMAscript has rules for implicit semi-colon insertion, one of which is
>> "at
>>>> the end of the stream" [2]. This means that when you start
>> concaternating
>>>> streams, you might need to insert an explicit semi-colon. However, the
>>>> ConcatProxyServlet does not do this and we get JS errors because of it.
>> I
>>>> would say this is a bug, but I wanted to discuss it on the list first,
>>>> before reporting it in Jira. WDYT?
>>>> 
>>>> Greetings, Marcel
>>>> 
>>>> PS: later versions of jquery-ui DO add an explicit semi-colon so
>> possibly
>>>> authors of such libraries are aware of such concat issues and fixing
>> this
>>>> issue in a different way, but I still think Shindig should do "the right
>>>> thing"
>>>> 
>>>> 
>>>> [1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
>>>> [2] http://stackoverflow.com/a/6252209/260424
>>>> 
>>>> 
>> 
>> 


Re: Bug? Concaternating JS files and implicit semi-colons...

Posted by Ryan Baxter <rb...@apache.org>.
It just saves time so that I make sure I am trying the same thing you are
doing that is all.  If you have one handy that is not confidential it would
help.


On Thu, Dec 20, 2012 at 8:45 AM, Marcel Offermans <
marcel.offermans@luminis.nl> wrote:

> We are working with the latest release, but by looking at trunk I think
> the problem is still present there.
>
> If you just take the jquery-ui in [1] and add some other JS library after
> that, run it through concat, and save the resulting JS file, your browser
> will immediately tell you there is an error.
>
> Do you really want me to publish a gadget on some public URL so you can
> add it to Shindig yourself?
>
> Greetings, Marcel
>
>
> On Dec 20, 2012, at 14:36 PM, Ryan Baxter <rb...@apache.org> wrote:
>
> > Marcel, which version of Shindig were you working with?  Can you provide
> a
> > sample gadget that illustrated the problem?
> >
> >
> > On Thu, Dec 20, 2012 at 7:52 AM, Marcel Offermans <
> > marcel.offermans@luminis.nl> wrote:
> >
> >> We ran into an issue today where we had multiple JS includes that were
> >> converted into one big JS file by the ConcatProxyServlet that basically
> >> seems to just (as the name implies) concaternate multiple JS files into
> >> one. That is fine in principle, but it seems that some of the original
> >> minified files do not end with a semi-colon, for example jquery-ui [1].
> >> ECMAscript has rules for implicit semi-colon insertion, one of which is
> "at
> >> the end of the stream" [2]. This means that when you start
> concaternating
> >> streams, you might need to insert an explicit semi-colon. However, the
> >> ConcatProxyServlet does not do this and we get JS errors because of it.
> I
> >> would say this is a bug, but I wanted to discuss it on the list first,
> >> before reporting it in Jira. WDYT?
> >>
> >> Greetings, Marcel
> >>
> >> PS: later versions of jquery-ui DO add an explicit semi-colon so
> possibly
> >> authors of such libraries are aware of such concat issues and fixing
> this
> >> issue in a different way, but I still think Shindig should do "the right
> >> thing"
> >>
> >>
> >> [1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
> >> [2] http://stackoverflow.com/a/6252209/260424
> >>
> >>
>
>

Re: Bug? Concaternating JS files and implicit semi-colons...

Posted by Marcel Offermans <ma...@luminis.nl>.
We are working with the latest release, but by looking at trunk I think the problem is still present there.

If you just take the jquery-ui in [1] and add some other JS library after that, run it through concat, and save the resulting JS file, your browser will immediately tell you there is an error.

Do you really want me to publish a gadget on some public URL so you can add it to Shindig yourself?

Greetings, Marcel


On Dec 20, 2012, at 14:36 PM, Ryan Baxter <rb...@apache.org> wrote:

> Marcel, which version of Shindig were you working with?  Can you provide a
> sample gadget that illustrated the problem?
> 
> 
> On Thu, Dec 20, 2012 at 7:52 AM, Marcel Offermans <
> marcel.offermans@luminis.nl> wrote:
> 
>> We ran into an issue today where we had multiple JS includes that were
>> converted into one big JS file by the ConcatProxyServlet that basically
>> seems to just (as the name implies) concaternate multiple JS files into
>> one. That is fine in principle, but it seems that some of the original
>> minified files do not end with a semi-colon, for example jquery-ui [1].
>> ECMAscript has rules for implicit semi-colon insertion, one of which is "at
>> the end of the stream" [2]. This means that when you start concaternating
>> streams, you might need to insert an explicit semi-colon. However, the
>> ConcatProxyServlet does not do this and we get JS errors because of it. I
>> would say this is a bug, but I wanted to discuss it on the list first,
>> before reporting it in Jira. WDYT?
>> 
>> Greetings, Marcel
>> 
>> PS: later versions of jquery-ui DO add an explicit semi-colon so possibly
>> authors of such libraries are aware of such concat issues and fixing this
>> issue in a different way, but I still think Shindig should do "the right
>> thing"
>> 
>> 
>> [1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
>> [2] http://stackoverflow.com/a/6252209/260424
>> 
>> 


Re: Bug? Concaternating JS files and implicit semi-colons...

Posted by Ryan Baxter <rb...@apache.org>.
Marcel, which version of Shindig were you working with?  Can you provide a
sample gadget that illustrated the problem?


On Thu, Dec 20, 2012 at 7:52 AM, Marcel Offermans <
marcel.offermans@luminis.nl> wrote:

> We ran into an issue today where we had multiple JS includes that were
> converted into one big JS file by the ConcatProxyServlet that basically
> seems to just (as the name implies) concaternate multiple JS files into
> one. That is fine in principle, but it seems that some of the original
> minified files do not end with a semi-colon, for example jquery-ui [1].
> ECMAscript has rules for implicit semi-colon insertion, one of which is "at
> the end of the stream" [2]. This means that when you start concaternating
> streams, you might need to insert an explicit semi-colon. However, the
> ConcatProxyServlet does not do this and we get JS errors because of it. I
> would say this is a bug, but I wanted to discuss it on the list first,
> before reporting it in Jira. WDYT?
>
> Greetings, Marcel
>
> PS: later versions of jquery-ui DO add an explicit semi-colon so possibly
> authors of such libraries are aware of such concat issues and fixing this
> issue in a different way, but I still think Shindig should do "the right
> thing"
>
>
> [1] http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
> [2] http://stackoverflow.com/a/6252209/260424
>
>