Update html-rewriter.md

This commit is contained in:
Jarred Sumner
2025-01-13 02:15:17 -08:00
parent c2e150f916
commit 6709028803

View File

@@ -26,7 +26,7 @@ const rewriter = new HTMLRewriter().on("img", {
},
});
// Example usage
// An example HTML document
const html = `
<html>
<body>
@@ -87,8 +87,6 @@ rewriter.transform(Bun.file("index.html"));
Note that Cloudflare Workers implementation of HTMLRewriter only supports `Response` objects.
## Features
### Element Handlers
The `on(selector, handlers)` method allows you to register handlers for HTML elements that match a CSS selector. The handlers are called for each matching element during parsing: