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)
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)
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)
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)
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)
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)
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)
Get an item from YUI3 object using this syntax:
obj.item(num)
Ex1:
for(var i=0, len=yuiObj.size(); i… (Continue)
To pass argument to event handler in YUI3:
this.on(‘click’, eventHandler, null, arg1, arg2, …);
function eventHandler(e, arg1, arg2) {}… (Continue)
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)