Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,8 @@ on: [push, pull_request]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCS_PATH: ${{ secrets.DOCS_PATH }}
DOCS_BRANCH: ${{ secrets.DOCS_BRANCH }}

jobs:
can_document:
runs-on: ubuntu-latest
outputs:
value: ${{ steps.check_job.outputs.value }}
steps:
- name: Checks whether documentation can be built
id: check_job
run: |
echo "value: ${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"
echo "value=${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}" >> "$GITHUB_OUTPUT"

documentation:
needs: [can_document]
runs-on: ubuntu-latest
if: needs.can_document.outputs.value == 'true'

steps:
- uses: actions/checkout@v5

- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version: "20.x"
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: |
cd $DOCS_PATH
npm install

- name: Deploy Doclet
run: |
cd $DOCS_PATH
npx pilet publish --fresh --url https://feed.piral.cloud/api/v1/pilet/anglesharp --api-key ${{ secrets.PIRAL_FEED_KEY }}

linux:
runs-on: ubuntu-latest

Expand Down
13 changes: 12 additions & 1 deletion AGENTS.md

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# 0.3.0

Released on Tuesday, November 24 2026.

- Fixed Home, End and the arrow keys doing nothing in text fields; they move the cursor (with Shift selecting text), which typing, Backspace and Delete edit at, like in browsers
- Fixed a page loaded with a fragment (e.g. `acid2.html#top`) not being scrolled to the element it names
- Fixed the rendering of the Acid2 test
- Fixed the media queries of an iframe's document not seeing its viewport, also right after a script resized the iframe
- Fixed `(max-monochrome: 0)` and the like not matching
- Fixed a navigated image (e.g. a PNG in an iframe) being parsed as HTML; like in browsers it is shown in a document of its own
- Fixed a navigated XML document that isn't well-formed failing to load (e.g. in an iframe, without a `load` event); like in browsers it shows the error as a `parsererror` element
- Fixed clicking a `select` or `textarea` inside a `label` crashing the browser (endless recursion)
- Fixed the events of the user (e.g. clicks and keys) not being trusted (`isTrusted`)
- Fixed images showing the first candidate of their `srcset` (e.g. pixelated, scaled up); they show the one fitting their `sizes`, the device pixel ratio and the media of a `picture`'s sources, are as large as their density says (e.g. `2x`), and are only loaded once shown (or right away when not in the page, e.g. `new Image()`); `loading=lazy` images load once scrolled near
- Improved the design of Vision's start page, which shows the six most visited pages and HTML5test as a demo
- Updated the default user agent to name the engine (e.g. `Mozilla/5.0 (X11; Linux x86_64) AngleSharp.Browser/0.3`)
- Updated colors to be serialized as CSSOM says, e.g. `getComputedStyle` gives `rgb(0, 128, 0)` instead of `rgba(0, 128, 0, 1)` (`CssColorValue.UseSpecSerialization`, set process-wide)
- Added `:visited` to links to pages shown before (partitioned by the site of the page, so pages can't learn of the history elsewhere)
- Added dragging sliders (`input[type=range]`) and changing them with the keyboard
- Added buttons with `popovertarget` showing, hiding or toggling their popover, and light dismiss of popovers (a press outside or Esc)
- Added paint worklets (`CSS.paintWorklet.addModule()` with `registerPaint`), whose `paint()` images backgrounds show
- Added the Fullscreen API: `requestFullscreen()` (after a press or a key), `document.exitFullscreen()`, `fullscreenElement` and `fullscreenEnabled`, with `fullscreenchange` events and Esc ending it; the engine raises `FullscreenChanged`, and Vision shows the page fullscreen meanwhile
- Added WebAssembly as in browsers (AngleSharp.Wasm with AngleSharp.Js): `WebAssembly.instantiate`/`instantiateStreaming` with import objects of scripts, exports scripts call, and `memory.buffer` sharing the memory; before, `WebAssembly` was undefined
- Added `crypto.subtle` (AngleSharp.Js)

# 0.2.0

Released on Wednesday, November 18 2026.
Expand Down
15 changes: 15 additions & 0 deletions docs/general/02-Engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,23 @@ The underlying `IBrowsingContext` is available via `Context`, e.g., to retrieve
| `HoverChanged` | The hovered link or the cursor changed. |
| `ScrollChanged` | The scroll position changed. |
| `WindowRequested` | The page asks for a new window. See [Configuration](05-Configuration.md#multiple-windows). |
| `FullscreenChanged` | The page started or ended showing an element fullscreen. See [Fullscreen](#fullscreen). |
| `Error` | An operation failed, e.g., a navigation or a script. |

## Fullscreen

A page shows an element fullscreen with `requestFullscreen()`, which needs a user activation (a press or a key), like in browsers. The element then covers the viewport (it matches `:fullscreen`), and the engine raises `FullscreenChanged` with `IsFullscreen` being `true`. A host should show the page fullscreen meanwhile, e.g. with a fullscreen window and without its toolbars:

```cs
engine.FullscreenChanged += (_, _) =>
{
// raised on the engine's thread
Dispatcher.UIThread.Post(() => window.WindowState = engine.IsFullscreen ? WindowState.FullScreen : WindowState.Normal);
};
```

Esc ends it, as does the page (`document.exitFullscreen()`) or leaving the document. When the user leaves the fullscreen mode of the host another way, call `ExitFullscreenAsync` to end it for the page as well.

## Diagnostics

`Diagnostics` collects what happens while showing the current page, like the developer tools of a browser. It starts over with every page and is thread-safe:
Expand Down
9 changes: 8 additions & 1 deletion docs/general/04-Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ Console.WriteLine(await engine.CopySelectionAsync());
Keys are named by their DOM key value, e.g., `"a"`, `"Enter"`, `"Backspace"`, `"Tab"`, or `"ArrowDown"`. Keys and text are separate on purpose, just like in most UI frameworks:

- `KeyDownAsync` and `KeyUpAsync` fire the keyboard events and perform the actions of keys, e.g., Tab moving the focus, or Enter submitting a form.
- `TextInputAsync` enters text into the focused text field. It works for whole strings, too.
- `TextInputAsync` enters text into the focused text field at its cursor, replacing the selected text. It works for whole strings, too.

In a text field (`input` or `textarea`) the keys edit like in browsers. The cursor is the field's `selectionStart` and `selectionEnd`, so scripts see it and can place it:

- The left and right keys move the cursor, by words with Ctrl (or Alt). Home and End go to the start and end of the line, with Ctrl of the whole text. In a `textarea` the up and down keys go to the line above and below.
- Shift extends the selection, Ctrl+A (or Cmd+A) selects all of the text.
- Backspace and Delete remove the selected text, or the character (with Ctrl the word) before or after the cursor.
- Focusing a field by clicking it puts the cursor at the end of its text; tabbing into an `input` selects its text.

```cs
await engine.ClickAsync(100, 200);
Expand Down
2 changes: 1 addition & 1 deletion docs/general/05-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Everything that touches the outside world is configured via `BrowserOptions`, wh
| Option | Default | Description |
| --- | --- | --- |
| `ProfileDirectory` | `null` | Where cookies, web storage and the HTTP cache are persisted; `null` keeps everything in memory. |
| `UserAgent` | `null` | The user agent to report; `null` uses the default of AngleSharp.Io. |
| `UserAgent` | `null` | The user agent to report; `null` uses `BrowserOptions.DefaultUserAgent`, e.g. `Mozilla/5.0 (X11; Linux x86_64) AngleSharp.Browser/0.3`. It names the engine rather than claiming to be Chrome: bot protections (e.g. Cloudflare's) refuse a browser claiming to be Chrome that doesn't behave like it in every detail. |
| `DefaultHeaders` | empty | Headers added to every request, unless a request sets them already. |
| `ColorScheme` | `null` | The answer to `prefers-color-scheme`, e.g., `light` or `dark`. |
| `IsScriptingEnabled` | `true` | If JavaScript should be evaluated. |
Expand Down
4 changes: 3 additions & 1 deletion docs/tutorials/01-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following APIs cover most day-to-day tasks:
| `HoveredLink`, `Cursor` | What is below the pointer. |
| `ColorScheme` | The answer to `prefers-color-scheme`; may be changed. |
| `HasPaintedDocument` | If the current document has been painted at least once. |
| `IsFullscreen` | If the page shows an element fullscreen. See [Fullscreen](../general/02-Engine.md#fullscreen). |
| `Diagnostics` | The `BrowserDiagnostics` of the current page. |

### Methods
Expand All @@ -60,6 +61,7 @@ The following APIs cover most day-to-day tasks:
| `MovePointer`, `MovePointerAsync`, `PointerDownAsync`, `PointerUpAsync`, `ClickAsync` | Pointer input. |
| `KeyDownAsync`, `KeyUpAsync`, `TextInputAsync` | Keyboard input. |
| `CopySelectionAsync()` | Gets the selected text for the clipboard. |
| `ExitFullscreenAsync()` | Ends showing an element fullscreen. |
| `ScrollAsync(deltaX, deltaY)`, `ScrollToAsync(top, animate)` | Scrolling. |
| `CreateWindow()`, `CreateWindow(options)` | Creates an engine sharing the profile. |
| `LoadIconAsync()`, `GetCertificate(host)` | Loads the page's icon, or gets the certificate of a host. |
Expand All @@ -68,7 +70,7 @@ All asynchronous methods take an optional `CancellationToken`.

### Events

`Invalidated`, `StateChanged`, `HoverChanged`, `ScrollChanged`, `WindowRequested`, and `Error`. See [Browser Engine](../general/02-Engine.md#events).
`Invalidated`, `StateChanged`, `HoverChanged`, `ScrollChanged`, `WindowRequested`, `FullscreenChanged`, and `Error`. See [Browser Engine](../general/02-Engine.md#events).

## BrowserFrame

Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/03-Custom-Host.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ What else makes it feel like a browser:
- Update `ColorScheme` when the theme changes.
- Draw a scrollbar from `ScrollPosition`, `ScrollHeight` and `ViewportHeight`, and change the position using `ScrollToAsync`.
- Handle `WindowRequested`, and open a window with an engine from `CreateWindow`.
- Handle `FullscreenChanged` to show the page fullscreen while `IsFullscreen`, and call `ExitFullscreenAsync` when the user leaves the fullscreen mode of the host.
7 changes: 4 additions & 3 deletions src/AngleSharp.Browser.Avalonia.Tests/VisionAddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public async Task AnUnknownVisionPageListsThePagesThereAre()
Assert.That(links, Is.EqualTo(VisionPages.Available.Select(m => m.Address).ToArray()));

await engine.InvokeAsync(d => ((IHtmlElement)d!.QuerySelector("#pages a[href='vision:about']")!).DoClick());
await WaitUntil(engine, d => d?.Url == "vision:about" && d.GetElementById("version")!.TextContent.StartsWith("Version"));
await WaitUntil(engine, d => d?.Url == "vision:about" && d.GetElementById("version")?.TextContent.StartsWith("Version") == true);

await engine.NavigateAsync("vision:pages");
Assert.That(await engine.InvokeAsync(d => d!.GetElementById("notice")), Is.Null);
Expand Down Expand Up @@ -223,10 +223,11 @@ public async Task TheStartPageShowsTheMostVisitedPagesDemosAndVisionPages()
d.QuerySelectorAll("#pages a").Select(m => m.GetAttribute("href")).ToArray(),
d.QuerySelector("#most-visited .name")!.TextContent));
// the pages of Vision have their own section
Assert.That(visited, Is.EqualTo(new[] { "https://example.org/7", "https://example.org/6", "https://example.org/5", "https://example.org/4", "https://example.org/3" }));
Assert.That(visited, Is.EqualTo(new[] { "https://example.org/7", "https://example.org/6", "https://example.org/5", "https://example.org/4", "https://example.org/3", "https://example.org/2" }));
Assert.That(heading, Is.EqualTo("Seven"));
Assert.That(demos, Has.Length.EqualTo(5));
Assert.That(demos, Has.Length.EqualTo(6));
Assert.That(demos, Does.Contain("https://news.ycombinator.com"));
Assert.That(demos, Does.Contain("https://html5test.com"));
Assert.That(vision, Is.EqualTo(new[] { "vision:requester", "vision:settings", "vision:about" }));
Assert.That(BrowserSettings.DefaultStartPage, Is.EqualTo("vision:start"));
pages.Dispose();
Expand Down
2 changes: 2 additions & 0 deletions src/AngleSharp.Browser.Avalonia.Tests/VisionPanelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public async Task TheAboutPageShowsTheVisionLogo()
{
using var page = new AboutPage("light", () => { });
await page.LoadAsync();
// the frame showing it loads it
await page.Engine.PrepareFrameAsync();
await WaitUntil(page, d => d!.QuerySelector<IHtmlImageElement>(".logo img") is { IsCompleted: true });

var logo = await page.Engine.InvokeAsync(d => d!.QuerySelector<IHtmlImageElement>(".logo img")!);
Expand Down
28 changes: 0 additions & 28 deletions src/AngleSharp.Browser.Docs/docs.config.json

This file was deleted.

58 changes: 0 additions & 58 deletions src/AngleSharp.Browser.Docs/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions src/AngleSharp.Browser.Docs/src/index.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions src/AngleSharp.Browser.Docs/tsconfig.json

This file was deleted.

Loading
Loading