* doc/lispref/text.texi (Document Object Model): Document it.
* lisp/dom.el (dom-search): New function.
Return all nodes in @var{dom} that have IDs that match @var{match},
which is a regular expression.
+@item dom-search @var{dom} @var{predicate}
+Return all nodes in @var{dom} where @var{predicate} returns a
+non-@code{nil} value. @var{predicate} is called with the node to be
+tested as its parameter.
+
@item dom-strings @var{dom}
Return all strings in @var{dom}.
used to remove comments before calling the libxml functions to parse
the data.
++++
+** A new DOM (the XML/HTML document structure returned by functions
+such as 'libxml-parse-html-region') traversal function has been added:
+'dom-search', which takes a DOM and a predicate and returns all nodes
+that match.
+
+++
** The Network Security Manager now allows more fine-grained control
of what checks to run via the 'network-security-protocol-checks'
(cons dom matches)
matches)))
+(defun dom-search (dom predicate)
+ "Return elements in DOM where PREDICATE is non-nil.
+PREDICATE is called with the node as its only parameter."
+ (let ((matches (cl-loop for child in (dom-children dom)
+ for matches = (and (not (stringp child))
+ (dom-search child predicate))
+ when matches
+ append matches)))
+ (if (funcall predicate dom)
+ (cons dom matches)
+ matches)))
+
(defun dom-strings (dom)
"Return elements in DOM that are strings."
(cl-loop for child in (dom-children dom)