summaryrefslogtreecommitdiff
path: root/lisp/dom.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-04-30 06:05:17 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-04-30 06:05:26 +0200
commit6c1b12e7d2ff38e313eae97bfd01746ecacdb02f (patch)
tree9df52d6f67c91d5107b6d2af3af8df952264733b /lisp/dom.el
parent0a982c077e7393d865622ff780906a0cb252348d (diff)
downloademacs-6c1b12e7d2ff38e313eae97bfd01746ecacdb02f.tar.gz
Add new function dom-remove-attribute
* doc/lispref/text.texi (Document Object Model): Document it. * lisp/dom.el (dom-remove-attribute): Add new function.
Diffstat (limited to 'lisp/dom.el')
-rw-r--r--lisp/dom.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/dom.el b/lisp/dom.el
index 34df0e9af4c..7ff9e07b729 100644
--- a/lisp/dom.el
+++ b/lisp/dom.el
@@ -67,6 +67,12 @@
(setcdr old value)
(setcar (cdr node) (nconc (cadr node) (list (cons attribute value)))))))
+(defun dom-remove-attribute (node attribute)
+ "Remove ATTRIBUTE from NODE."
+ (setq node (dom-ensure-node node))
+ (when-let ((old (assoc attribute (cadr node))))
+ (setcar (cdr node) (delq old (cadr node)))))
+
(defmacro dom-attr (node attr)
"Return the attribute ATTR from NODE.
A typical attribute is `href'."