fix: css url() support # prefix url #949
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景:
antd 组件里有用到,针对 svg 的样式中有
fill: url(#gradientXXX)
的用法,目的是取 svg 的一部分作为 fill 的内容。我们之前的实现忽略了#
的处理,会去做 resolve,然后报错。分析:
尝试彻底解这个问题,对 js 和 css 的场景做了下分析。
1、css 下通过
@import '#a'
用在属性值里用url(#a)
都会原样保留下来。2、js 里用了
#a
会报错。所以要只针对 css 处理
#
,而 js 保留现状。