Commit d0bf2d57 by Иван Кубота

call constructors with new

parent 3b2575a3
...@@ -83,7 +83,12 @@ NS.apply = function(a,b) { ...@@ -83,7 +83,12 @@ NS.apply = function(a,b) {
if(typeOfType === 'function'){ if(typeOfType === 'function'){
// factory passed // factory passed
return type(cfg, ArraySlice.call(arguments, 2)); if(type.constructor !== void 0) {
// instantiate
return new type( cfg, ArraySlice.call( arguments, 2 ) );
}else {
return type( cfg, ArraySlice.call( arguments, 2 ) );
}
}else if(type !== null && typeof type === 'object' && type.hook){ }else if(type !== null && typeof type === 'object' && type.hook){
// hooked future element creation // hooked future element creation
return type.hook(cfg, ArraySlice.call(arguments, 2)); return type.hook(cfg, ArraySlice.call(arguments, 2));
......
{ {
"name": "react-vanilla", "name": "react-vanilla",
"version": "1.1.12", "version": "1.1.13",
"description": "", "description": "",
"main": "DOM.js", "main": "DOM.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment