Diff
diff --git a/transformers/scrollbar/main.go b/transformers/scrollbar/main.go
index 818384c..66bddc8 100644
--- a/transformers/scrollbar/main.go
+++ b/transformers/scrollbar/main.go
@@ -12 +12 @@ func Init() grim.Transformer {
- style := n.Styles()
+ style := n.ComputedStyle
@@ -20 +20 @@ func Init() grim.Transformer {
- style := n.Styles()
+ style := n.ComputedStyle
@@ -23 +23 @@ func Init() grim.Transformer {
- if n.GetStyle("overflow-y") == "" {
+ if n.ComputedStyle["overflow-y"] == "" {
@@ -28 +28 @@ func Init() grim.Transformer {
- n.SetStyle("overflow-y", val)
+ n.ComputedStyle["overflow-y"] = val
@@ -31 +31 @@ func Init() grim.Transformer {
- n.SetStyle("overflow-x", overflowProps[0])
+ n.ComputedStyle["overflow-x"] = overflowProps[0]
@@ -35 +35 @@ func Init() grim.Transformer {
- n.SetStyle("position", "relative")
+ n.ComputedStyle["position"] = "relative"
@@ -41 +41 @@ func Init() grim.Transformer {
- if n.GetStyle("scrollbar-width") == "thin" {
+ if n.ComputedStyle["scrollbar-width"] == "thin" {
@@ -46 +46 @@ func Init() grim.Transformer {
- if n.GetStyle("scrollbar-width") == "none" {
+ if n.ComputedStyle["scrollbar-width"] == "none" {
@@ -52 +52 @@ func Init() grim.Transformer {
- splitStr := strings.Split(n.GetStyle("scrollbar-color"), " ")
+ splitStr := strings.Split(n.ComputedStyle["scrollbar-color"], " ")
@@ -69 +69 @@ func Init() grim.Transformer {
- if n.GetStyle("overflow-x") == "scroll" || n.GetStyle("overflow-x") == "auto" {
+ if n.ComputedStyle["overflow-x"] == "scroll" || n.ComputedStyle["overflow-x"] == "auto" {
@@ -71 +70,0 @@ func Init() grim.Transformer {
- n.AppendChild(&scrollbar)
@@ -83,11 +82,9 @@ func Init() grim.Transformer {
- scrollbar.AppendChild(&thumb)
-
- thumb.SetStyle("position", "absolute")
- thumb.SetStyle("left", strconv.Itoa(left) + "px")
- thumb.SetStyle("top", thumbMargin)
- thumb.SetStyle("height", thumbWidth)
- thumb.SetStyle("width", "20px")
- thumb.SetStyle("background-color", thumbColor)
- thumb.SetStyle("cursor", "pointer")
- thumb.SetStyle("border-radius", "10px")
- thumb.SetStyle("z-index", "99999")
+ thumb.ComputedStyle["position"] = "absolute"
+ thumb.ComputedStyle["left"] = strconv.Itoa(left) + "px"
+ thumb.ComputedStyle["top"] = thumbMargin
+ thumb.ComputedStyle["height"] = thumbWidth
+ thumb.ComputedStyle["width"] = "20px"
+ thumb.ComputedStyle["background-color"] = thumbColor
+ thumb.ComputedStyle["cursor"] = "pointer"
+ thumb.ComputedStyle["border-radius"] = "10px"
+ thumb.ComputedStyle["z-index"] = "99999"
@@ -96,2 +93,2 @@ func Init() grim.Transformer {
- scrollbar.SetStyle(k, v)
- thumb.SetStyle(k, v)
+ scrollbar.ComputedStyle[k] = v
+ thumb.ComputedStyle[k] = v
@@ -101 +98 @@ func Init() grim.Transformer {
- scrollbar.SetStyle(k, v)
+ scrollbar.ComputedStyle[k] = v
@@ -105 +102 @@ func Init() grim.Transformer {
- thumb.SetStyle(k, v)
+ thumb.ComputedStyle[k] = v
@@ -106,0 +104,4 @@ func Init() grim.Transformer {
+
+ scrollbar.Properties.Id = grim.GenerateUniqueId(n, scrollbar.TagName())
+ scrollbar.AppendChild(&thumb)
+ n.AppendChild(&scrollbar)
@@ -111 +112 @@ func Init() grim.Transformer {
- if n.GetStyle("overflow-y") == "scroll" || n.GetStyle("overflow-y") == "auto" {
+ if n.ComputedStyle["overflow-y"] == "scroll" || n.ComputedStyle["overflow-y"] == "auto" {
@@ -113 +113,0 @@ func Init() grim.Transformer {
- n.AppendChild(&scrollbar)
@@ -125 +124,0 @@ func Init() grim.Transformer {
- scrollbar.AppendChild(&thumb)
@@ -127,2 +126,2 @@ func Init() grim.Transformer {
- thumb.SetStyle("position", "absolute")
- thumb.SetStyle("top", strconv.Itoa(top) + "px")
+ thumb.ComputedStyle["position"] = "absolute"
+ thumb.ComputedStyle["top"] = strconv.Itoa(top) + "px"
@@ -130,8 +129,8 @@ func Init() grim.Transformer {
- thumb.SetStyle("right", "3px")
- thumb.SetStyle("width", thumbWidth)
- thumb.SetStyle("height", "20px")
- thumb.SetStyle("background-color", thumbColor)
- thumb.SetStyle("cursor", "pointer")
- thumb.SetStyle("margin-left", thumbMargin)
- thumb.SetStyle("border-radius", "10px")
- thumb.SetStyle("z-index", "99999")
+ thumb.ComputedStyle["right"] = "3px"
+ thumb.ComputedStyle["width"] = thumbWidth
+ thumb.ComputedStyle["height"] = "20px"
+ thumb.ComputedStyle["background-color"] = thumbColor
+ thumb.ComputedStyle["cursor"] = "pointer"
+ thumb.ComputedStyle["margin-left"] = thumbMargin
+ thumb.ComputedStyle["border-radius"] = "10px"
+ thumb.ComputedStyle["z-index"] = "99999"
@@ -140,2 +139,2 @@ func Init() grim.Transformer {
- scrollbar.SetStyle(k, v)
- thumb.SetStyle(k, v)
+ scrollbar.ComputedStyle[k] = v
+ thumb.ComputedStyle[k] = v
@@ -145 +144 @@ func Init() grim.Transformer {
- scrollbar.SetStyle(k, v)
+ scrollbar.ComputedStyle[k] = v
@@ -149 +148 @@ func Init() grim.Transformer {
- thumb.SetStyle(k, v)
+ thumb.ComputedStyle[k] = v
@@ -151,0 +151,5 @@ func Init() grim.Transformer {
+ // !NOTE: This need to be here because at this point scrollbar hasn't been added to the parent
+ // + ,so it doesn't have a prid to build off of
+ scrollbar.Properties.Id = grim.GenerateUniqueId(n, scrollbar.TagName())
+ scrollbar.AppendChild(&thumb)
+
@@ -154 +158 @@ func Init() grim.Transformer {
- n.SetStyle("width", "calc(" + style["width"] + "-" + trackWidth + ")")
+ n.ComputedStyle["width"] = "calc(" + style["width"] + "-" + trackWidth + ")"
@@ -157,4 +161,4 @@ func Init() grim.Transformer {
- pr := n.GetStyle("padding-right")
- // !ISSUE: calc() should not be used
- if pr == "" && n.GetStyle("padding") != "" {
- n.SetStyle("padding-right", "calc(" + n.InitalStyles["padding"] + " + " + trackWidth + ")")
+ pr := n.ComputedStyle["padding-right"]
+ // !ISSUE: remove appendchild
+ if pr == "" && n.ComputedStyle["padding"] != "" {
+ n.ComputedStyle["padding-right"] = "calc(" + n.InitalStyles["padding"] + " + " + trackWidth + ")"
@@ -162 +166 @@ func Init() grim.Transformer {
- n.SetStyle("padding-right", "calc(" + n.InitalStyles["padding-right"] + " + " + trackWidth + ")")
+ n.ComputedStyle["padding-right"] = "calc(" + n.InitalStyles["padding-right"] + " + " + trackWidth + ")"
@@ -164 +168 @@ func Init() grim.Transformer {
- n.SetStyle("padding-right", trackWidth)
+ n.ComputedStyle["padding-right"] = trackWidth
@@ -165,0 +170 @@ func Init() grim.Transformer {
+ n.AppendChild(&scrollbar)