diff options
author | bptato <nincsnevem662@gmail.com> | 2023-10-25 14:04:39 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-10-25 14:04:39 +0200 |
commit | 10bdd58bbe9f3736bbb3f73d2c500740724b696f (patch) | |
tree | 56aa0eb0ce5703b8c3adb12bb0e40892b738f154 /src/css | |
parent | aa47707bec6caa024ae1ce8e17461409a3456964 (diff) | |
download | chawan-10bdd58bbe9f3736bbb3f73d2c500740724b696f.tar.gz |
dom: add some CSSStyleDeclaration functions
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/cssparser.nim | 7 | ||||
-rw-r--r-- | src/css/values.nim | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim index ef167fb2..ea337ab1 100644 --- a/src/css/cssparser.nim +++ b/src/css/cssparser.nim @@ -116,10 +116,13 @@ proc `$`*(c: CSSParsedItem): string = else: result &= $c.tokenType & '\n' elif c of CSSDeclaration: - result &= CSSDeclaration(c).name + let decl = CSSDeclaration(c) + result &= decl.name result &= ": " - for s in CSSDeclaration(c).value: + for s in decl.value: result &= $s + if decl.important: + result &= " !important" result &= ";\n" elif c of CSSFunction: result &= CSSFunction(c).name & "(" diff --git a/src/css/values.nim b/src/css/values.nim index 6fae4737..91911c09 100644 --- a/src/css/values.nim +++ b/src/css/values.nim @@ -354,6 +354,9 @@ func propertyType(s: string): CSSPropertyType = func valueType(prop: CSSPropertyType): CSSValueType = return ValueTypes[prop] +func isSupportedProperty*(s: string): bool = + return s in PropertyNames + func `$`*(length: CSSLength): string = if length.auto: return "auto" |