You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(printing): prevent DOM sanitizer from stripping style tags in thermal receipt templates #185
The DOM sanitizer in PrinterService.ts strips <style> elements from receipt HTML templates, breaking custom layout and CSS styling in thermal receipts.
Root Cause
In frontend/src/lib/printer/PrinterService.ts, line 243 executes: parsed.querySelectorAll('script, style, link, meta, base, iframe, object, embed, form').forEach((node) => node.remove());
Including style in the selector query removes valid inline CSS <style> blocks contained in thermal receipt templates.
Why It Matters
Custom receipt thermal formatting (font sizes, table column alignment, border rules) gets stripped before rendering, causing receipts to lose formatting when printed.
Expected Behavior
Executable scripts and dangerous remote resources are stripped, but embedded <style> elements needed for receipt formatting are preserved.
Actual Behavior
<style> elements are purged alongside <script> tags.
Affected Files
frontend/src/lib/printer/PrinterService.ts
Suggested Implementation Direction
Remove style from the querySelectorAll selector array while retaining script, iframe, and form element purging.
Fixed in a0b41f1: removed 'style' from the sanitizer's querySelectorAll removal list in PrinterService.ts — script/iframe/form/etc. stripping is unchanged, but <style> blocks needed for receipt formatting are now preserved.
Activity
fix: stop notification truncation, fix thermal print race, guard logi…
itsbkm commentedon Jul 29, 2026
Fixed in a0b41f1: removed 'style' from the sanitizer's querySelectorAll removal list in PrinterService.ts — script/iframe/form/etc. stripping is unchanged, but <style> blocks needed for receipt formatting are now preserved.