Rocky_Mountain_Vending/.pnpm-store/v10/files/db/fe07fe968ba867502caaef9f5c48d803e724efef77afd782dc14c0a90d177894efda072e3bb5185938010c479ee8da150d66e1d411a4dbd760eee9fe3ac3fe
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

52 lines
No EOL
1.8 KiB
Text

const DOMAttributeNames = {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv',
noModule: 'noModule'
};
const ignoreProps = [
'onLoad',
'onReady',
'dangerouslySetInnerHTML',
'children',
'onError',
'strategy',
'stylesheets'
];
function isBooleanScriptAttribute(attr) {
return [
'async',
'defer',
'noModule'
].includes(attr);
}
export function setAttributesFromProps(el, props) {
for (const [p, value] of Object.entries(props)){
if (!props.hasOwnProperty(p)) continue;
if (ignoreProps.includes(p)) continue;
// we don't render undefined props to the DOM
if (value === undefined) {
continue;
}
const attr = DOMAttributeNames[p] || p.toLowerCase();
if (el.tagName === 'SCRIPT' && isBooleanScriptAttribute(attr)) {
// Correctly assign boolean script attributes
// https://github.com/vercel/next.js/pull/20748
;
el[attr] = !!value;
} else {
el.setAttribute(attr, String(value));
}
// Remove falsy non-zero boolean attributes so they are correctly interpreted
// (e.g. if we set them to false, this coerces to the string "false", which the browser interprets as true)
if (value === false || el.tagName === 'SCRIPT' && isBooleanScriptAttribute(attr) && (!value || value === 'false')) {
// Call setAttribute before, as we need to set and unset the attribute to override force async:
// https://html.spec.whatwg.org/multipage/scripting.html#script-force-async
el.setAttribute(attr, '');
el.removeAttribute(attr);
}
}
}
//# sourceMappingURL=set-attributes-from-props.js.map