diff --git a/src/transformers/removeInlineSizes.js b/src/transformers/removeInlineSizes.js index 2fc377a6..5f497f54 100644 --- a/src/transformers/removeInlineSizes.js +++ b/src/transformers/removeInlineSizes.js @@ -19,12 +19,11 @@ module.exports = async (html, config = {}, direct = false) => { const removeInlineSizes = (mappings = {}) => tree => { const process = node => { const attrs = parseAttrs(node.attrs) - const tag = node.tag ? node.tag.toUpperCase() : '' Object.entries(mappings).forEach(([attribute, tags]) => { - tags = Object.values(tags) + tags = Object.values(tags).map(tag => tag.toLowerCase()) - if (!tags.includes(tag)) { + if (!tags.includes(node.tag)) { return node } diff --git a/test/test-transformers.js b/test/test-transformers.js index 05f11edf..4e846b01 100644 --- a/test/test-transformers.js +++ b/test/test-transformers.js @@ -13,13 +13,24 @@ const expected = file => readFile('expected/transformers', file) test('remove inline sizes', async t => { const options = { - width: ['TD'], - height: ['TD'] + width: ['table'], + height: ['td'] } - const html = await Maizzle.removeInlineSizes('test', options) + const html = await Maizzle.removeInlineSizes(` + + + + +
test
`, + options) - t.is(html, 'test') + t.is(html, ` + + + + +
test
`) }) test('remove inline background-color', async t => {