Skip to content

quality-debt: assets/js/template-previewer.js — PR #1245 review feedback (medium) #1249

@superdav42

Description

@superdav42

Unactioned Review Feedback

Source PR: #1245
File: assets/js/template-previewer.js
Reviewers: coderabbit
Findings: 1
Max severity: medium


MEDIUM: coderabbit (coderabbitai[bot])

File: assets/js/template-previewer.js:78
Verification: kept as unverifiable (no stable snippet extracted)
⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add iframe document fallback to avoid silently skipping the iOS patch.

At Line 78, using only contentDocument can still miss the iframe body in some cases. Use contentWindow?.document as fallback (and reuse the existing iframe reference from Line 61).

Suggested patch
-				const iframeEl = document.getElementById("iframe");
-				const body = iframeEl && iframeEl.contentDocument ? iframeEl.contentDocument.body : null;
+				const iframe_doc = (iframe == null ? void 0 : iframe.contentDocument) || (iframe == null ? void 0 : iframe.contentWindow == null ? void 0 : iframe.contentWindow.document);
+				const body = iframe_doc ? iframe_doc.body : null;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@assets/js/template-previewer.js` around lines 77 - 78, The iframe body lookup
currently only uses iframeEl.contentDocument and can miss the document on some
platforms (e.g. iOS); update the lookup to fallback to
iframeEl.contentWindow?.document and then grab .body from that document, reusing
the existing iframe reference (the previously created iframe variable) instead
of re-querying the DOM; ensure the logic sets body = (iframeEl.contentDocument
|| iframeEl.contentWindow?.document)?.body so the iOS patch runs reliably.

View comment



Auto-generated by quality-feedback-helper.sh scan-merged. Review each finding and either fix the code or dismiss with a reason.


aidevops.sh v3.17.25 automated scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    origin:workerAuto-created by pulse labelless backfill (t2112)priority:mediumMedium severity — moderate quality issuequality-debtUnactioned review feedback from merged PRssource:review-feedbackAuto-created by quality-feedback-helper.shstatus:availableTask is available for claiming

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions