From 3e8510e110bbd07c2c59a5b04033ef9634205883 Mon Sep 17 00:00:00 2001 From: menglb Date: Wed, 11 Sep 2019 15:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIE=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96HTML=E5=88=B0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/configs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configs.js b/src/configs.js index 0379f3a..2892f51 100644 --- a/src/configs.js +++ b/src/configs.js @@ -492,7 +492,7 @@ const htmlToEntity = (options, source) => (nodeName, node, createEntity) => { node.attributes && Object.keys(node.attributes).forEach((key) => { let attr = node.attributes[key] - ignoredEntityNodeAttributes.indexOf(attr.name) === -1 && (nodeAttributes[attr.name] = attr.value); + !!attr && ignoredEntityNodeAttributes.indexOf(attr.name) === -1 && (nodeAttributes[attr.name] = attr.value); }) if (nodeName === 'a' && !node.querySelectorAll('img').length) { @@ -550,7 +550,7 @@ const htmlToBlock = (options, source) => (nodeName, node) => { node.attributes && Object.keys(node.attributes).forEach((key) => { let attr = node.attributes[key] - ignoredNodeAttributes.indexOf(attr.name) === -1 && (nodeAttributes[attr.name] = attr.value); + !!attr && ignoredNodeAttributes.indexOf(attr.name) === -1 && (nodeAttributes[attr.name] = attr.value); }) if (node.classList && node.classList.contains('media-wrap')) {