I figured out how to do this. [yglukhov's 
jsbind](https://github.com/yglukhov/jsbind) worked like a charm to help with 
this. Thanks for the awesome library!

Here is a simple to get & set the height of a <div> in Nim.
    
    
    import dom
    import jsbind
    
    type CSSStyleDeclaration* = ref object of JSObj
    
    proc cssText*(cssSD: CSSStyleDeclaration): cstring {.jsimportProp.}
    proc length*(cssSD: CSSStyleDeclaration): int {.jsimportProp.}
    
    proc getComputedStyle*(w: Window; element: Element; pseudoElt: 
Element=nil): CSSStyleDeclaration {.jsimport.}
    proc getPropertyValue*(cssSD: CSSStyleDeclaration; property: cstring): 
cstring {.jsimport.}
    
    # Main Program
    proc main() =
      var
        content = querySelector("#content")
        cStyle = window.getComputedStyle(content)
      
      content.innerHTML = cStyle.getPropertyValue("height")   # e.g. will say 
something like "51.2px"
      content.style.height = "800px"
    

Reply via email to