@@ -298,6 +298,30 @@ describe('decode_character_references', () => {
298298assert . equal ( value , input ) ;
299299} ) ;
300300
301+ it ( 'escape character in attribute 1' , ( ) => {
302+ // doesn't decode '&rect' which isn't html entity
303+ const input = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500&rect=type1);"></div>' ;
304+ const expect = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500&rect=type1);"></div>' ;
305+ const value = decode_character_references ( input ) ;
306+ assert . equal ( value , expect ) ;
307+ } ) ;
308+
309+ it ( 'escape character in attribute 2' , ( ) => {
310+ // '▭' decode to ▭ which is html entity
311+ const input = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500▭=type1);"></div>' ;
312+ const expect = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500▭=type1);"></div>' ;
313+ const value = decode_character_references ( input ) ;
314+ assert . equal ( value , expect ) ;
315+ } ) ;
316+
317+ it ( 'escape character in attribute 3' , ( ) => {
318+ // '&' decode to & which is html entity
319+ const input = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500&=type1);"></div>' ;
320+ const expect = '<div style="background-image: url(https://url.com/path?lib=test&height=902&width=1500&=type1);"></div>' ;
321+ const value = decode_character_references ( input ) ;
322+ assert . equal ( value , expect ) ;
323+ } ) ;
324+
301325it ( 'validate code 1' , ( ) => {
302326// line feed becomes generic whitespace
303327const input = ' ' ;
0 commit comments