Skip to content
Keith Sparkjoy edited this page Sep 28, 2016 · 10 revisions

Debugging

Cells within cells

Can formula cells have dynamic set of inputs?

Can the propagation graph structure be influenced by the contents of cells? Or is it fixed at the point when the 'lifted' functions returned by formula are invoked?

See more here: https://gist.github.com/ds300/e999180e504c81bae0f3

Known Issues and Workarounds

SVG documents have case sensitive attributes like 'viewBox'

jQuery lower-cases all attribute names, even SVG ones like viewBox. Since SVG attributes are case-sensitive, this causes problems. As a workaround, you can override the do! multimethod as shown below.

Background: HTML5 documents use case-insensitive attribute names, and some DOM implementations choose to lower-case attribute names. jQuery does this as well. However, any DOM implementation that lower-cases attribute names will NOT do this for elements in SVG documents, because they are case sensitive. Sadly, jQuery doesn't respect this, and continues to lower-case attribute names even on elements in SVG documents.

(defmethod do! :viewBox
	[elem _ value]
	(if (= false value)
		(.removeAttribute elem "viewBox")
		(.setAttribute elem "viewBox" value)))

loop-tpl cannot be a child of a custom component

loop-tpl is the way by which hoplon manages a dynamic list of children in a DOM node, adding and removing children from the node as the cell changes. If the parent is a custom element, which will not "exist" on the dom, it cannot be added to or removed from.

(defelem custom-element
  [_ children]
  (div children))

;; Below will not work
(custom-element
  (loop-tpl :bindings [item items]
    (div item)))

Instead, for the time being, you will have to wrap the loop-tpl in a containing div (or any other html element that can sensibly contain another element)

(custom-element
  (div
    (loop-tpl :bindings [item items]
      (div item))))

Tips & Other Brain Dumps

This may be obvious to some but, I just discovered that the :disabled attribute works for rel elements too. So you can use a cell to toggle css stylesheets, in the same fashion you can use :toggle to show/hide elements.