Melin's Blog

Latest posts

See all posts
  • Why `keyCode` Is No Longer Recommended: Understanding `event.key` and `event.code`
    By Zhang Xinxu. Adapted from the original article at zhangxinxu.com. Keyboard events look simple until you try to handle real-world input. For years, many JavaScript examples us...
  • Cleverly Using DOM APIs to Escape and Unescape HTML Characters
    Escaping and unescaping HTML is one of those tasks that looks simple until you start thinking about every character, browser behavior, and execution environment. Most developers...
  • Three Ways to Import External CSS in Web Components
    Shadow DOM gives Web Components one of their most useful superpowers: style isolation. A component can define its own markup and CSS without leaking styles into the page or bein...
  • How Can JavaScript Detect Whether the User Has Zoomed the Page?
    Page zoom sounds simple until you try to detect it reliably. On desktop, users usually zoom with Ctrl + , Ctrl - , or the browser menu. On mobile, users pinch to zoom. Those two...
  • A Practical Guide to Converting HTML Strings into DOM Nodes
    Converting an HTML string into real DOM nodes sounds simple, but the browser gives us several APIs with different tradeoffs. Some are fast, some are safer, some require a valid...
© 2026 • Melin
Press Esc or click anywhere to close