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 Table = React.createClass({ | |
render: function render() { | |
var _self = this; | |
var thead = React.DOM.thead({}, | |
React.DOM.tr({}, | |
this.props.cols.map(function (col) { | |
return React.DOM.th({}, col); | |
}))); |
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 HTML = "<div><span>Test</span></div>"; | |
var body = document.querySelector("body"); | |
function parseHTML(htmlString){ | |
var frag = document.createDocumentFragment(), | |
el = document.createElement( "div" ); | |
el.setAttribute("id", "wrapper"); | |
el.innerHTML = HTML; | |
frag.appendChild(el); |
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 HTML = "<div></span>Test</span></div>"; | |
var body = document.querySelector("body"); | |
function parseHTML(htmlString){ | |
var parser = new DOMParser(); | |
var fragment = document.createDocumentFragment(); | |
fragment.appendChild(parser.parseFromString(htmlString, "text/html").querySelector("body")); | |
body.appendChild(fragment); |
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
function is(val, type){ | |
switch(type){ | |
case "finite": | |
return typeof val === "number" && Number.isFinite(val); | |
case "integer": | |
return typeof val === "number" && Number.isInteger(val); | |
case "NaN": | |
return typeof val === "number" && Number.isNaN(val); | |
case "positive": |
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
function getRandomKey(){ | |
Math.random().toString(36).slice(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
var is_attachEvent = !!document.attachEvent, | |
is_addEventListener = !!document.addEventListener; | |
function attach(target, event, fn){ | |
switch(true){ | |
case is_addEventListener: | |
target.addEventListener(event, fn); | |
break; | |
case is_attachEvent: | |
target.attachEvent("on"+event, fn); |
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
function loop(set, fn, order){ | |
var is_array = Object.prototype.toString.call(set) === '[object Array]', | |
i, l; | |
if(is_array){ | |
l = set.length; | |
if (!order) { | |
while(l--){ fn(l); } | |
} | |
else { |