Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. Walkthrough
ChangesCSS 自定义属性处理
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to CSS custom-property reads, removals, and style replacement now retain the original names. No concrete merge-blocking risk remains; the change is ready for normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The fix makes CSS custom-property removal and lookup consistent with how those properties are stored. It introduces no identified new privilege or security boundary. Callers beyond the assessed runtime code remain uncertain. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 兔子轻敲小键盘, Comment |
这个 PR 做了什么? (简要描述所做更改)
Root cause:
Style#setPropertystores a CSS variable such as--main-colorunder its original name, butremovePropertyandgetPropertyValuealways pass the name throughtoCamelCase, which turns--main-colorintoMainColor. The lookup never matches, so:style.getPropertyValue('--main-color')returns''(also noted in Taro Next 在微信小程序中无法用 js 设置 css variable #7436)style.removeProperty('--main-color')andstyle.setProperty('--main-color', null)do nothingstyle.cssText(whichsetAttribute('style', ...)andremoveAttribute('style')also do) keeps old variables, because the setter clears the previous properties throughremoveProperty. Afterstyle.cssText = 'color: red;'the style is still--main-color: blue; color: red;Fix: skip
toCamelCasefor names starting with--, using the existingisCssVariablehelper thatcssTextalready uses. Other property names are unchanged.Test: a new
css variablescase inpackages/taro-runtime/tests/style.spec.ts. On main it fails withexpected '' to be 'red'(and thecssTextassertion alone fails withexpected '--main-color: blue; color: red;' to be 'color: red;'). With the fix it passes, andpnpm --filter @tarojs/runtime run testpasses (134 tests).这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit
--开头的属性,同时普通样式属性仍按原有方式处理。