File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
lib/resource-handler/html
test/unit/resource-handler Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ function prepareToLoad ($, resource) {
8181
8282function loadTextToCheerio ( text ) {
8383 return cheerio . load ( text , {
84- decodeEntities : false
84+ decodeEntities : false ,
85+ lowerCaseAttributeNames : false ,
8586 } ) ;
8687}
8788
Original file line number Diff line number Diff line change @@ -144,6 +144,26 @@ describe('ResourceHandler: Html', () => {
144144 } ) ;
145145 } ) ;
146146
147+ it ( 'should not update attribute names to lowercase' , ( ) => {
148+ htmlHandler = new HtmlHandler ( { sources : [ ] } , { downloadChildrenPaths} ) ;
149+ const html = `
150+ <html>
151+ <body>
152+ <svg width="50" height="50" viewBox="0 0 100 100">
153+ <ellipse cx="50" cy="50" rx="50" ry="50"></ellipse>
154+ </svg>
155+ </body>
156+ </html>
157+ ` ;
158+
159+ const resource = new Resource ( 'http://example.com' , 'index.html' ) ;
160+ resource . setText ( html ) ;
161+
162+ return htmlHandler . handle ( resource ) . then ( ( ) => {
163+ resource . getText ( ) . should . containEql ( 'viewBox="0 0 100 100"' ) ;
164+ } ) ;
165+ } ) ;
166+
147167 it ( 'should call downloadChildrenResources for each source' , ( ) => {
148168 const sources = [ { selector : 'img' , attr : 'src' } ] ;
149169 htmlHandler = new HtmlHandler ( { sources} , { downloadChildrenPaths} ) ;
You can’t perform that action at this time.
0 commit comments