Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add negative length validation for non negative css value #938

Merged
merged 6 commits into from
Dec 2, 2021

Conversation

temper357
Copy link
Contributor

@temper357 temper357 commented Dec 1, 2021

Closes #936

修复因未检验 padding 负值而产生报错。

Close #931

fix:

  • 给所有非负值的 length 和 percentage 类型值加上校验。
  • 修复判断 isLength 的正则表达式,原先的正则有 bug,会导致 100xxxvw 这种值也命中判断为 length 类型。

yuanyan
yuanyan previously approved these changes Dec 1, 2021
wssgcg1213
wssgcg1213 previously approved these changes Dec 1, 2021
@temper357 temper357 dismissed stale reviews from wssgcg1213 and yuanyan via aec0a2b December 1, 2021 08:38
@@ -282,8 +290,8 @@ class CSSStyleDeclaration {
case MAX_WIDTH:
case MAX_HEIGHT:
if (normalizedValue != NONE &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

margin 为负值也可能会有问题

#931 (comment)

@temper357
Copy link
Contributor Author

margin 允许负值,对于 #931 (comment) 只需要删除 margin 非负值的 assert

@yuanyan yuanyan merged commit 6ed502e into main Dec 2, 2021
@yuanyan yuanyan deleted the fix/negative-length-invalidation branch December 2, 2021 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants