mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
swap-element-by-id
This commit is contained in:
parent
0f150a31a8
commit
1aa4d396c9
2 changed files with 26 additions and 9 deletions
|
|
@ -2229,8 +2229,24 @@ Returns CLOG-ELEMENT"))
|
||||||
(jquery-execute obj (format nil "replaceWith(~A)" (jquery new)))
|
(jquery-execute obj (format nil "replaceWith(~A)" (jquery new)))
|
||||||
obj)
|
obj)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; swap-element-by-id ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric swap-element-by-id (html-id clog-element)
|
||||||
|
(:documentation "Replace an existing element on page with HTML-ID with
|
||||||
|
CLOG-ELEMENT and set CLOG-ELEMENT to html-id. Returns CLOG-ELEMENT"))
|
||||||
|
|
||||||
|
(defmethod swap-element-by-id (html-id (new clog-element))
|
||||||
|
(let ((obj (attach-as-child new html-id :new-id t)))
|
||||||
|
(setf (property new "id") html-id)
|
||||||
|
(setf (slot-value new 'html-id) html-id)
|
||||||
|
(replace-element obj new)
|
||||||
|
(destroy obj)
|
||||||
|
new))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
;; parent-element ;;
|
;; Parent-element ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defgeneric parent-element (clog-element)
|
(defgeneric parent-element (clog-element)
|
||||||
|
|
|
||||||
|
|
@ -349,14 +349,15 @@ embedded in a native template application.)"
|
||||||
(vertical-align generic-function)
|
(vertical-align generic-function)
|
||||||
|
|
||||||
"CLOG-Element - Methods"
|
"CLOG-Element - Methods"
|
||||||
(add-class generic-function)
|
(add-class generic-function)
|
||||||
(remove-class generic-function)
|
(remove-class generic-function)
|
||||||
(toggle-class generic-function)
|
(toggle-class generic-function)
|
||||||
(remove-from-dom generic-function)
|
(remove-from-dom generic-function)
|
||||||
(remove-from-clog generic-function)
|
(remove-from-clog generic-function)
|
||||||
(destroy generic-function)
|
(destroy generic-function)
|
||||||
(click generic-function)
|
(click generic-function)
|
||||||
(replace-element generic-function)
|
(replace-element generic-function)
|
||||||
|
(swap-element-by-id generic-function)
|
||||||
|
|
||||||
"CLOG-Element - DOM Traversal Methods"
|
"CLOG-Element - DOM Traversal Methods"
|
||||||
(parent-element generic-function)
|
(parent-element generic-function)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue