Skip to content

kaiserrrrrr/cherry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🍒 Cherry

A native, zero-config optimization engine for the modern web.

Cherry.js is a library designed to bridge the gap between semantic design and technical performance. It identifies common accessibility gaps, SEO omissions, and performance bottlenecks (like Cumulative Layout Shift) and patches them at runtime during browser idle periods.


🌟 Why Cherry?

cherry builds upon the on-the-fly philosophy, ensuring that sites remain optimized without any trade-off:

  • Zero Technical Debt: Patches legacy HTML for WCAG and SEO compliance without changing a line of source code.
  • Idle-Time Execution: Utilizes requestIdleCallback to perform DOM surgery only when the browser is idle, protecting your Total Blocking Time (TBT).

🚀 Installation

CDN (recommended):

  1. Simply add this in your <head> tag:

    <script src="https://cdn.jsdelivr.net/gh/kaiserrrrrr/cherry/src/cherry.min.js" defer></script>

Manually:

  1. Download the file:

    wget "https://cdn.jsdelivr.net/gh/kaiserrrrrr/cherry/src/cherry.min.js"

    OR download directly: cherry

  2. Link it from HTML:

    <script src="cherry.min.js" defer></script>

❓ How it works

sequenceDiagram
    autonumber
    participant B as Browser
    participant C as Cherry.js
    participant D as DOM (Web Page)

    Note over B, D: Script Initialization
    
    B->>C: Load script
    activate C
    alt if readyState is 'complete'
        C->>C: init()
    else wait for 'load' event
        B-->>C: window.onload
        C->>C: init()
    end
    deactivate C

    Note over C, D: Performance
    activate C
    C->>D: Set loading="lazy" (img/iframe)
    C->>D: Set width/height from naturalWidth
    C->>B: Force {passive: true} on listeners
    C->>D: Append font preconnect links
    deactivate C

    Note over C, D: Accessibility
    activate C
    C->>D: Remove body[aria-hidden]
    C->>D: Fix input Labels & unique IDs
    C->>D: Ensure alt="" and aria-labels exist
    C->>D: Set min-size (44px) for tap targets
    deactivate C

    Note over C, D: Best Practices
    activate C
    C->>D: Add [rel="noopener"] to _blank links
    C->>D: Reset tabindex > 0 to 0
    C->>B: Stop paste event propagation
    C->>D: Remove <meta http-equiv="refresh">
    deactivate C

    Note over C, D: SEO
    activate C
    C->>D: Set html[lang] & charset="UTF-8"
    C->>D: Generate Description & Robots meta
    C->>D: Enforce viewport max-scale=5
    C->>D: Inject hidden H1 & fix list nesting
    deactivate C

    Note over B, D: Page Optimization Complete
Loading

🌐 Browsers supported

Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Samsung
Samsung
Opera
Opera
Edge Last 68 versions Last 65 versions Last 6 versions Last 6 versions Last 16 versions Last 60 versions

📜 License

© Cherry 2026. Code released under the GNU General Public License v3.0.

Releases

No releases published

Packages

 
 
 

Contributors