[Seaside] Moving an element in the DOM

Ryan Simmons ryan.craig.simmons at gmail.com
Tue Nov 4 20:35:54 UTC 2008


I tried to move an element above its sibling using something like

html anchor
 onClick: (html evaluator
     callback: [:s |
          self moveElement.
          s element id: 'moveElement'; previous; insertBefore:
(SUElement new id: 'moveElement')]);
 with: 'move up'.

This results in the text "$('moveElement')" being inserted into the
correct position in the DOM.
I managed to get it to work the way I expected it to by changing the
following on SUElement

insert: anObject position: aString
       "Inserts anObject before, after, at the top of, or at the
bottom of element."

       self call: 'insert' argument: (Dictionary new
               at: aString put: ((anObject isKindOf: SUElement)
                                                          ifTrue: [anObject]

ifFalse:[self render: anObject]);
               yourself)

Is this the correct way to fix this or should I have gone about this
another way?

Ryan Simmons


More information about the seaside mailing list