diff options
author | bptato <nincsnevem662@gmail.com> | 2024-05-05 23:06:36 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-05-05 23:06:36 +0200 |
commit | 95566264c474935d6e010adfcb4a7f8daf1ad812 (patch) | |
tree | 7b83ff4dad7e420cd360f23039544d2f5f10e7d5 /src/css | |
parent | a62a7077c32c456228f0e48151688151f75deac6 (diff) | |
download | chawan-95566264c474935d6e010adfcb4a7f8daf1ad812.tar.gz |
cascade: avoid empty ::before/::after
If `content' is empty, then generating before/after pseudo-elements is wrong.
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/cascade.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim index 19cf1dd1..c69b821f 100644 --- a/src/css/cascade.nim +++ b/src/css/cascade.nim @@ -360,9 +360,8 @@ proc applyRulesFrameInvalid(frame: CascadeFrame; ua, user: CSSStylesheet; of peBefore, peAfter: let declmap = frame.parentDeclMap let styledPseudo = pseudo.applyDeclarations(styledParent, declmap) - if styledPseudo != nil: - let contents = styledPseudo.computed{"content"} - for content in contents: + if styledPseudo != nil and styledPseudo.computed{"content"}.len > 0: + for content in styledPseudo.computed{"content"}: styledPseudo.children.add(styledPseudo.newStyledReplacement(content)) styledParent.children.add(styledPseudo) of peInputText: |