Most pricing comparisons on the web are static HTML tables that go stale the moment a vendor tweaks renewal fees or currency rates. While building SoftOpinie.pl, an independent Polish SaaS and hosting comparison site, I wanted readers to calculate real multi-year ownership costs instead of getting tricked by 1 PLN introductory banners.

I built two lightweight, zero-dependency vanilla JavaScript calculators inside standard WordPress Gutenberg HTML blocks and still kept 100/100/100/100 on Desktop and 99/100/100/100 on Mobile in Google PageSpeed Insights (0 ms TBT, 0 CLS). Along the way, I ran into an annoying WordPress parser bug that silently breaks inline scripts.

Here is the architecture and the exact trap to avoid if you embed vanilla JS tools in WordPress.

The two live tools

  1. 3-Year Polish Hosting TCO Calculator: compares 36-month total cost (year 1 promo plus two full renewals, 23% Polish VAT toggle, .pl domain renewal slider from 0 to 10 domains, and paid SSL add-on options) across Seohost, LH.pl, and Cyber_Folks.
  2. 2026 Email Marketing Cost Calculator: compares monthly and annual costs across GetResponse, Brevo, and MailerLite using a subscriber tier slider (250 to 50,000 contacts), sending frequency buttons, and official NBP EUR/PLN conversion rates.

Both live alongside our open Markdown dataset on GitHub: softopinie/awesome-polish-saas.

Why zero dependencies beat React or iframe widgets here

A pricing calculator has maybe 5 state variables and 15 DOM nodes to update on input or click. Shipping a 150 KB JS bundle or embedding an external iframe just to multiply two numbers destroys LCP and introduces layout shifts.

Instead, each calculator is a self-contained HTML + scoped <style> + IIFE <script> block (~25 KB total before Brotli compression). Everything initializes immediately on DOMContentLoaded, writes only .textContent and .classList, and generates zero network requests after the initial HTML document loads.

The WordPress bug that broke my first live deploy: && inside <script>

Everything worked fine locally. Five minutes after publishing the email calculator to WordPress, clicking the buttons did nothing and DevTools threw Uncaught SyntaxError: Unexpected token '&'.

The culprit was WordPress's wptexturize / the_content filter running over inline <script> tags inside a Gutenberg HTML block and rewriting logical && operators into HTML entities:

// What I wrote: if (totalEmails <= 10000 && contacts <= 1500) { return 14; } // What WordPress served in the live DOM: if (totalEmails <= 10000 &#038;&#038; contacts <= 1500) { return 14; } 

Instead of hacking functions.php to disable global texturization (which can break theme updates or plugin formatting elsewhere), I chose the safest defensive fix: eliminate && completely from inline WordPress <script> blocks using clean nested if blocks:

if (totalEmails <= 10000) { if (contacts <= 1500) { return 14; } } 

Zero server-side hooks needed, zero risk of an update reverting functions.php, and the script survives every WordPress filter untouched.

Accessibility details that bumped Lighthouse from 92 to 100

Two quick fixes pushed our live Accessibility score from 92 straight to 100 on both mobile and desktop:

  • Proper ARIA tab roles on filter bars: wrapping buttons in role="tablist" fails audit checks unless every button carries role="tab" and updates aria-selected="true" | "false" on click.
  • Dark-mode contrast ratios: muted #64748B labels on #0A0F1E backgrounds look sleek to developers but fail WCAG AA (4.17:1). Lifting muted metadata and slider tick labels to #94A3B8 / #CBD5E1 cleared every contrast check immediately without hurting the dark editorial palette.
  • Mobile range slider ticks (<480px): eight horizontal tick labels collide on 390px screens. Hiding alternate tick labels in a single @media (max-width: 480px) rule kept the slider readable with ~29px spacing between visible ticks.

Results after deployment

After purging LiteSpeed Cache and running Google PageSpeed Insights on softopinie.pl:

  • Desktop: 100 Performance, 100 Accessibility, 100 Best Practices, 100 SEO (LCP 0.4s, CLS 0, TBT 0ms)
  • Mobile: 99 Performance, 100 Accessibility, 100 Best Practices, 100 SEO (LCP 1.1s, CLS 0, TBT 0ms)
  • Console errors across all interactive pages: 0

If you embed custom interactive calculators inside WordPress without spinning up a headless frontend, watch out for && entity encoding and test your mobile slider ticks at 390px before calling it shipped.