Skip to content

Commit

Permalink
🐛 fix: fix placeholder parsing without css rules
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 22, 2021
1 parent 523b7d7 commit 505a390
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parser/inputText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export const parseInputTextToText = (
if (!value) {
// 从样式表中拿到相应的 css 规则
Array.from(document.styleSheets).forEach(({ cssRules }) => {
// 修正部分情况下(TODO:确认具体是什么情况)
// 没有cssRules 的解析报错
if (!cssRules) return;

Array.from(cssRules).forEach((rule) => {
const { selectorText, style } = rule as CSSStyleRule;
// 针对每条规则进行一次判断
Expand Down

0 comments on commit 505a390

Please sign in to comment.