Comparing version 0.0.1 to 0.0.2
@@ -243,3 +243,3 @@ 'use strict'; | ||
case 12: return new ComponentConstructor(node, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); | ||
default: throw domv.Exception(Error('domv.wrap : Constructor argument length of ' + arguments.length + ' has not beem implemented')); | ||
default: throw domv.Exception(Error('domv.wrap : Constructor argument length of ' + arguments.length + ' has not been implemented')); | ||
} | ||
@@ -277,3 +277,3 @@ } | ||
case 12: ret[i] = domv.wrap(node[i], ComponentConstructor, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); break; | ||
default: throw domv.Exception(Error('domv.wrap : Constructor argument length of ' + arguments.length + ' has not beem implemented')); | ||
default: throw domv.Exception(Error('domv.wrap : Constructor argument length of ' + arguments.length + ' has not been implemented')); | ||
} | ||
@@ -300,2 +300,43 @@ } | ||
function create_parseArgument(document, wrapped, val) | ||
{ | ||
var j; | ||
if (val === null || val === undefined) | ||
{ | ||
return; | ||
} | ||
if (Array.isArray(val) || objToString.call(val) === '[object Arguments]') | ||
{ | ||
for (j = 0; j < val.length; ++j) | ||
{ | ||
create_parseArgument(document, wrapped, val[j]); | ||
} | ||
} | ||
else if (typeof val === 'object' && !(val instanceof String)) | ||
{ | ||
// caveat: you can not set isDOMVComponent or nodeType in an attribute map | ||
if (val.isDOMVComponent || val.nodeType) | ||
{ | ||
wrapped.appendChild(val); | ||
} | ||
else | ||
{ | ||
wrapped.attr(val); | ||
} | ||
} | ||
else | ||
{ | ||
if (domv.mayContainChildren(wrapped)) | ||
{ | ||
wrapped.appendChild(document.createTextNode(val.toString())); | ||
} | ||
else | ||
{ | ||
wrapped.innerNode.appendData(val.toString()); | ||
} | ||
} | ||
} | ||
/** Convenient function to create a wrapped Node including its attributes (for elements). | ||
@@ -328,43 +369,2 @@ * @param {!external:Document} document_ | ||
function parseArgument(val) | ||
{ | ||
var j; | ||
if (val === null || val === undefined) | ||
{ | ||
return; | ||
} | ||
if (Array.isArray(val) || objToString.call(val) === '[object Arguments]') | ||
{ | ||
for (j = 0; j < val.length; ++j) | ||
{ | ||
parseArgument(val[j]); | ||
} | ||
} | ||
else if (typeof val === 'object' && !(val instanceof String)) | ||
{ | ||
// caveat: you can not set isDOMVComponent or nodeType in an attribute map | ||
if (val.isDOMVComponent || val.nodeType) | ||
{ | ||
wrapped.appendChild(val); | ||
} | ||
else | ||
{ | ||
wrapped.attr(val); | ||
} | ||
} | ||
else | ||
{ | ||
if (domv.mayContainChildren(wrapped)) | ||
{ | ||
wrapped.appendChild(document.createTextNode(val.toString())); | ||
} | ||
else | ||
{ | ||
wrapped.innerNode.appendData(val.toString()); | ||
} | ||
} | ||
} | ||
if (document.isDOMVComponent) | ||
@@ -416,3 +416,3 @@ { | ||
{ | ||
parseArgument(arguments[i]); | ||
create_parseArgument(document, wrapped, arguments[i]); | ||
} | ||
@@ -419,0 +419,0 @@ |
{ | ||
"name": "domv", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": "Joris van der Wel <joris@jorisvanderwel.com>", | ||
@@ -5,0 +5,0 @@ "description": "Create views as components using DOM. Run the same code on the browser and on the server.", |
@@ -8,7 +8,10 @@ 'use strict'; | ||
require('nodeunit/lib/reporters/browser').run({ | ||
'domv': require('./domv.js'), | ||
'Component': require('./Component.js'), | ||
'HtmlDocument': require('./HtmlDocument.js') | ||
}); | ||
return function() | ||
{ | ||
require('nodeunit/lib/reporters/browser').run({ | ||
'domv': require('./domv.js'), | ||
'Component': require('./Component.js'), | ||
'HtmlDocument': require('./HtmlDocument.js') | ||
}); | ||
}; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
247094
5334