size‑container Demo - Online Intrinsic & Styled Queries
Explore the size‑container and inline‑size CSS properties for container queries. Understand containment contexts. Visual guide.
UD5 Toolkit
Online XSS Prevention Sandbox & Security Playground
// Your Trusted Types implementation code will appear here... // Select a payload and policy level, then click "Generate" or type in the editor
Trusted Types is a browser security API designed to eliminate DOM-based Cross-Site Scripting (XSS) attacks. It enforces that only trusted, sanitized data can be assigned to dangerous DOM sinks like innerHTML, outerHTML, document.write, and eval.
Instead of accepting arbitrary strings, these sinks require special typed objects — TrustedHTML, TrustedScript, or TrustedScriptURL — that can only be created through explicitly defined policies. This makes it impossible for attacker-controlled strings to reach execution contexts.
Trusted Types prevents XSS by enforcing a type-based security boundary:
For example, element.innerHTML = untrustedString will throw a TypeError when Trusted Types are enforced, forcing developers to use policy.createHTML(sanitizedString) instead.
As of 2024-2025, Trusted Types is supported in:
You can use feature detection: if (window.trustedTypes) { /* supported */ }. For unsupported browsers, consider using a polyfill or fallback sanitization library like DOMPurify.
Add one of these directives to your Content-Security-Policy HTTP header:
The require-trusted-types-for 'script' directive enables enforcement. The optional trusted-types directive restricts which policy names are allowed, adding an extra layer of security.
innerHTML, outerHTML, insertAdjacentHTML, etc. Created via policy.createHTML().eval(), Function(), setTimeout() with string arguments, etc. Created via policy.createScript().<script src>, import(), Web Workers, etc. Created via policy.createScriptURL().Each type corresponds to a specific injection sink category, ensuring precise control over what data reaches each dangerous API.
Yes, but it requires coordination. Many popular libraries have already adopted Trusted Types compatibility:
For libraries that don't support Trusted Types, you can create a default policy as a fallback, but this should be used sparingly as it can weaken security.
No. Trusted Types is a defense-in-depth mechanism, not a replacement for proper input validation and output encoding. It acts as a safety net at the DOM level:
All three layers should be used together for comprehensive XSS protection.
document.write, eval, setTimeout with strings, srcdoc on iframes, etc.report-uri or report-to alongside enforcement to catch violations without breaking usersStart with Report-Only mode to identify violations before enforcing Trusted Types in production.
Explore the size‑container and inline‑size CSS properties for container queries. Understand containment contexts. Visual guide.
Demonstrate how to add custom headers and POST‑like functionality to EventSource using a polyfill. Code and example.
Make an element resizable horizontally, vertically, or both. See the handle and code. Useful for textareas.
Drag to resize a box and see the Resize Observer callback fire. Get contentRect and borderBoxSize. Learn the API.
Select your wall type and furniture style to see the best anchoring method. Prevent tip‑over accidents.
Compare width/height with block‑size/inline‑size in different writing modes. Understand intrinsic sizing. Copy best practices.
Select any element on the test page and monitor its size changes with ResizeObserver. See log of all entries.
Estimate your one‑rep max (1RM) from weight and reps. Supports multiple formulas (Epley, Brzycki). Training percentages table.
Request HID devices and list them. Read input reports and send output. For custom hardware and controllers.
See how scroll‑padding and scroll‑margin affect the position of elements when using anchor links or scroll‑snap. Visual.
Apply will‑change to any element and see its effect on compositing. Learn best practices for smooth animations.
Select bird species and toy type to see potential hazards and size recommendations.
Paste a raster image and an SVG, see the file size and rendering time. Understand when to use vector. Local.
Generate a Lit Element web component skeleton with styles and properties. Copy and start coding immediately.
Calculate the entropy (in bits) of a password based on character pool size and length. Visual strength meter with crack time estimation. Local only.
Toggle print‑specific styles like removing backgrounds, showing link URLs, and adding page breaks. Generate a complete print stylesheet instantly.
Calculate the appropriate hide box dimensions based on your reptile’s length and girth. A snug hide reduces stress and promotes natural behavior.
Type a few words and see them rendered at every heading size (h1–h6) with your chosen font. Perfect for design systems.
Calculate your one-rep max using Epley, Brzycki, Lombardi or O'Conner formulas. Predict maximum lifting capacity and plan progressive overload. 100% local processing.
Enter megapixels and desired DPI to see the maximum print size without upscaling. Quick quality check.
Add print styles like removing backgrounds, adding page breaks, setting margins. See print preview instantly.
Add appliances with running and starting watts to estimate needed generator capacity. Prevent overload.
Estimate your one‑rep max from weight and reps. Supports Epley, Brzycki, Lombardi formulas. See your strength level.
Plot weekly weight gain against recommended ranges based on pre-pregnancy BMI. IOM guidelines displayed. Data stored in localStorage.
Enter current ball size and target to find approx rubber bands required. Fun and satisfying.
Enter head circumference to get crown diameter and length. Perfect fit top‑down hats.
Knit a swatch, measure before and after felting, and let this tool calculate the shrink percentage. Plan your felted projects accurately.
Enter two tire sizes and see a side‑by‑side comparison of diameter, width, and speedometer error. Local math.
Estimate body fat percentage using neck, waist, hip (if female) measurements. Supports US Navy, Covert Bailey, and 3-site skinfold methods. No data sent to server.
Enter item dimensions and find the smallest rectangular box that can fit them (simple packing heuristic). Helps reduce shipping costs. Local algorithm.