Skip to content

Commit

Permalink
ssr attribute inline updates
Browse files Browse the repository at this point in the history
  • Loading branch information
titoBouzout committed Oct 20, 2024
1 parent 388985b commit 80b9efe
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions packages/dom-expressions/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,18 @@ export function ssrElement(tag, props, children, needsId) {
} else if (BooleanAttributes.has(prop)) {
if (value) result += prop;
else continue;
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
} else if (
value == undefined ||
prop === "ref" ||
prop.slice(0, 2) === "on" ||
prop.slice(0, 5) === "prop:"
) {
continue;
} else if (prop.slice(0, 5) === "bool:") {
if (!value) continue;
result += escape(prop.slice(5));
} else if (prop.slice(0, 5) === "attr:") {
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
} else {
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
}
Expand Down Expand Up @@ -605,9 +615,7 @@ export function Assets(props) {
}

/* istanbul ignore next */
/**
* @deprecated Replaced by renderToStream
*/
/** @deprecated Replaced by renderToStream */
export function pipeToNodeWritable(code, writable, options = {}) {
if (options.onReady) {
options.onCompleteShell = ({ write }) => {
Expand All @@ -624,9 +632,7 @@ export function pipeToNodeWritable(code, writable, options = {}) {
}

/* istanbul ignore next */
/**
* @deprecated Replaced by renderToStream
*/
/** @deprecated Replaced by renderToStream */
export function pipeToWritable(code, writable, options = {}) {
if (options.onReady) {
options.onCompleteShell = ({ write }) => {
Expand All @@ -643,9 +649,7 @@ export function pipeToWritable(code, writable, options = {}) {
}

/* istanbul ignore next */
/**
* @deprecated Replaced by ssrElement
*/
/** @deprecated Replaced by ssrElement */
export function ssrSpread(props, isSVG, skipChildren) {
let result = "";
if (props == null) return result;
Expand Down Expand Up @@ -678,17 +682,13 @@ export function ssrSpread(props, isSVG, skipChildren) {
prop.slice(0, 5) === "prop:"
) {
continue;
} else if (prop.slice(0, 5) === "bool:") {
if (!value) continue;
result += escape(prop.slice(5));
} else if (prop.slice(0, 5) === "attr:") {
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
} else {
// bool:
if (prop.slice(0, 5) === "bool:") {
if (!value) continue;
prop = prop.slice(5);
result += `${escape(prop)}`;
} else {
// attr:
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
}
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
}
if (i !== keys.length - 1) result += " ";
}
Expand Down

0 comments on commit 80b9efe

Please sign in to comment.