diff --git a/index.js b/index.js index 8cc27f6..a0a1114 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,6 @@ module.exports = async (html, options) => { }); /* head */ - $('*').removeAttr('style'); /* main amp library */ @@ -171,6 +170,11 @@ module.exports = async (html, options) => { } }); + /* img layout */ + $('img').each((_, element) => { + $(element).attr({ layout: 'responsive' }); + }); + /* inline styles */ let inlineCss = ''; diff --git a/test/images.test.js b/test/images.test.js index 8a46c93..00c23b6 100644 --- a/test/images.test.js +++ b/test/images.test.js @@ -5,7 +5,7 @@ describe('amp-img tag', () => { test('should replace img tag with amp-img', () => { assert( '', - '', + '', {}, ); }); @@ -13,7 +13,7 @@ describe('amp-img tag', () => { test('should add width and height attributes on amp-img tag', () => { assert( '', - '', + '', { cwd: __dirname.split(path.sep).pop() }, ); }); @@ -29,7 +29,7 @@ describe('amp-img tag', () => { test('should respect width and height', () => { assert( '', - '', + '', { cwd: __dirname.split(path.sep).pop() }, ); }); @@ -37,7 +37,7 @@ describe('amp-img tag', () => { test('should not change element order or remove next element', () => { assert( '

1

2

', - '

1

2

', + '

1

2

', { cwd: __dirname.split(path.sep).pop() }, ); });