 #   data-pwnfx-move: an identifier connecting the move's target element
 #   data-pwnfx-move-target: set to the same value as data-pwnfx-move on the
 #       element that will receive the moved element as its last child
+#   data-pwnfx-move-method: 'append' adds the moved as the element as the
+#       target's last child, 'replace' clears the target element, then adds the
+#       moved element as the target's only child
 class PwnFxMove
   constructor: (element, identifier, scopeId) ->
     scope = PwnFx.resolveScope scopeId, element
+    method = element.getAttribute('data-pwnfx-move-method') || 'append'
     target = document.querySelector "[data-pwnfx-move-target=\"#{identifier}\"]"
-    target.appendChild element
+     
+    switch method
+      when 'append'
+        target.appendChild element
+      when 'replace'
+        target.innerHTML = ''
+        target.appendChild element
+      else
+        throw new Error("pwnfx-move-method #{method} not implemented")
+  
 
 PwnFx.registerEffect 'move', PwnFxMove
     

  # @param klass the class that wraps the effect's implementation
  registerEffect: (attrPrefix, klass) ->
    if @effectsByName[attrPrefix]
      throw new Error("Effect name {attrPrefix} already registered")
    @effects.push [attrPrefix, klass]
  
  # Finds a scoping container.

      element.addEventListener 'change', onChange, false
      onChange()
    else
      throw new Error("Unimplemented pwnfx-hide trigger #{trigger}")

PwnFx.registerEffect 'hide', PwnFxHide

