Comparing version 3.0.1 to 3.1.0
14
crel.js
@@ -75,6 +75,12 @@ //Copyright (C) 2012 Kory Nunn | ||
appendChild = function(element, child) { | ||
if(!crel[isNodeString](child)){ | ||
child = d.createTextNode(child); | ||
} | ||
element.appendChild(child); | ||
if (isArray(child)) { | ||
child.map(function(subChild){ | ||
appendChild(element, subChild); | ||
}); | ||
return; | ||
} | ||
if(!crel[isNodeString](child)){ | ||
child = d.createTextNode(child); | ||
} | ||
element.appendChild(child); | ||
}; | ||
@@ -81,0 +87,0 @@ |
@@ -8,12 +8,14 @@ { | ||
], | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"main": "crel.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"tape-run": "^2.1.3", | ||
"browserify": "^14.4.0", | ||
"tape": "^3.0.3", | ||
"tape-run": "^3.0.0", | ||
"uglify-js": "^2.4.16" | ||
}, | ||
"scripts": { | ||
"test": "browserify ./test | tape-run", | ||
"test": "browserify ./test/index.js | tape-run", | ||
"testBuild": "browserify ./test/index.js > ./test/index.browser.js", | ||
"build": "uglifyjs crel.js -m -c > crel.min.js" | ||
@@ -20,0 +22,0 @@ }, |
@@ -50,2 +50,28 @@ var crel = require('../'), | ||
test('append array children', function(t) { | ||
t.plan(1); | ||
var testElement = crel('div', [1, 2, 3]); | ||
t.equal( | ||
testElement.childNodes.length, | ||
3 | ||
); | ||
t.end(); | ||
}); | ||
test('append deep array children', function(t) { | ||
t.plan(1); | ||
var testElement = crel('div', [[1, 2, 3]]); | ||
t.equal( | ||
testElement.childNodes.length, | ||
3 | ||
); | ||
t.end(); | ||
}); | ||
test('add attributes to an existing element', function(t) { | ||
@@ -52,0 +78,0 @@ t.plan(2); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23421
284
4