Commit 2109072
wangnaihe
feat: W3C DOM/CSS API大规模补齐 — 6阶段实施完成
Phase 1 — DOM Core补全:
- replaceChild, cloneNode(deep), DocumentFragment, Comment节点类型
- nextSibling/previousSibling/firstChild/lastChild访问器
- getElementsByTagName/ClassName, dataset, inner_text, outer_html
- Runtime DOM桥接同步暴露所有新API
Phase 2 — 事件系统重写:
- 40+ EventType变体(pointer/touch/composition/custom等)
- MouseEventData/KeyboardEventData/PointerEventData/WheelEventData子类型
- W3C三阶段事件传播: Capturing → AtTarget → Bubbling
- 监听器options(capture/once/passive), 单监听器按ID移除
- stopImmediatePropagation, CustomEvent
Phase 3 — CSS引擎增强:
- StyleDecl扩展30+新属性(cursor/visibility/pointer-events/outline/flex-basis等)
- CSS简写解析: flex/outline/border完整简写
- CSSStyleDeclaration补齐: text-*/font-*/align-*/outline-*等
- Style struct新增: cursor/visibility/pointer_events/user_select/outline/flex_basis/order/align_self/align_content
- var(--name, fallback)解析与继承链消费
- @Keyframes解析(百分比停靠点/from/to)
- @media解析(规则内容展开而非跳过)
- @font-face解析(font-family/src/weight/style)
Phase 4 — Canvas 2D完善:
- 路径: quadraticCurveTo/bezierCurveTo/ellipse/rect/clip
- 图像: drawImage/putImageData
- 线型: setLineCap/setLineJoin/setMiterLimit/setLineDash
- 变换: setTransform/resetTransform
- TextMetrics扩展: boundingBox ascent/descent
Phase 5 — Selection API:
- Range: collapse/selectNode/selectNodeContents/cloneRange/setStartBefore等
- Selection: removeRange/containsNode/selectionType
Phase 6 — Observer + Window API:
- ResizeObserver/MutationObserver/IntersectionObserver
- Window.matchMedia(min-width/max-width/prefers-color-scheme)
Made-with: Cursor1 parent 08ad98b commit 2109072
17 files changed
Lines changed: 1957 additions & 74 deletions
File tree
- crates
- w3cos-compiler/src
- w3cos-dom/src
- w3cos-runtime/src
- w3cos-std/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
143 | 168 | | |
144 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
145 | 189 | | |
146 | 190 | | |
147 | 191 | | |
| |||
0 commit comments