Archive

Posts Tagged ‘Javascript’

Dart Language: Better Alternative to JavaScript

May 23rd, 2013

Google has developed Dart Language for Web Development to replace JavaScript. It will replace all bad part of JavaScript and keep good part and add few more features to make developers task easier and web page less prone to error. Of course speed is very important factor for developing dart… (Continue)

Coding Standards for CSS, HTML, JavaScript, Python, C and others by Google

Jul 21st, 2012

Google has made coding standards and style guide for CSS, HTML, JavaScript, Python, C++ and Objective C. If you work on any of these then you may like to have a look at those page. As usual the guidelines writing is simple yet useful. For CSS and HTML there are… (Continue)

Few Newer JavaScript Functions

Jul 10th, 2012

Here are few newer JavaScript functions: querySelector, querySelectorAll, matchesSelector, and classList.
querySelector is for selecting DOM based on CSS selector. It is native to JS. So, it is faster than earlier methods libraries (jQuery) used to give us. Details here.
Now, libraries will start adopting it as first choice instead… (Continue)

YUI3 to JQuery Conversion or Opposite

Jun 20th, 2012

I have written few lines of YUI3 code and I wanted to convert that into jQuery as it is. I have noted down these differences:
YUI to jQuery
1. Instead of just ‘this’ → $(this).
Inside JQuery callback function, ‘this’ refers to DOM object, not a jQuery object.
2. node.one()/node.all()… (Continue)

Table Sorting in JavaScript

Jun 20th, 2012

Here is code which is an extension of Client-side Table Sorting using JavaScript. This extension add few features to the table sorting code in javaScript.
This code does not need to add event handler in HTML code. Using JavaScript itself, hander is getting added. Based on string in column, sorting… (Continue)

YUI3: Accordion Examples

Jun 8th, 2012

Here is a ready three examples of YUI3 Accordions. Last one is the trimmed version so that you can use your own styles on it. I am presenting simplest code here which is the last one.
Working Demo of the Simple Accordion. There you will find link to 2nd example.… (Continue)

YUI3: Convert DOM Object to YUI3 Node and Convert YUI node to DOM element

Jun 6th, 2012

DOM object to YUI3 Node:
Wrap the DOM element in Y.one() or Y.all() depending on DOM element is single element or a list. Y.Node() and Y.NodeList() is also available.
// returns a Y.Node instance
node = Y.one(document.createElement(‘span’));
// or
// node = new Y.Node(document.createElement(‘span’));
// Y.all NodeList method:
spans =… (Continue)

YUI3: How to get an Item from YUI object

Jun 6th, 2012

Get an item from YUI3 object using this syntax:
obj.item(num)
Ex1:
for(var i=0, len=yuiObj.size(); i… (Continue)

YUI3: How to Pass Argument to Event Handler

Jun 6th, 2012

To pass argument to event handler in YUI3:
this.on(‘click’, eventHandler, null, arg1, arg2, …);
function eventHandler(e, arg1, arg2) {}… (Continue)

Array Join instead of String concat in Loop in JavaScript!

May 15th, 2012

You may have seen array join after pushing data inside Array for concatenation work in JavaScript. That was faster method compared to doing large number of string concatenation in older Browser. Browser used to crash in such large number of concatenation. So, Array Join was the workaround. Now, change your… (Continue)