File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -158,12 +158,15 @@ function getHref() {
158158
159159export function transformAttribute (
160160 doc : Document ,
161+ tagName : string ,
161162 name : string ,
162163 value : string ,
163164) : string {
164165 // relative path in attribute
165166 if ( name === 'src' || ( ( name === 'href' || name === 'xlink:href' ) && value ) ) {
166167 return absoluteToDoc ( doc , value ) ;
168+ } else if ( name === 'background' && value && ( tagName === 'table' || tagName == 'td' || tagName == 'th' ) ) {
169+ return absoluteToDoc ( doc , value ) ;
167170 } else if ( name === 'srcset' && value ) {
168171 return getAbsoluteSrcsetString ( doc , value ) ;
169172 } else if ( name === 'style' && value ) {
@@ -294,7 +297,7 @@ function serializeNode(
294297 const tagName = getValidTagName ( n as HTMLElement ) ;
295298 let attributes : attributes = { } ;
296299 for ( const { name, value } of Array . from ( ( n as HTMLElement ) . attributes ) ) {
297- attributes [ name ] = transformAttribute ( doc , name , value ) ;
300+ attributes [ name ] = transformAttribute ( doc , tagName , name , value ) ;
298301 }
299302 // remote css
300303 if ( tagName === 'link' && inlineStylesheet ) {
You can’t perform that action at this time.
0 commit comments