From: Lars Ingebrigtsen <larsi@gnus.org>
* lisp/dom.el (dom-texts): Don't return contents of <script> as
text, because it isn't and makes reasoning about textual parts
more difficult.
(defun dom-texts (node &optional separator)
"Return all textual data under NODE concatenated with SEPARATOR in-between."
- (mapconcat
- 'identity
- (mapcar
- (lambda (elem)
- (if (stringp elem)
- elem
- (dom-texts elem separator)))
- (dom-children node))
- (or separator " ")))
+ (if (eq (dom-tag node) 'script)
+ ""
+ (mapconcat
+ 'identity
+ (mapcar
+ (lambda (elem)
+ (cond
+ ((stringp elem)
+ elem)
+ ((eq (dom-tag elem) 'script)
+ "")
+ (t
+ (dom-texts elem separator))))
+ (dom-children node))
+ (or separator " "))))
(defun dom-child-by-tag (dom tag)
"Return the first child of DOM that is of type TAG."