Archive | Web Design RSS feed for this section

Evaluating JSON Data

14 Dec

Evaluating JSON data is the most fundamental and common use-case for any modern ajax based web application. The most commonly used method to evaluate json strings has always been eval() but there are few other methodologies that I have learnt recently.

1. eval()

var jsonData = window["eval"](  "("  +  jsonString +  ")"   );

Support:  All Browsers variants

2. new Function()

var jsonData = new Function( " return (  "  +  jsonString +   "  ); " );

Support: All Browsers variants

3. Native JSON Object

var jsonData =  JSON.parse( jsonString );

Support: IE8, FF3

Performance benchmarks for these JSON evaluation methods proves that
Performance of Native   JSON Object > eval() > new Function
PS: new Function > eval() for the gekho browsers

So, we could create a wrapper to make sure JSON data is evaluated efficiently.

function parseJSONData( jsonString ){
         if(JSON !== 'undefined' ){
             return JSON.parse( jsonString );
        }
       if(AjxEnv.isGekho){
            return new Function( "return (  "+jsonString+ " ); " );
       }
       return window['eval'](  "(" + jsonString + ")"  );
};

30 Best CSS Examples

1 May

The best way to learn CSS is through trying out or learning from what others have tried. Recently, I chose the later to understand CSS better. Of the many lying out there on the internet, I found this link the best suited for different approaches of modern CSS techniques

30 Exceptional CSS Techniques and Examples

Hope these 30 exceptional CSS examples would guide you to something new and interesting .

Tutuorials for Advanced JavaScript

17 Apr

These are the best tutorials out there, don’t miss these if you are/wannabe javascript programmer. ( Hold your nerves untill these videos load. )

PS: Douglas Crockford is the JavaScript architect of Yahoo!