Diff
diff --git a/cstyle/transformers/scrollbar/main.go b/cstyle/transformers/scrollbar/main.go
index 64ce3c4..cecf88f 100644
--- a/cstyle/transformers/scrollbar/main.go
+++ b/cstyle/transformers/scrollbar/main.go
@@ -12,3 +12,2 @@ func Init() cstyle.Transformer {
- Selector: func(n *element.Node, c *cstyle.CSS) bool {
- style := c.Styles[n.Properties.Id]
- if style["overflow"] != "" || style["overflow-x"] != "" || style["overflow-y"] != "" {
+ Selector: func(n *element.Node) bool {
+ if n.CStyle["overflow"] != "" || n.CStyle["overflow-x"] != "" || n.CStyle["overflow-y"] != "" {
@@ -21,4 +20,2 @@ func Init() cstyle.Transformer {
- style := c.Styles[n.Properties.Id]
-
- overflowProps := strings.Split(style["overflow"], " ")
- if n.Style("overflow-y") == "" {
+ overflowProps := strings.Split(n.CStyle["overflow"], " ")
+ if n.CStyle["overflow-y"] == "" {
@@ -29 +26 @@ func Init() cstyle.Transformer {
- n.Style("overflow-y", val)
+ n.CStyle["overflow-y"] = val
@@ -31,2 +28,2 @@ func Init() cstyle.Transformer {
- if style["overflow-x"] == "" {
- n.Style("overflow-x", overflowProps[0])
+ if n.CStyle["overflow-x"] == "" {
+ n.CStyle["overflow-x"] = overflowProps[0]
@@ -35,2 +32,2 @@ func Init() cstyle.Transformer {
- if style["position"] == "" {
- n.Style("position", "relative")
+ if n.CStyle["position"] == "" {
+ n.CStyle["position"] = "relative"
@@ -42 +39 @@ func Init() cstyle.Transformer {
- if n.Style("scrollbar-width") == "thin" {
+ if n.CStyle["scrollbar-width"] == "thin" {
@@ -47 +44 @@ func Init() cstyle.Transformer {
- if n.Style("scrollbar-width") == "none" {
+ if n.CStyle["scrollbar-width"] == "none" {
@@ -51,3 +48 @@ func Init() cstyle.Transformer {
- ps := c.PsuedoStyles[n.Properties.Id]
-
- splitStr := strings.Split(n.Style("scrollbar-color"), " ")
+ splitStr := strings.Split(n.CStyle["scrollbar-color"], " ")
@@ -72 +67 @@ func Init() cstyle.Transformer {
- if n.Style("overflow-x") == "scroll" || n.Style("overflow-x") == "auto" {
+ if n.CStyle["overflow-x"] == "scroll" || n.CStyle["overflow-x"] == "auto" {
@@ -75,7 +70,7 @@ func Init() cstyle.Transformer {
- scrollbar.Style("position", "absolute")
- scrollbar.Style("bottom", "0px")
- scrollbar.Style("left", "0")
- scrollbar.Style("width", "100%")
- scrollbar.Style("height", trackWidth)
- scrollbar.Style("background", backgroundColor)
- scrollbar.Style("z-index", "99999")
+ scrollbar.CStyle["position"] = "absolute"
+ scrollbar.CStyle["bottom"] = "0px"
+ scrollbar.CStyle["left"] = "0"
+ scrollbar.CStyle["width"] = "100%"
+ scrollbar.CStyle["height"] = trackWidth
+ scrollbar.CStyle["background"] = backgroundColor
+ scrollbar.CStyle["z-index"] = "99999"
@@ -85,13 +80,13 @@ func Init() cstyle.Transformer {
- thumb.Style("position", "absolute")
- thumb.Style("left", strconv.Itoa(n.ScrollLeft)+"px")
- thumb.Style("top", thumbMargin)
- thumb.Style("height", thumbWidth)
- thumb.Style("width", "20px")
- thumb.Style("background", thumbColor)
- thumb.Style("cursor", "pointer")
- thumb.Style("border-radius", "10px")
- thumb.Style("z-index", "99999")
-
- for k, v := range ps["::-webkit-scrollbar"] {
- scrollbar.Style(k, v)
- thumb.Style(k, v)
+ thumb.CStyle["position"] = "absolute"
+ thumb.CStyle["left"] = strconv.Itoa(n.ScrollLeft) + "px"
+ thumb.CStyle["top"] = thumbMargin
+ thumb.CStyle["height"] = thumbWidth
+ thumb.CStyle["width"] = "20px"
+ thumb.CStyle["background"] = thumbColor
+ thumb.CStyle["cursor"] = "pointer"
+ thumb.CStyle["border-radius"] = "10px"
+ thumb.CStyle["z-index"] = "99999"
+
+ for k, v := range n.PseudoElements["::-webkit-scrollbar"] {
+ scrollbar.CStyle[k] = v
+ thumb.CStyle[k] = v
@@ -100,2 +95,2 @@ func Init() cstyle.Transformer {
- for k, v := range ps["::-webkit-scrollbar-track"] {
- scrollbar.Style(k, v)
+ for k, v := range n.PseudoElements["::-webkit-scrollbar-track"] {
+ scrollbar.CStyle[k] = v
@@ -104,2 +99,2 @@ func Init() cstyle.Transformer {
- for k, v := range ps["::-webkit-scrollbar-thumb"] {
- thumb.Style(k, v)
+ for k, v := range n.PseudoElements["::-webkit-scrollbar-thumb"] {
+ thumb.CStyle[k] = v
@@ -116 +111 @@ func Init() cstyle.Transformer {
- if n.Style("overflow-y") == "scroll" || n.Style("overflow-y") == "auto" {
+ if n.CStyle["overflow-y"] == "scroll" || n.CStyle["overflow-y"] == "auto" {
@@ -119,7 +114,7 @@ func Init() cstyle.Transformer {
- scrollbar.Style("position", "absolute")
- scrollbar.Style("top", "0")
- scrollbar.Style("right", "0")
- scrollbar.Style("width", trackWidth)
- scrollbar.Style("height", "100%")
- scrollbar.Style("background", backgroundColor)
- scrollbar.Style("z-index", "99999")
+ scrollbar.CStyle["position"] = "absolute"
+ scrollbar.CStyle["top"] = "0"
+ scrollbar.CStyle["right"] = "0"
+ scrollbar.CStyle["width"] = trackWidth
+ scrollbar.CStyle["height"] = "100%"
+ scrollbar.CStyle["background"] = backgroundColor
+ scrollbar.CStyle["z-index"] = "99999"
@@ -129 +124 @@ func Init() cstyle.Transformer {
- scrollbar.Style("height", "calc(100% - "+trackWidth+")")
+ scrollbar.CStyle["height"] = "calc(100% - " + trackWidth + ")"
@@ -134,14 +129,14 @@ func Init() cstyle.Transformer {
- thumb.Style("position", "absolute")
- thumb.Style("top", strconv.Itoa(n.ScrollTop)+"px")
- thumb.Style("left", "0")
- thumb.Style("width", thumbWidth)
- thumb.Style("height", "20px")
- thumb.Style("background", thumbColor)
- thumb.Style("cursor", "pointer")
- thumb.Style("margin-left", thumbMargin)
- thumb.Style("border-radius", "10px")
- thumb.Style("z-index", "99999")
-
- for k, v := range ps["::-webkit-scrollbar"] {
- scrollbar.Style(k, v)
- thumb.Style(k, v)
+ thumb.CStyle["position"] = "absolute"
+ thumb.CStyle["top"] = strconv.Itoa(n.ScrollTop) + "px"
+ thumb.CStyle["left"] = "0"
+ thumb.CStyle["width"] = thumbWidth
+ thumb.CStyle["height"] = "20px"
+ thumb.CStyle["background"] = thumbColor
+ thumb.CStyle["cursor"] = "pointer"
+ thumb.CStyle["margin-left"] = thumbMargin
+ thumb.CStyle["border-radius"] = "10px"
+ thumb.CStyle["z-index"] = "99999"
+
+ for k, v := range n.PseudoElements["::-webkit-scrollbar"] {
+ scrollbar.CStyle[k] = v
+ thumb.CStyle[k] = v
@@ -150,2 +145,2 @@ func Init() cstyle.Transformer {
- for k, v := range ps["::-webkit-scrollbar-track"] {
- scrollbar.Style(k, v)
+ for k, v := range n.PseudoElements["::-webkit-scrollbar-track"] {
+ scrollbar.CStyle[k] = v
@@ -154,2 +149,2 @@ func Init() cstyle.Transformer {
- for k, v := range ps["::-webkit-scrollbar-thumb"] {
- thumb.Style(k, v)
+ for k, v := range n.PseudoElements["::-webkit-scrollbar-thumb"] {
+ thumb.CStyle[k] = v
@@ -160,3 +155,2 @@ func Init() cstyle.Transformer {
- // !DEVMAN,NOTE: This prevents recursion
- if !strings.Contains(style["width"], "calc") {
- n.Style("width", "calc("+style["width"]+"-"+trackWidth+")")
+ if strings.Contains(n.CStyle["width"], "calc") {
+ n.CStyle["width"] = "calc(" + n.CStyle["width"] + "-" + trackWidth + ")"
@@ -165 +159 @@ func Init() cstyle.Transformer {
- pr := style["padding-right"]
+ pr := n.CStyle["padding-right"]
@@ -167,10 +161,2 @@ func Init() cstyle.Transformer {
- if style["padding"] != "" {
- pr = style["padding"]
- }
- }
-
- if !strings.Contains(pr, "calc") {
- if pr != "" {
- n.Style("padding-right", "calc("+pr+"+"+trackWidth+")")
- } else {
- n.Style("padding-right", trackWidth)
+ if n.CStyle["padding"] != "" {
+ pr = n.CStyle["padding"]
@@ -179,0 +166,5 @@ func Init() cstyle.Transformer {
+ if pr != "" && !strings.Contains(pr, "calc") {
+ n.CStyle["padding-right"] = "calc(" + pr + "+" + trackWidth + ")"
+ } else {
+ n.CStyle["padding-right"] = trackWidth
+ }