Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Anonymous function for supportAEL isn't required #1

merged 1 commit into from

2 participants


Use "not not" (cast to boolean)

@Integralist Integralist merged commit 502ec20 into Integralist:master

@Daniel15 thanks Daniel for flagging this up. Using the boolean coercion is a lot cleaner syntax in my opinion but I wasn't sure if it would be worse performing than a one time function execution. So I set-up a performance test case first just to be sure ( and it was a resounding performance optimisation increase which is always nice :-)


Yeah, I didn't benchmark it myself but I'd imagine that the overhead of a function call is far greater than type coercion. Function calls are relatively expensive compared to a lot of other operations. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 8, 2012
  1. @Daniel15
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 7 deletions.
  1. +1 −7 Assets/Scripts/DOMready.js
8 Assets/Scripts/DOMready.js
@@ -4,13 +4,7 @@ var DOMready = (function() {
var win = window,
doc = win.document,
dce = doc.createElement,
- supportAEL = (function(){
- if (doc.addEventListener) {
- return true;
- } else {
- return false;
- }
- }()),
+ supportAEL = !!doc.addEventListener,
queue = [],
Something went wrong with that request. Please try again.