diff --git a/lib/resource-handler/html/index.js b/lib/resource-handler/html/index.js index ac91d3fc..a7c1b4a7 100644 --- a/lib/resource-handler/html/index.js +++ b/lib/resource-handler/html/index.js @@ -81,7 +81,8 @@ function prepareToLoad ($, resource) { function loadTextToCheerio (text) { return cheerio.load(text, { - decodeEntities: false + decodeEntities: false, + lowerCaseAttributeNames: false, }); } diff --git a/test/unit/resource-handler/html.test.js b/test/unit/resource-handler/html.test.js index e56a35f1..ea60c38d 100644 --- a/test/unit/resource-handler/html.test.js +++ b/test/unit/resource-handler/html.test.js @@ -144,6 +144,26 @@ describe('ResourceHandler: Html', () => { }); }); + it('should not update attribute names to lowercase', () => { + htmlHandler = new HtmlHandler({ sources: [] }, {downloadChildrenPaths}); + const html = ` + + + + + + + + `; + + const resource = new Resource('http://example.com', 'index.html'); + resource.setText(html); + + return htmlHandler.handle(resource).then(() => { + resource.getText().should.containEql('viewBox="0 0 100 100"'); + }); + }); + it('should call downloadChildrenResources for each source', () => { const sources = [{ selector: 'img', attr: 'src' }]; htmlHandler = new HtmlHandler({sources}, {downloadChildrenPaths});