[TYPO3-dev] awesome javascript coding style

Thomas Allmer at at delusionworld.com
Fri Jun 17 14:25:40 CEST 2011


On 16.06.2011 11:02, Ernesto Baschny [cron IT] wrote:
> Dmitry Dulepov schrieb am 16.06.2011 09:40:
>> Hi!
>>
>> Thomas Allmer wrote:
>>> I'm pretty impressed by behaviour and it will definitely change the way
>>> how I will write my JavaScript... maybe it will also help some of
>>> you... :)
>>>
>>> <http://www.clientcide.com/code-releases/clientcide-3-0-behavior-1-0-mootools-development-and-so-much-more/>
>>>
>>
>> I prefer to have a valid XHTML and that would not be valid. I usually
>> put a configuration block as inline js on the page. Something like this:
>>
>> <?php
>>
>> $config = array(
>>      'redirect_url' =>  $this->cObj->typolink(...),
>>      ...
>> );
>>
>> $content = '<script type="text/javascript">var namespace.module_config=' .
>>      json_encode($config) . '</script>';
>>
>> ?>
>>
>> Easy, fast and valid.
>
> It's not about XHTML, but about HTML5, where this "data-*" attributes
> are valid [1].
>
> Cheers,
> Ernesto
>
> [1]
> http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data

thx for pointing that out...

and it's by fare more then "just" a configuration for a certain 
javascript Class... it's about automatic instantiating of classes for 
certain html objects with specific configurations.

I mean we all know this... loading something via ajax and then the 
images inside the loaded content won't have the zoom affect which is 
actually performed on domready, so we have to do a ajax onComplete redo 
the domready stuff...

and exactly this won't be needed anymore... and that is in my opinion a 
huge benefit... moreover it's completely progressive enhancement and 
allows for really usage and configuration from non javascript pros...

as you might guess I like it :p

cheers
-- 
+---------------------------------+-----------------------------------+
| Thomas Allmer                   |   http://www.delusionworld.com    |
| E-mail: at at delusionworld.com    |   phone: +43 699 16217064         |
+---------------------------------+-----------------------------------+




More information about the TYPO3-dev mailing list