Issue #25  (removeEventListener(), Visual Tools, Utils, Perf)



(Skip to the tools section below)

You've likely used addEventListener to assign event handlers to elements. You can also remove events using removeEventListener. It's pretty simple, and it might look like this:
 
var btn = document.querySelector('button'),
    output = document.querySelector('output');

btn.addEventListener('click', doStuff, false);

btn.removeEventListener('click', doStuff, false);

function doStuff() {
  alert('button clicked');
}

In this example (demo), the doStuff() function will never fire, because we're removing the event immediately after we add it. You would never do this. Normally, the event would be removed as a result of something else happening. This is just to illustrate the removal.

But notice that you can't remove an event that uses an anonymous function as the second argument:
 
btn.addEventListener('click', function () {
  alert('button clicked');
}, false);

btn.removeEventListener('click', function {
  alert('button clicked');
}, false);

(Demo) This doesn't work because the browser interprets these functions as different functions, both being anonymous. So in order to remove an event, you have to use a pointer of some sort that you can identify correctly in removeEventListener.

Some basic notes on removeEventListener:
  • You can't use this method to do a general 'remove all listeners'; you need to have a specific event and result targeted.
  • But interestingly, you can do something crazy like clone the body element, which removes all event listeners. But this might have other undesirable consquences.
  • As is the case with addEventListener, no support in IE8 and below.
More info:
Now on to this week's tools!


Text Editors and Visual Tools


TernJS for Sublime Text
"It analyses your JS code on-the-fly and provides autocompletion, function argument hints, jump-to-definition, and various automatic refactoring operations."

WebFonter
"Test-drive thousands of web fonts from FontShop, in your desktop browser and in your own design, for free."

GoogleMapBuilder
A nice looking tool to generate code for a custom Google Maps embed. Lets you add map markers, set default zoom level, and lots more.

Formoid
A native Windows or Mac app that creates HTML forms for you using a drag-and-drop GUI. Includes themes, and form output is retina-ready and responsive.

Conzole
A debug panel built in JavaScript that wraps JavaScript native console object methods and functionality in a panel displayed inside the page.

Emmet
A plugin for many popular text editors that improves HTML & CSS workflow. View the demo animation to see some of what it does.

JSONedit
A very easy to use JSON editor.

EditorConfig
"Helps developers define and maintain consistent coding styles between different editors and IDEs."

Video.js Skin Designer
A live editor for Video.js skins, starting with the default Video.js styles. Just edit the LESS variables and watch the changes appear in the embed on the right.

Xpressive
"CSS3 Live Design Tool for Mac OSX." One notable feature: Lets you edit CSS keyframe animations on a timeline.

 

JavaScript Utilities, Polyfills, etc.


Polybutton
"An accessibile version of links that look like buttons." This polyfill tackles the problem of inaccessible buttons. Read the associated blog post for full details.

String.prototype.contains
"A robust & optimized ES3-compatible polyfill for the 'String.prototype.contains' method in ECMAScript 6."

Creditcard.js
"Most credit card forms are a usability disaster, complicating the already clumsy credit card entry process. Creditcard.js avoids these design mistakes, providing an HTML/CSS/JS solution compatible with any payment form."

Headroom.js
"Give your pages some headroom. Hide your header until you need it." No dependencies, a script that hides the header as the user scrolls down past a certain point.

At.js
"An autocompletion library to autocomplete mentions, smileys etc. just like on Github or Twitter." Has Caret.js as a dependency.

textAngular
A powerful Text-Editor/WYSIWYG editor for Angular.js. Create multiple editor instances, two-way-bind HTML content, watch editors for changes and more.

angular-deckgrid
"A lightweight masonry-like grid for AngularJS."

list.js
"Library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML."

 

Performance Tools


DynoSRC
"Eliminate HTTP requests for JavaScript files and serve differential updates to your users on the fly."

Kojak
"A simple utility that can help you figure out which of your JavaScript functions are running too slow. It tracks when your functions are called, how often they are called, how much time they are taking, how the functions were called."

HttpWatch 9.1
"An HTTP sniffer for IE, Firefox, iPhone & iPad that provides new insights into how your website loads and performs."

oboe.js
"A fresh approach to JSON loading that speeds up web applications by providing the parsed objects before the response completes."

PageSpeed Insights
In case you haven't seen it yet, Google's simple analysis tool for making websites faster. Just enter a URL and it spits out reports for both mobile and desktop.

 

A Tweet for Thought

Starting with this issue, each newsletter will feature a dev-related tweet. This week's tweet is from Joe Hewitt from September 2011. Interesting suggestion.


Suggest Your Tool / Corrections?

Made something? Send links via Twitter @WebToolsWeekly (details here). No tutorials or articles, please.

If you have any suggestions, corrections, or improvements, feel free to reply to this email.
 

Poll Results

As you probably noticed, I've decided to go with advertising to support the newsletter financially. The poll results (although only a small sample) showed that most subscribers are fine with ads vs. other methods.
 

Before I Go...

Peter-Paul Koch does some of the best research on mobile bugs and compatibility. As he's done in the past, PPK is asking for donations to help with that. Well worth a few bucks if you can spare it.

Thanks to all for subscribing and reading!

Keep tooling,
Louis
webtoolsweekly.com
@WebToolsWeekly
Copyright © 2013 Web Tools Weekly, All rights reserved.

Email Marketing Powered by MailChimp