@@ -318,9 +318,6 @@ function getHeartCol(row) {
318
318
td = tds [ 1 ] ;
319
319
}
320
320
if ( td !== null ) {
321
- if ( td . children . length ) {
322
- return td . children [ 0 ] ;
323
- }
324
321
return td ;
325
322
}
326
323
@@ -397,11 +394,10 @@ function toggle(id, show, mobile)
397
394
} ) ;
398
395
}
399
396
400
- function addHeart ( rank , row , id , isFav , mobile )
397
+ function getHeartTd ( rank , row , id , isFav , mobile )
401
398
{
402
- var heartCol = getHeartCol ( row ) ;
403
399
var iconClass = isFav ? "fas fa-heart" : "far fa-heart" ;
404
- return heartCol . innerHTML + " <span class=\"heart " + iconClass + "\" onclick=\"toggle(" + id + "," + ( isFav ? "false" : "true" ) + "," + mobile + ")\"></span>" ;
400
+ return "<td class=\"scoreaf heart\"> <span class=\"heart " + iconClass + "\" onclick=\"toggle(" + id + "," + ( isFav ? "false" : "true" ) + "," + mobile + ")\"></span></td >" ;
405
401
}
406
402
407
403
function initFavouriteTeams ( )
@@ -432,7 +428,9 @@ function initFavouriteTeams()
432
428
for ( var i = 0 ; i < favTeams . length ; i ++ ) {
433
429
if ( teamname === favTeams [ i ] ) {
434
430
found = true ;
435
- heartCol . innerHTML = addHeart ( rank , scoreboard [ j ] , teamIndex , found , mobile ) ;
431
+ let heartTd = getHeartTd ( rank , scoreboard [ j ] , teamIndex , found , mobile ) ;
432
+ // Insert td after heartCol
433
+ heartCol . insertAdjacentHTML ( 'afterend' , heartTd ) ;
436
434
toAdd [ cntFound ] = scoreboard [ j ] . cloneNode ( true ) ;
437
435
if ( mobile ) {
438
436
toAddMobile [ cntFound ] = scoreboard [ j + 1 ] . cloneNode ( true ) ;
@@ -455,7 +453,8 @@ function initFavouriteTeams()
455
453
}
456
454
}
457
455
if ( ! found ) {
458
- heartCol . innerHTML = addHeart ( rank , scoreboard [ j ] , teamIndex , found , mobile ) ;
456
+ let heartTd = getHeartTd ( rank , scoreboard [ j ] , teamIndex , found , mobile ) ;
457
+ heartCol . insertAdjacentHTML ( 'afterend' , heartTd ) ;
459
458
}
460
459
if ( rank !== "" ) {
461
460
lastRank = rank ;
0 commit comments