Only highlight text in HTML elements #10

This commit is contained in:
Sören Weber 2020-09-13 15:07:51 +02:00
parent 2ab6982425
commit b52a263979
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -423,7 +423,7 @@ $(function() {
jQuery.extend({
highlight: function(node, re, nodeName, className) {
if (node.nodeType === 3) {
if (node.nodeType === 3 && node.parentElement.namespaceURI == 'http://www.w3.org/1999/xhtml') { // text nodes
var match = node.data.match(re);
if (match) {
var highlight = document.createElement(nodeName || 'span');