Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[compiler] A valueless `prop:` attribute is dropped silently by both compilers

已关闭
#4,180 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃

调研方向

Read packages/compiler/src/dom/attrs.rs, especially classify_plan, and compare it with the Babel plugin's handling of valueless namespaced attributes. Reproduce with the JSX examples in the issue using generate: "dom"; determine the intended behavior for prop: and whether other namespaces share it. Done means both compilers consistently treat the bare attribute as true or report a compile error.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

A prop: attribute with no value (<el prop:active />) compiles to nothing: no property write and no warning. @solidjs/babel-plugin and @solidjs/compiler behave the same way.

This is deliberate. classify_plan in packages/compiler/src/dom/attrs.rs returns PlanDisposition::Skip for PlanValue::None on prop:, with the comment "Babel wraps valueless namespaced attributes into empty expression containers, which are then skipped." The Rust compiler's transform returns only { code, map }, so it has no way to report a diagnostic.

Your Example Website or App

Minimal repro inline below. Real-world occurrence: https://github.com/openclaw/openclaw/pull/169182

Steps to Reproduce the Bug or Issue

Compile with either compiler (generate: "dom"):

export const A = () => <x-term prop:active />;
export const B = () => <x-term prop:active={true} />;
export const C = () => <x-term active />;

Output (identical from both compilers, trimmed):

var _tmpl$ = _$template(`<x-term>`, 1),
  _tmpl$2 = _$template(`<x-term active>`, 1);
export const A = () => (() => { var _el$ = _tmpl$(); /* nothing */ return _el$; })();
export const B = () => (() => { var _el$2 = _tmpl$(); _el$2.active = true; return _el$2; })();
export const C = () => (() => { var _el$3 = _tmpl$2(); return _el$3; })();
Expected behavior

In JSX, a bare attribute means true, and Solid follows that for plain attributes (C). Either:

  • treat prop:x as prop:x={true}, consistent with plain attributes; or
  • make it a compile error ("prop:x needs a value").

Either way, change both compilers together. The same question probably applies to other namespaced attributes that have no value.

Screenshots or Videos

No response

Platform
  • OS: macOS (Darwin 25.5)
  • Browser: n/a (reproduced in Node v24.18.0 with vitest, importing source)
  • Version: solid next @ b0ad1df50 (2026-10-20, after 2.0.0-rc.16)
Additional context

In OpenClaw's Solid 2 migration, a bare prop:active made the Control UI terminal side panel open blank. It also turned checks-ui-e2e red for every PR until it was found: https://github.com/openclaw/openclaw/pull/169182

主要语言
TypeScript
星标
36.1k
派生
1.1k
平均合并
11 小时 17 分钟
30 天内合并 PR
371

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

solidjs/solid 的其他 Issue

查看 solidjs/solid 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。