-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
529 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Table of contents | ||
|
||
* [JS MythBusters](/README.md) | ||
* [Array] | ||
* [Reallocation](/array/reallocation.md) | ||
* [Array.pop() better than Array.shift()] | ||
* [All you need to know about arguments] | ||
* [Date] | ||
* [Create timestamps with Date.now()] | ||
* [Error] | ||
* [Avoid try/catch] | ||
* [Function] | ||
* [Make Your Constructors new-Agnostic] | ||
* [Avoid .bind, is slower] | ||
* [RegexEp] | ||
* [Use RegExp in cases with sense] | ||
* [Focus RegExp on failing faster] | ||
* [Use the correct RegExp method] | ||
* [String] | ||
* [Instead of String.concat, use '+='] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function ready (fn) { | ||
if (document.readyState === 'complete') { | ||
return fn() | ||
} else if (document.addEventListener) { | ||
document.addEventListener('DOMContentLoaded', fn) | ||
} else { | ||
document.attachEvent('onreadystatechange', function () { | ||
if (document.readyState === 'interactive') fn() | ||
}) | ||
} | ||
} | ||
|
||
function addClass (el, className) { | ||
if (el.classList) el.classList.add(className) | ||
else el.className += ' ' + className | ||
} | ||
|
||
ready(function () { | ||
addClass(document.body, 'hack') | ||
addClass(document.body, 'dark') | ||
}) |
Oops, something went wrong.