-
Notifications
You must be signed in to change notification settings - Fork 105
Description
The style property is no more added to the resulting HTML elements.
Previously, the style property was handled differently:
van/addons/van_jsx/src/jsx-runtime.js
Lines 36 to 39 in 2c6536e
export const jsx = (jsxTag, { children, style, ref, ...props }) => { | |
if (typeof jsxTag === "string") { | |
const ele = van.tags[jsxTag](mergeStyle(props, style), children); | |
if (ref != null) { |
But now, it should be handled like the other properties:
van/addons/van_jsx/src/createElement.js
Lines 3 to 7 in 223c979
const createElement = (jsxTag, { children, style, ref, ...props }) => { | |
if (typeof jsxTag === "string") { | |
// TODO VanNode to VanElement | |
const ele = van.tags[jsxTag](children); | |
for (const [key, value] of Object.entries(props ?? {})) { |
van/addons/van_jsx/src/hyper.js
Lines 11 to 16 in 223c979
export const setAttribute = (element, key, value) => { | |
// Convert Style Object | |
if (key === "style") { | |
const attr = styleToString(value); | |
element.setAttribute(key, attr); | |
return; |
The point is that the style property is not in the props array because of destructuring in the createElement parameters.
As the style parameter is no more used in the current implementation, it should be left in the properties array. It will be correctly handled by the setAttribute function.