inferno-create-element
Version:
Provides methods to create Inferno VNodes
2 lines (1 loc) • 1.16 kB
JavaScript
var e=require("inferno");function n(e){return void 0===e||null===e}function o(e){return"string"===typeof e}function t(e){return void 0===e}function r(r,i){var l,a,c,s=null,f=null,u=null,d=arguments.length<=2?0:arguments.length-2;if(1===d)l=arguments.length<=2?void 0:arguments[2];else if(d>1){l=[];for(var p=0;p<d;p++)l.push(p+2<2||arguments.length<=p+2?void 0:arguments[p+2])}if(!o(r)){if(a=2,t(l)||(i||(i={}),i.children=l),!n(i))for(var m in c={},i)if("key"===m)f=i.key;else if("ref"===m)s=i.ref;else switch(m){case"onComponentDidAppear":case"onComponentDidMount":case"onComponentDidUpdate":case"onComponentShouldUpdate":case"onComponentWillDisappear":case"onComponentWillMount":case"onComponentWillUnmount":case"onComponentWillUpdate":s||(s={}),s[m]=i[m];break;default:c[m]=i[m]}return e.createComponentVNode(a,r,c,f,s)}if(a=e.getFlagsForElementVnode(r),!n(i))for(var h in c={},i)"className"===h||"class"===h?u=i[h]:"key"===h?f=i.key:"children"===h&&t(l)?l=i.children:"ref"===h?s=i.ref:("contenteditable"===h&&(a|=4096),c[h]=i[h]);if(8192&a)return e.createFragment(1===d?[l]:l,0,f);return e.createVNode(a,r,u,l,0,c,f,s)}exports.createElement=r;
;