From 2c042368a59fc1162f867b09c1b7a4b39676e4e2 Mon Sep 17 00:00:00 2001 From: orenom Date: Thu, 7 Oct 2021 15:44:44 +0200 Subject: [PATCH] check that removeAttribute is a function (fixes #19) --- src/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 004b09f..6cdf6ee 100644 --- a/src/utils.js +++ b/src/utils.js @@ -140,7 +140,9 @@ module.exports = function(redis) { let elements_with_event_attr = data.html.querySelectorAll(event_attributes.join(',')) for(let i = 0; i < elements_with_event_attr.length; i++) { for(let j = 0; j < event_attributes.length; j++) { - elements_with_event_attr.removeAttribute(event_attributes[j]) + if(typeof(elements_with_event_attr.removeAttribute) === 'function') { + elements_with_event_attr.removeAttribute(event_attributes[j]) + } } }