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 (http://html5shiv.googlecode.com/svn/trunk/html5.js) | |
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() | |
// kangax version (29 characters less, yay!) | |
/*@cc_on(function(e,i){i=e.length;while(i--)document.createElement(e[i])})("abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','))@*/ | |
// jdalton version (was 5, now 41 characters less than kangax, yay!) |
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
[] == false; // true | |
"" == false; // true | |
null == false; // false, that's more like it | |
var a = []; | |
if (a) { | |
alert(1); // alert this; in condition need check a.length | |
} else { | |
alert(2); | |
} |
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
/* by Dmitry A. Soshnikov */ | |
var object = (function () { | |
// private | |
var _x = 10; | |
// also private | |
function _privateFunc() { | |
return _x; |
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
/** | |
* Aliases and additional "sugar" | |
* 2010-04-15 | |
* @author Dmitry A. Soshnikov | |
*/ | |
(function () { | |
["defineProperty", "defineProperties", "keys", "getOwnPropertyNames", | |
"getOwnPropertyDescriptor", "getPrototypeOf", "seal", "freeze", | |
"preventExtensions", "isFrozen", "isSealed", "isExtensible"] |
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
if (!window.localStorage || !window.sessionStorage) (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
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
/* | |
* classList.js | |
* | |
* Implements a cross-browser element.classList getter. | |
* | |
*/ | |
"use strict"; | |
if (typeof Element !== "undefined") { |
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
var _restoreSymbol = (function($G) | |
{ | |
var iframe = document.createElement('iframe'); | |
(document.body || document.documentElement).appendChild(iframe); | |
iframe.style.display = 'none'; | |
var win = iframe.contentWindow, doc = win.document; | |
doc.open(); |
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
/** | |
* Delegation based mixins for JavaScript. | |
* | |
* Non-specific extensions are used: | |
* __proto__ | |
* __noSuchMethod__ | |
* | |
* Tested in SpiderMonkey. | |
* | |
* Opened issues: |
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
var _missing= function(data){ return React.DOM.pre(null, "Route not found: "+ data.route) }, | |
_router= null, | |
_started= false, | |
_nextId= 1; | |
function handleRouteChange(container, component) { | |
var routeParams= Array.prototype.slice.call( arguments, 1 ) | |
React.renderComponent( | |
component({ routeParams:routeParams }, null), | |
container |
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
/** | |
* Automatic Reference Counting (ARC) Garbage Collection technique. | |
* | |
* This diff describes Reference counting GC technique. | |
* See also previous lesson on Mark and Sweep GC: | |
* https://gist.github.com/4391763 | |
* | |
* Covered topics: | |
* | |
* 1. Reference value in ECMAScript (JS specific) |
OlderNewer