mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
* lisp/dom.el (dom-previous-sibling): New function.
This commit is contained in:
parent
4a5190ff48
commit
f113707a07
10
lisp/dom.el
10
lisp/dom.el
@ -149,6 +149,16 @@ ATTRIBUTE would typically be `class', `id' or the like."
|
||||
(setq result (dom-parent elem node))))
|
||||
result)))
|
||||
|
||||
(defun dom-previous-sibling (dom node)
|
||||
(when-let (parent (dom-parent dom node))
|
||||
(let ((siblings (dom-children parent))
|
||||
(previous nil))
|
||||
(while siblings
|
||||
(when (eq (cadr siblings) node)
|
||||
(setq previous (car siblings)))
|
||||
(pop siblings))
|
||||
previous)))
|
||||
|
||||
(defun dom-node (tag &optional attributes &rest children)
|
||||
"Return a DOM node with TAG and ATTRIBUTES."
|
||||
(if children
|
||||
|
Loading…
Reference in New Issue
Block a user