jsx-dom-runtime
Advanced tools
Comparing version 0.50.0 to 0.51.0
@@ -92,5 +92,6 @@ /// <reference lib="dom" /> | ||
type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent, T> | ||
type PictureInPictureEventHandler<T = Element> = EventHandler<PictureInPictureEvent, T> | ||
interface DOMAttributes<T> extends JSX.Attributes { | ||
__ns?: typeof xhtmlNS | typeof svgNS | typeof mathmlNS; | ||
ns?: typeof xhtmlNS | typeof svgNS | typeof mathmlNS; | ||
ref?: RefCallback<T> | RefObject<T> | ||
@@ -544,3 +545,3 @@ children?: TChild | TChild[] | ||
export interface SVGAttributes<T extends EventTarget> extends HTMLAttributes<T> { | ||
__ns?: typeof svgNS, | ||
ns?: typeof svgNS, | ||
href?: string | ||
@@ -878,3 +879,4 @@ cx?: number | string | ||
export interface MathMLAttributes extends AriaAttributes, DOMAttributes<MathMLElement> { | ||
__ns?: typeof mathmlNS; | ||
ns?: typeof mathmlNS; | ||
xmlns?: typeof mathmlNS | ||
id?: string | ||
@@ -1000,2 +1002,4 @@ class?: string | ||
ontoggle?: TEventHandler<HTMLDialogElement>; | ||
onclose?: TEventHandler<HTMLDialogElement>; | ||
oncancel?: TEventHandler<HTMLDialogElement>; | ||
} | ||
@@ -1481,4 +1485,5 @@ | ||
disableRemotePlayback?: boolean | ''; | ||
onenterpictureinpicture?: TEventHandler<HTMLVideoElement>; | ||
onleavepictureinpicture?: TEventHandler<HTMLVideoElement>; | ||
onenterpictureinpicture?: PictureInPictureEventHandler<HTMLVideoElement>; | ||
onleavepictureinpicture?: PictureInPictureEventHandler<HTMLVideoElement>; | ||
onresize?: PictureInPictureEventHandler<HTMLVideoElement>; | ||
} | ||
@@ -1485,0 +1490,0 @@ |
const appendChildren = (node, children) => { | ||
if (Array.isArray(children)) { | ||
// Just shorter that the .forEach | ||
children.some(child => appendChildren(node, child)); | ||
@@ -16,3 +15,3 @@ } else if (children != null && children !== false) { | ||
const internalKeys = new Set(['ref', 'children', '__ns']); | ||
const internalKeys = new Set(['ns', 'children', 'ref']); | ||
const extensions = new Map(); | ||
@@ -23,3 +22,3 @@ const properties = new Set(['value']); | ||
val, | ||
node = props.__ns ? document.createElementNS(props.__ns, tag) : document.createElement(tag); | ||
node = props.ns ? document.createElementNS(props.ns, tag) : document.createElement(tag); | ||
for (key in props) { | ||
@@ -36,3 +35,2 @@ if (internalKeys.has(key)) { | ||
} else { | ||
// reuse `key` variable | ||
for (key in val) { | ||
@@ -55,6 +53,3 @@ if (key.startsWith('--')) { | ||
appendChildren(tag === 'template' ? node.content : node, props.children); | ||
// reuse `val` variable | ||
val = props.ref; | ||
if (val) { | ||
if (val = props.ref) { | ||
if (typeof val === 'function') { | ||
@@ -61,0 +56,0 @@ val(node); |
{ | ||
"name": "jsx-dom-runtime", | ||
"version": "0.50.0", | ||
"version": "0.51.0", | ||
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM. Support HTML, SVG and MathML tags", | ||
@@ -58,3 +58,3 @@ "type": "module", | ||
"babel-jest": "^29.5.0", | ||
"eslint": "^8.40.0", | ||
"eslint": "^8.41.0", | ||
"fs-extra": "^11.1.1", | ||
@@ -61,0 +61,0 @@ "jest": "^29.5.0", |
@@ -51,2 +51,3 @@ # jsx-dom-runtime | ||
- [Get Started](https://github.com/shoonia/jsx-dom-runtime/wiki#jsx-dom-runtime) | ||
- [Syntax](https://github.com/shoonia/jsx-dom-runtime/wiki#syntax) | ||
@@ -53,0 +54,0 @@ - [APIs](https://github.com/shoonia/jsx-dom-runtime/wiki#apis) |
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
59
79344
2053