diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-19 14:40:26 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-19 14:43:01 +0100 |
| commit | ad119c9a299458b4beca9fe8da85f74a33a8d91b (patch) | |
| tree | 207bcec7e1a43db4754e97898146e0ff491390c7 /src/css | |
| parent | 30e3ff6d8d77adc05db79ace1ed54beb609eb84d (diff) | |
| download | chawan-ad119c9a299458b4beca9fe8da85f74a33a8d91b.tar.gz | |
dom: CSSStyleDeclaration improvements
Now getComputedStyle works with pseudo-elements too.
Diffstat (limited to 'src/css')
| -rw-r--r-- | src/css/cascade.nim | 2 | ||||
| -rw-r--r-- | src/css/cssparser.nim | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim index b461e4cb..0b4369df 100644 --- a/src/css/cascade.nim +++ b/src/css/cascade.nim @@ -384,7 +384,7 @@ proc applyDeclarations(styledNode: StyledNode; parent: Element; element.computedMap[peNone] = map[peNone].applyDeclarations0(parent, element, window) for pseudo in peBefore..peAfter: - if map[pseudo].hasValues(): + if map[pseudo].hasValues() or window.settings.scripting == smApp: let computed = map[pseudo].applyDeclarations0(element, nil, window) element.computedMap[pseudo] = computed diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim index 94067d24..29ef455c 100644 --- a/src/css/cssparser.nim +++ b/src/css/cssparser.nim @@ -100,8 +100,10 @@ proc `$`*(c: CSSComponentValue): string = result &= c.cvalue else: result &= "<UNICODE>" - of cttDimension, cttNumber, cttINumber, cttIDimension: + of cttDimension, cttNumber: result &= $c.nvalue & c.unit + of cttINumber, cttIDimension: + result &= $int32(c.nvalue) & c.unit of cttPercentage: result &= $c.nvalue & "%" of cttColon: @@ -122,7 +124,7 @@ proc `$`*(c: CSSComponentValue): string = result &= $s if decl.important: result &= " !important" - result &= ";\n" + result &= ";" elif c of CSSFunction: result &= $CSSFunction(c).name & "(" for s in CSSFunction(c).value: |