diff options
Diffstat (limited to 'src/hypnotisml.lisp')
-rw-r--r-- | src/hypnotisml.lisp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp index b209fc9..b5d8823 100644 --- a/src/hypnotisml.lisp +++ b/src/hypnotisml.lisp @@ -61,6 +61,7 @@ (format stream "~{~a=~s~^ ~}" (attribs-list ob))) (def:class dom-node () + (parent :type (or null elem)) :documentation "Root class for all dom-nodes") (defun dom-node-p (x) (typep x 'dom-node)) @@ -88,6 +89,12 @@ (children :type node-list) :documentation "The base class for all UI elements.") +(defmethod initialize-instance :around ((elem elem) &key) + (call-next-method) + (loop :for child :in (children elem) + :do (setf (parent child) elem)) + elem) + (defun elem-query-selector (elem) "Returns a CSS query selector string for the ELEM. ELEMs can be uniquely quried in the dom by passing string to .querySelector()" |