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() {
158
158
159
159
export function transformAttribute (
160
160
doc : Document ,
161
+ tagName : string ,
161
162
name : string ,
162
163
value : string ,
163
164
) : string {
164
165
// relative path in attribute
165
166
if ( name === 'src' || ( ( name === 'href' || name === 'xlink:href' ) && value ) ) {
166
167
return absoluteToDoc ( doc , value ) ;
168
+ } else if ( name === 'background' && value && ( tagName === 'table' || tagName == 'td' || tagName == 'th' ) ) {
169
+ return absoluteToDoc ( doc , value ) ;
167
170
} else if ( name === 'srcset' && value ) {
168
171
return getAbsoluteSrcsetString ( doc , value ) ;
169
172
} else if ( name === 'style' && value ) {
@@ -294,7 +297,7 @@ function serializeNode(
294
297
const tagName = getValidTagName ( n as HTMLElement ) ;
295
298
let attributes : attributes = { } ;
296
299
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 ) ;
298
301
}
299
302
// remote css
300
303
if ( tagName === 'link' && inlineStylesheet ) {
You can’t perform that action at this time.
0 commit comments