On of the interesting new things that Javascript 1.8.5 introduced is something that we were doing for long time – binding functions to events while controlling the context of called method. If up until now we used tricks like closures to create this binding, now this is built into the language. Binding Events This is [...]
In many programming languages we have the concept of including files/scripts in a project. This means that the compiler or the interpreter needs to fetch and read another file. This is one of the building blocks of modern programming. In JavaScript we don’t have an actual include but we can add scripts to the DOM [...]
If you ever had the need to compare two javascript object you know that this is not an easy task. Javascript compare objects by reference, so only if it is the same object the javascript compare will return true. The Problem The simple solution to compare two object is to iterate on the properties and [...]
What is BabaJS BabaJS is an open source Javascript template engine/manager. Read the full and updated documentation at github The basic concept is: Template + Data = HTML Here is a simple example: <!– user template –> <div class="user"> <span>< %=data.userName%></span> < %IF data.hasPic %> <img src="<% return 'http://imgs.mydomain.com/'+ data.userPic; %/>" /> < %ELSE%> <span>Add [...]
We all know the auto-complete feature. We use it in google search, when google tries to suggest our search term, and you probably saw it in many other sites which implemented the auto-complete for their own use. Most of the auto-complete out there are implemented in a text field, where the user has one line [...]