From cffbd566da5b97a2e2bd65e292cf9590bbaf071a Mon Sep 17 00:00:00 2001 From: David Botton Date: Mon, 25 Jul 2022 14:58:49 -0400 Subject: [PATCH] replace-element added --- source/clog-element.lisp | 11 +++++++++++ source/clog.lisp | 1 + 2 files changed, 12 insertions(+) diff --git a/source/clog-element.lisp b/source/clog-element.lisp index 6b8f27d..596dd0c 100644 --- a/source/clog-element.lisp +++ b/source/clog-element.lisp @@ -2215,6 +2215,17 @@ on browser.")) (defmethod click ((obj clog-element)) (jquery-execute obj "click()")) +;;;;;;;;;;;;;;;;;;;;; +;; replace-element ;; +;;;;;;;;;;;;;;;;;;;;; + +(defgeneric replace-element (clog-element new-clog-element) + (:documentation "CLOG-ELEMENT and its children will we removed from DOM +but not destroyed and NEW-CLOG-ELEMENT will replace it in same location. +DETROY CLOG-ELEMENT if need to clear from browser memory.")) + +(defmethod replace-element ((obj clog-element) (new clog-element)) + (jquery-execute obj (format nil "replaceWith(~A)" (jquery new)))) ;;;;;;;;;;;;;;;;;;;; ;; parent-element ;; diff --git a/source/clog.lisp b/source/clog.lisp index 3aebaf1..4f19f04 100644 --- a/source/clog.lisp +++ b/source/clog.lisp @@ -356,6 +356,7 @@ embedded in a native template application.)" (remove-from-clog generic-function) (destroy generic-function) (click generic-function) + (replace-element generic-function) "CLOG-Element - DOM Traversal Methods" (parent-element generic-function)