background preloader

Javascript

Facebook Twitter

Coodict/javascript-in-one-pic. Jquery - How can I get keydown events on a div in chrome? Journey Through The JavaScript MVC Jungle. When writing a Web application from scratch, it’s easy to feel like we can get by simply by relying on a DOM1 manipulation library (like jQuery412) and a handful of utility plugins.

Journey Through The JavaScript MVC Jungle

The problem with this is that it doesn’t take long to get lost in a nested pile of jQuery callbacks and DOM elements without any real structure in place for our applications. In short, we’re stuck with spaghetti code3. Fortunately there are modern JavaScript frameworks that can assist with bringing structure and organization to our projects, improving how easily maintainable they are in the long-run.

What Is MVC, Or Rather MV*? Link These modern frameworks provide developers an easy path to organizing their code using variations of a pattern known as MVC4 (Model-View-Controller). Models represent the domain-specific knowledge and data in an application. JavaScript ‘MVC’ frameworks that can help us structure our code don’t always strictly follow the above pattern. Light Table - a new IDE concept. You can now try Light Table out via the Light Table Playground!

Light Table - a new IDE concept

Light Table's kickstarter has wrapped up! Despite the dramatic shift toward simplification in software interfaces, the world of development tools continues to shrink our workspace with feature after feature in every release. Lazy Load Plugin for jQuery. Lazy Load is delays loading of images in long web pages.

Lazy Load Plugin for jQuery

Images outside of viewport are not loaded until user scrolls to them. This is opposite of image preloading. Using Lazy Load on long web pages will make the page load faster. In some cases it can also help to reduce server load. Plugin is inspired by YUI ImageLoader Utility by Matt Mlinac. For those in hurry there are several demo pages: basic options, with fadein effect, noscript fallback, horizontal scrolling, horizontal scrolling inside container, vertical scrolling inside container, page with gazillion images, load images using timeout and load images using AJAX(H).

When checking the demos clear browser cache between each request. 24 JavaScript Best Practices for Beginners. As a follow-up to "30 HTML and CSS Best Practices", this week, we'll review JavaScript!

24 JavaScript Best Practices for Beginners

Once you've reviewed the list, be sure to let us know what little tips you've come across! JavaScript utilizes two different kinds of equality operators: === | ! == and == | ! = It is considered best practice to always use the former set when comparing. Introduction to JavaScript Source Maps. Have you ever found yourself wishing you could keep your client-side code readable and more importantly debuggable even after you've combined and minified it, without impacting performance?

Introduction to JavaScript Source Maps

Well now you can through the magic of source maps. Basically it's a way to map a combined/minified file back to an unbuilt state. When you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. Developer tools (currently WebKit nightly builds, Google Chrome, or Firefox 23+) can parse the source map automatically and make it appear as though you're running unminified and uncombined files. Demo: Get original location The above demo allows you to right click anywhere in the textarea containing the generated source. The Future of Web Apps – Single Page Applications. The Future of Web Apps – Single Page Applications Mark Boas The world wide web is constantly evolving and so is the way we write the applications that run upon it.

The Future of Web Apps – Single Page Applications

The web was never really designed as a platform for today’s applications, nevertheless we continue to bend it to our will. Pixelhandler: Developing a Modular JavaScript Application With RequireJS and Backbone.js... Asynchronous Programming in JavaScript with “Promises” - IEBlog. Asynchronous patterns are becoming more common and more important to moving web programming forward.

Asynchronous Programming in JavaScript with “Promises” - IEBlog

Detecting HTML5/CSS3 Features using Modernizr - Dan Wahlin's WebLog. HTML5, CSS3, and related technologies such as canvas and web sockets bring a lot of useful new features to the table that can take Web applications to the next level.

Detecting HTML5/CSS3 Features using Modernizr - Dan Wahlin's WebLog

These new technologies allow applications to be built using only HTML, CSS, and JavaScript allowing them to be viewed on a variety of form factors including tablets and phones. Although HTML5 features offer a lot of promise, it’s not realistic to develop applications using the latest technologies without worrying about supporting older browsers in the process. If history has taught us anything it’s that old browsers stick around for years and years which means developers have to deal with backward compatibility issues. This is especially true when deploying applications to the Internet that target the general public. Parallel asynchronous Ajax requests using jQuery. Lab.js and jQuery with $(window).load(function() fire much too early. Strings. Page last changed today See section 5F of the book. split() and toString() do not work in Netscape 2 and Explorer 3. substr() is not supported by Netscape 2 and 3, Explorer 3, Hotjava 3, Opera 3 and WebTV.

Strings

This page has been translated into French. On this page I explain what strings are and then give an overview of some useful things you can do with them. Strings are simply groups of characters, like 'JavaScript', 'Hello world! ' When you write JavaScripts, you need to know what strings are and how they work. First I explain the basics of strings. String basics Let's review the basics of strings. DevTools/Features/SourceMap. Please use "Edit with form" above to edit this page.

DevTools/Features/SourceMap

Status Team Open issues/risks Stage 1: Definition 1. Nearly every web developer starts with JavaScript in one form during development and then produces JavaScript in another form for production use. When JavaScript gets an error, being able to help the web developer out by showing them where the error occurred in the original source file (PHP script or unminified, still-separate JavaScript for example) would save the developer time every single time they hit an error. For a long time, there have been languages that have compiled to JavaScript, and recently there has been a surge in support for these languages led by CoffeeScript. When developing an application in CoffeeScript, any time an error is hit the browser tells the user the location of the problem in the JavaScript file, not the source file that the user is working with. SPWA_meap_ch01.pdf (application/pdf Object)