Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVASCRIPT


  How to choose JavaScript template engine?

With the increase of density of web front end development, AJAX and JSON are used more and more frequently, it's necessary to use many tags in front end development.You may have a JSON object as below:var data={  email: 'terry.li@gbin1.com,  gender: 'male'  }Then you need to organize the JSON data into page elements.var email, gender;email= '' + data.email+'; gender= '' + data.gender +'; $('#contentwrapper‘).append(content).append(gender);The output is very simple:terry.li@gbin1.com MaleIf only simple codes are generated, then it's fine. However, if a page uses many t...

5,583 0       TEMPLATE JAVASCRIPT TEMPLATE ENGINE


  XMLHttpRequest Level 2 user guide

XMLHttpRequest is a web browser interface, it makes it possible for JavaScript doing HTTP(s) communication. Microsoft's IE5 first introduced XMLHttpRequest, because it's so useful that many other browsers also adopted this. AJAX came to the front since.However, this interface is not standardized, implementation among different browsers is different, with the emerging of HTML5, W3C is considering to standardize this interface. In February 2008, they proposed a XMLHttpRequest Level 2 draft.This new version of XMLHttpRequest proposes many new functions, it will push the evolution of Internet. Her...

7,798 0       XMLHTTPREQUEST PROGRESS UPLOAD BINARY DATA


  Firefox 18 will adopt IonMonkey as its JS compiler

Tendency would be converse after 30 years. The previous famous Firefox is now forced to change its version number frequently becuase of the rise of Chrome. Last month Mozilla released Firefox 15 and  also released news about Firefox 17, And now Firefox 18 is also ready to come out.According to PCWorld, to keep the promise of bring quicker and smoother experience, Mozzila will adopts new JavaScript technology in Firefox 18. The new Firefox with new JavaScript technology will be 26% quicker than Firefox 17. If we take Google Chrome's v8 engine as a benchmark, then Firefox will be 7% qu...

3,575 0       JAVASCRIPT FIREFOX 18 IONMONKEY


  trim() in JavaScript

In the past, JavaScript didn't define the trim() function for String object. This makes web programmers frustrated since they often need to implement this function themselves if they want to handle user inputs. The new version of ECMA-262 introduces the trim() function.15.5.4.20   String.prototype.trim ( )     The following steps are taken:     1.   Call CheckObjectCoercible passing the this value as its argument.   2.   Let S be the result of calling ToString, giving it the this value as its argument.   3.  L...

3,745 0       JAVASCRIPT IMPLEMENTATION TRIM()


  Some short code snippets which use all JavaScript keywords

In JavaScript, keywords are reserved and cannot be used as variable or function names. For example void, function and this are JavaScript keywords, they are keywords which are reserved for special use. Here is list of the keywords in JavaScript. We also show you some short code snippets which use all the keywords in JavaScript.void function() {//abcd   do break;while(typeof delete this);  for(var a;;)  if (true)  with(null)  try{}catch(a){}finally{} else throw new 1;   switch(1 in 1 instanceof 1) {    case false:    default: ...

4,188 0       JAVASCRIPT KEYWORD CODE SNIPPET


  Three ways to define class in JavaScript

In object oriented programming, class is the template of object, it defines the properties and methods of a group of objects. Unfortunately, JavaScript doesn't support class, but we can have some workarounds to simulate class.1. Constructor functionThis is the classical approach, it is also the approach mentioned in many text books. It uses the constructor function to simulate class and it uses the keyword this to represent the object internally.function Cat() {  this.name = "Kelly";}when creating the instance, use the new keyword.var cat1=new Cat();alert(cat1.name); //KellyThe p...

11,803 0       JAVASCRIPT METHOD CLASS INHERITANCE PRIVATE


  Regular expression to get html meta description

When we need to process a HTML page source code, we often need to retrieve the meta description of the page besides the links in the page. This description is usually located in <meta> tag of a HTML page. The meta description is very useful for search engine index. How can we retrieve the meta description? If we use a regular expression, we can easily get the meta description.In JavaScript, the regular expression looks like :var pattern = /<meta.*?name="description".*?content="(.*?)".*?>|<meta.*?content="(.*?)".*?name="description".*?>/i;since the description is the content i...

16,122 0       JAVASCRIPT HTML REGULAR EXPRESSION META DESCRIPTION


  jQuery 2.0 will drop support for some IE6/7/8 oddities

jQuery official website releases its road map for the future jQuery development. This road map reveals that jQuery 1.8 will be released within a month and other consecutive versions will follow the following release plan:jQuery 1.9 (early 2013): many of the interfaces already deprecated in version 1.8 will be removed; some of them will be available as plugins or alternative APIs supported by the jQuery project. IE 6/7/8 will be supported as today.jQuery 1.9.x (ongoing in 2013 and beyond): This version will continue to get fixes for any regressions, new browser bugs, etc.jQuery 2.0 (early 2013,...

4,047 0       JQUERY JQUERY 2.0 IE SUPPORT