Skip to content

Instantly share code, notes, and snippets.

View dom2html.js
function nodeToString ( node ) {
var tmpNode = document.createElement( "div" );
tmpNode.appendChild( node.cloneNode( true ) );
var str = tmpNode.innerHTML;
tmpNode = node = null; // prevent memory leaks in IE
return str;
}
//http://stackoverflow.com/questions/4239587/create-string-from-htmldivelement
@lonfee88
lonfee88 / test_glob.js
Last active Aug 29, 2015
node path.sep
View test_glob.js
var glob = require('glob');
var path = require('path');
var sep = process.platform != 'win32' ? '\\' : '/';
console.log(sep);
var patterns = ['**/*.js', '**\\*.js'];
patterns.map(function(pattern){
var tmp = pattern.split(sep).join(path.sep);
console.log(pattern);
console.log(tmp);