@gera2ld/jsx-dom
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,2 +0,2 @@ | ||
/*! @gera2ld/jsx-dom v1.1.1 | ISC License */ | ||
/*! @gera2ld/jsx-dom v1.1.2 | ISC License */ | ||
'use strict'; | ||
@@ -20,3 +20,3 @@ | ||
} else { | ||
el = document.createElement(tag); | ||
el = createElement.createElement(tag); | ||
@@ -59,2 +59,6 @@ if (props) { | ||
createElement.createElement = function (tag) { | ||
return document.createElement(tag); | ||
}; | ||
function matchProps(tag, key, value) { | ||
@@ -61,0 +65,0 @@ return propRules.some(function (rule) { |
@@ -1,2 +0,2 @@ | ||
/*! @gera2ld/jsx-dom v1.1.1 | ISC License */ | ||
/*! @gera2ld/jsx-dom v1.1.2 | ISC License */ | ||
var JSX = (function (exports) { | ||
@@ -21,3 +21,3 @@ 'use strict'; | ||
} else { | ||
el = document.createElement(tag); | ||
el = createElement.createElement(tag); | ||
@@ -60,2 +60,6 @@ if (props) { | ||
createElement.createElement = function (tag) { | ||
return document.createElement(tag); | ||
}; | ||
function matchProps(tag, key, value) { | ||
@@ -62,0 +66,0 @@ return propRules.some(function (rule) { |
@@ -1,2 +0,2 @@ | ||
/*! @gera2ld/jsx-dom v1.1.1 | ISC License */ | ||
var JSX=function(e){"use strict";var c=["innerHTML","innerText","textContent",{key:"value",tag:"textarea"}],i={name:"Fragment"};function f(t,e){Array.isArray(e)?e.forEach(function(e){return f(t,e)}):null!=e&&!1!==e&&("object"!=typeof e?t.appendChild(document.createTextNode(""+e)):t.appendChild(e))}return e.Fragment=i,e.createElement=function(n,r){var o,a;if(n===i)o=document.createDocumentFragment();else{if("string"!=typeof n)throw new Error("Invalid element type: "+n);o=document.createElement(n),r&&Object.keys(r).forEach(function(e){var t=r[e];null!=t&&(e.startsWith("on")?o.addEventListener(e.slice(2).toLowerCase(),t):"children"===e?f(o,t):"style"===e&&"object"==typeof t?function(n,r){Object.keys(r).forEach(function(e){var t=r[e];n.style[e]="number"==typeof t?t+"px":t})}(o,t):"dangerouslySetInnerHTML"===e&&t?o.innerHTML=t.__html||"":"ref"===e&&"function"==typeof t?a=t:"boolean"==typeof t?t?o.setAttribute(e,e):o.removeAttribute(e):function(e,r,o){return c.some(function(t){if(!t)return!1;if("string"==typeof t)return r===t;var n={tag:e,key:r,value:o};return Object.keys(t).every(function(e){return t[e]===n[e]})})}(n,e,t)?o[e]=t:("className"===e?e="class":"labelFor"===e&&(e="for"),o.setAttribute(e,""+t)))})}for(var e=arguments.length,t=new Array(2<e?e-2:0),u=2;u<e;u++)t[u-2]=arguments[u];return f(o,t),a&&a(o),o},e}({}); | ||
/*! @gera2ld/jsx-dom v1.1.2 | ISC License */ | ||
var JSX=function(e){"use strict";var u=["innerHTML","innerText","textContent",{key:"value",tag:"textarea"}],i={name:"Fragment"};function f(n,r){var o,a;if(n===i)o=document.createDocumentFragment();else{if("string"!=typeof n)throw new Error("Invalid element type: "+n);o=f.createElement(n),r&&Object.keys(r).forEach(function(e){var t=r[e];null!=t&&(e.startsWith("on")?o.addEventListener(e.slice(2).toLowerCase(),t):"children"===e?l(o,t):"style"===e&&"object"==typeof t?function(n,r){Object.keys(r).forEach(function(e){var t=r[e];n.style[e]="number"==typeof t?t+"px":t})}(o,t):"dangerouslySetInnerHTML"===e&&t?o.innerHTML=t.__html||"":"ref"===e&&"function"==typeof t?a=t:"boolean"==typeof t?t?o.setAttribute(e,e):o.removeAttribute(e):!function(e,r,o){return u.some(function(t){if(!t)return!1;if("string"==typeof t)return r===t;var n={tag:e,key:r,value:o};return Object.keys(t).every(function(e){return t[e]===n[e]})})}(n,e,t)?("className"===e?e="class":"labelFor"===e&&(e="for"),o.setAttribute(e,""+t)):o[e]=t)})}for(var e=arguments.length,t=new Array(2<e?e-2:0),c=2;c<e;c++)t[c-2]=arguments[c];return l(o,t),a&&a(o),o}function l(t,e){Array.isArray(e)?e.forEach(function(e){return l(t,e)}):null!=e&&!1!==e&&("object"!=typeof e?t.appendChild(document.createTextNode(""+e)):t.appendChild(e))}return f.createElement=function(e){return document.createElement(e)},e.Fragment=i,e.createElement=f,e}({}); |
{ | ||
"name": "@gera2ld/jsx-dom", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Use JSX for HTML elements.", | ||
@@ -5,0 +5,0 @@ "author": "Gerald <i@gerald.top>", |
@@ -6,2 +6,5 @@ interface IComponent { | ||
export declare function createElement(tag: string | IComponent, props?: object, ...children: any[]): any; | ||
export declare namespace createElement { | ||
var createElement: (tag: any) => any; | ||
} | ||
export {}; |
9607
197