On Thu, Feb 9, 2012 at 6:16 PM, Frank van Lankvelt <f...@a-eskwadraat.nl> wrote:
>
> On 8 feb. 2012, at 16:01, Emond Papegaaij <emond.papega...@topicus.nl> wrote:
>
>> In Wicket 6, onDomReady and onLoad scripts are merged into one big script in
>> the ResourceAggregator. This is to prevent many script tags, all with
>> $(document).ready(function(){...}) (or the wicket equivalent). This merging 
>> is
>> only done for non-AJAX requests, to preserve the separate evaluates. Removing
>> this check, will merge all evals into one.
>>
>> One side note, the {}s are not added yet.
>>
> I'm not sure if this was implemented already, but javascript blocks do not 
> limit the scope of variables.  See e.g. Crockford 
> http://javascript.crockford.com/code.html
> The only way to limit scope is to use functions, according to this document.

Correct. My mistake.

>
> Cheers, Frank
>
>> Emond
>>
>> On Wednesday 08 February 2012 16:54:17 Martin Grigorov wrote:
>>> On Wed, Feb 8, 2012 at 4:50 PM, Emond Papegaaij
>>>
>>> <emond.papega...@topicus.nl> wrote:
>>>> This is very easy to accomplish in 6.0. You only have to delete the code
>>>> that keeps the scripts separate when AJAX :). I can fix this, if you
>>>> want?
>>> I think we talk about different things.
>>> I talk about Ajax response:
>>> <ajax-response>
>>>  <evaluate> someJS1();</evaluate>
>>>  <evaluate> someJS2();</evaluate>
>>>  <evaluate> someJS3();</evaluate>
>>>  <component id="someId"><div>new content</div>
>>> </ajax-request>
>>>
>>>> Emond
>>>>
>>>> On Wednesday 08 February 2012 16:44:14 Martin Grigorov wrote:
>>>>> On Wed, Feb 8, 2012 at 4:33 PM, Bertrand Guay-Paquet
>>>>>
>>>>> <ber...@step.polymtl.ca> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Merging multiple evaluates together will change the scope of some
>>>>>> variables. The variables in the scope of an evaluate block would carry
>>>>>> on
>>>>>> in the following evaluate blocks. This could however be mitigated by
>>>>>> wrapping each evaluate block in its own function.
>>>>>
>>>>> True.
>>>>> Wrapping them in {} should be enough to prevent this problem.
>>>>>
>>>>>> Bertrand
>>>>>>
>>>>>> On 08/02/2012 8:24 AM, Martin Grigorov wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Do you imagine a use case in which several<evaluate>s in
>>>>>>> <ajax-response>  should be executed separately (one after another) as
>>>>>>> it is now ?
>>>>>>> Each<evaluate>  (and<priority-evaluate>) is executed in an eval() in
>>>>>>> wicket-ajax.js. As we all know eval() is slow. As an optimization I
>>>>>>> think we can merge all<evaluate>s in one (at server side) and eval
>>>>>>> them all together. The only drawback I see is that error reporting
>>>>>>> will be worse because the exception message will say "there is an
>>>>>>> error in 'all JS in one<evaluate>  here' "
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to