background preloader

Javascript

Facebook Twitter

Graphics

Node.js. Backbone.js. Main Page. How to not suck at jQuery : programming. Engineering: jQuery the Right Way. jQuery has changed the way we write Javascript by abstracting out much of the painful cross-browser implementation details that used to plague developers, but to use it correctly still requires a little knowledge about what’s going on under the hood. In this post we’ll take a good look at jQuery’s selectors and how to use them efficiently. I’ll also talk briefly about DOM manipulation and event handlers. Part 1: Search At its core jQuery is exactly what its name implies, a query engine designed for search. And just like you’re careful to construct efficient SQL queries, you need to take the same care with your jQuery selectors. Efficient selector use boils down to three main concepts.Using the right selectorNarrowing the search spaceCaching Ego and #ID You’re right, it’s never that clear cut Good browsers actually provide a getElementsByClass which greatly improves the performance of class selectors.

See? Narrowing the search Good semantics, good selectors Luckily this isn’t hard to do. A crash course in how DOM events work - Jupiter JavaScript Consulting. DOM events are something that web developers often take for granted, especially with libraries like jQuery. The complexity and low-level mechanics of events are abstracted away. As far we’re concerned, snippets like the following: $('button').click(function(){ console.log('Hello! '); }); just work, and it’s magic. However, if you are building an application of any complexity, a solid understanding of the hows, whys, and wheres of the DOM event model is crucial.

There are three parts to this article: How to listen for an event How events move through the document What the browser is actually doing How to listen for an event There are three ways to listen to an event. DOM Level 0 This is the simplest way of defining an event handler. <button onclick="alert('hello! ') This approach is highly discouraged. DOM Level 1 Setting a DOM Level 1 event handler provides a bit more flexibility than DOM Level 0. Document.getElementById('myButton').onclick = function(){ alert('Hello! ') addEventListener() Handle() Douglas Crockford on JavaScript and HTML5 | Webmonkey?| Wired.com. SAN FRANCISCO, California — When Doug Crockford first encountered JavaScript, his first impression was that it was “one of the most incompetent pieces of software engineering [he'd] ever seen.” His opinion, which is highly regarded since he’s widely considered to be the grand poobah of JavaScript, is one that was shared by many in the web’s early days.

However, as the language has grown and the era of the web app is in full swing, it’s reaching a new level of success far beyond what he (or anyone) could have predicted. The video above, shot here yesterday at the Web 2.0 Expo by the conference organizers at O’Reilly Media, compresses several of Crockford’s thoughts on JavaScript and HTML5 into five minutes. He has hope for HTML5, but he has issues with the way it’s being developed.

Primarily, he’s concerned that there are too many security holes, and that “there’s too much kitchen sink in HTML5″ — excessive duplication of the elements and not enough discipline in the code. See Also: Eloquent JavaScript -- interactive tutorial. JavaScript Guide - MDC. The JavaScript Guide shows you how to use JavaScript and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the JavaScript reference. This Guide is divided into the following chapters. Introduction Grammar and types Control flow and error handling Loops and iteration Functions Expressions and operators Numbers and dates Text formatting Indexed collections Keyed collections Working with objects Details of the object model Promises Iterators and generators.

HTML, CSS, and Javascript from the Ground Up - Google Code University - Google Code.