Skip to content

Commit 09610ca

Browse files
Merge pull request #1546 from ASU/UDS-2010-A
UDS-2010: CLONE - Card and Image: hidden bleeding text contained in text boxes
2 parents 84d5b70 + f054b3d commit 09610ca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/unity-bootstrap-theme/src/js/card-bodies.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ import { EventHandler } from "./bootstrap-helper";
99
*/
1010
function initCardBodies() {
1111
const cardBodies = document.querySelectorAll(".card-body");
12+
13+
// If there are no cardBodies and you have not yet exceeded 3 retries
14+
let retryCount = 0;
15+
if (cardBodies.length === 0 && retryCount < 3) {
16+
setTimeout(() => initCardBodies(retryCount + 1), 500);
17+
return;
18+
}
19+
20+
// If after 3 attempts there are still no cardBodies, we simply exit
21+
if (cardBodies.length === 0) {
22+
console.warn("No .card-body found after 3 retries.");
23+
return;
24+
}
25+
1226
cardBodies.forEach((cardBody, index) => {
1327
const paragraph = cardBody.querySelector("div p");
1428
const originalText = paragraph.textContent;

0 commit comments

Comments
 (0)