This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Listener Object | |
* For event registration and unregistration | |
*/ | |
var listener = (function() { | |
function listenerAdd(elm, evt, func) { | |
if( elm.addEventListener ) { | |
elm.addEventListener(evt, func, false); | |
} else if( elm.attachEvent ) { | |
elm.attachEvent('on'+evt, func); | |
} |
- [Why you don't need Meteor][20]
- [Shim status of ES6][1]
- [unshimmable subset of ES5][2]
- [Host objects][3]
- [Why you don't need jQuery][4]
- [All the DOM recursion you'll ever need][5]
- [The heart of pd][6]
- [jQuery library critique][7]
- [klass][8]
- [tiny select][9]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Canvas Hexagonal Map</title> | |
<style type="text/css"> | |
canvas { | |
border:0; | |
display:block; | |
margin:0 auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.w3.org/TR/2011/WD-page-visibility-20110602/ | |
(function () { | |
"use strict"; | |
//no need to shim if it's already there | |
if ( 'hidden' in document && 'onvisibilitychange' in document ) { | |
return; | |
} | |
//fail silently if the browser sux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy and paste this into the address bar or create a bookmark with this as the location. | |
// STOP SOPA! | |
javascript:$(".content").each(function(){var a=$(this),b=a.text().replace(/\S/g,"\u2587");a.text(b)});; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pretty fast - http://jsperf.com/select-vs-natives-vs-jquery | |
/* | |
By, shortcuts for getting elements. | |
*/ | |
var By = { | |
id: function (id) { return document.getElementById(id) }, | |
tag: function (tag, context) { | |
return (context || document).getElementsByTagName(tag) | |
}, | |
"class": function (klass, context) { |
Related: [Why you don't need jQuery as an abstraction][2]
$
itself is a god object. Everything goes on it. The standard plugin / extension architecture that is recommended is to just bolt more methods on $
itself!
Surely this is bad. An example would be how we have both $.load
which is overloaded to do completely different things. If they were on two separate sensibly named objects $Container.load
and $EventTarget.load
. Personally I would deprecate the latter in favour of .on('load'
The animation should be it's own little modular thing, not bolted onto $
. Ajax should be it's own little modular thing, not bolted onto $