From b6b9d465cb81f5d35fb5c5432461ce7170759725 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Fri, 16 Jan 2015 03:08:55 +0100 Subject: [PATCH] * lisp/dom.el (dom-strings): New function. --- doc/lispref/text.texi | 3 +++ lisp/ChangeLog | 2 ++ lisp/dom.el | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 472aedb8ee4..1b8897f59e7 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -4507,6 +4507,9 @@ which is a regular expression. Return all nodes in @var{dom} that have IDs that match @var{match}, which is a regular expression. +@item dom-strings @var{dom} +Return all strings in @var{DOM}. + @end table Utility functions: diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ef0e6a2749..6aa0c129638 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2015-01-16 Lars Magne Ingebrigtsen + * dom.el (dom-strings): New function. + * files.el (directory-files-recursively): Don't use the word "path" for a file name. diff --git a/lisp/dom.el b/lisp/dom.el index 527b8e61f2e..11357e88804 100644 --- a/lisp/dom.el +++ b/lisp/dom.el @@ -103,6 +103,14 @@ A name is a symbol like `td'." (cons dom matches) matches))) +(defun dom-strings (dom) + "Return elements in DOM that are strings." + (cl-loop for child in (dom-children dom) + if (stringp child) + collect child + else + append (dom-strings child))) + (defun dom-by-class (dom match) "Return elements in DOM that have a class name that matches regexp MATCH." (dom-elements dom 'class match)) -- 2.39.2