Skip to content

Release 1.0.0#157

Open
FlorianRappl wants to merge 97 commits intomainfrom
devel
Open

Release 1.0.0#157
FlorianRappl wants to merge 97 commits intomainfrom
devel

Conversation

@FlorianRappl
Copy link
Copy Markdown
Contributor

@FlorianRappl FlorianRappl commented Jan 18, 2024

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

This is the 1.0.0 release of AngleSharp.Css - effectively being compatible with AngleSharp v1 and bringing the CSSOM to a good state.

Current status:

  • Enhancements for the API (easier to make an analysis / change an analysis)
  • Improvements for the CSSOM (dedicated <percentage>, <number> and <integer> types)
  • Tests and enhancements for the render tree model / render tree API
  • Documentation with some examples

Potentially we'll also include some perf. enhancements, but most likely this is done in a subsequent release. Current goal is to ship this with a stable basis.

jafin and others added 14 commits March 27, 2026 12:47
The font-weight converter only accepted a single keyword or integer,
so range values like "100 700" (valid CSS Fonts Level 4) were silently
dropped. Use WeightIntegerConverter.Many(1, 2) to accept 1-2 space-
separated weight integers.
In SetLonghand, a later non-important declaration for the same property
would unconditionally replace an earlier !important one. Now the existing
declaration is preserved when it is !important and the incoming one is not.

Fixes the issue where parsing style="padding: 20px !important; padding: 0"
would incorrectly yield "padding: 0" instead of keeping the important value.
CssLengthValue.CssText unconditionally stripped all units when the
numeric value was zero. Per CSS spec, 0 is valid without a unit for
<length> values, but <percentage> values must always include the %
sign since 0% and 0 have different semantic meanings (e.g. flex-basis).
Fix @font-face font-weight range values being lost during parse
Fix !important declarations being overridden by non-important duplicates
Replace URL-based stylesheet loading with local CSS files to eliminate
network dependency. Several original URLs were dead or returning HTML
error pages. The 8 valid CSS files are now committed under Samples/ and
loaded via the new FileTests class. Also fix PlatformNotSupportedException
from RuntimeHelpers.PrepareMethod on .NET 10.
The `inherit` keyword on shorthand properties like `border`, `margin`,
and `padding` was not correctly resolved to parent values. Three
independent bugs contributed:

1. DeclarationInfo: shorthand converters with null InitialValue were
   not wrapped with StandardValueConverter, so CSS-wide keywords like
   `inherit` were either ignored or partially mis-parsed by the
   property-specific converter. Fixed by always wrapping with
   StandardValueConverter first.

2. DeclarationInfoExtensions.Expand: CssInheritValue and CssUnsetValue
   were not handled when expanding shorthand properties to longhands,
   causing them to fall through to the aggregator Split which returned
   null. Added explicit handling for both value types.

3. DeclarationInfoExtensions.Collapse: CssInheritValue was not tracked
   for round-trip serialization of shorthand properties. Added inherit
   tracking alongside initial, unset, and child.

4. CssStyleDeclaration.ChangeDeclarations: when UpdateDeclarations
   found a child property with explicit `inherit` value, it removed it
   but did not allow the parent value to replace it because the skip
   flag was not reset. Fixed by setting skip to false when the old
   declaration is removed.
Load performance CSS samples from disk instead of URLs. Fix issue running modern dotnet
…values

Fix 0% losing its percent unit during CSS serialization
…e between elements

Use NextElementSibling instead of NextSibling for table cell and row
sibling checks, so whitespace text nodes between elements don't prevent
tab/newline insertion.
Drop EOL frameworks (net6.0, net7.0, net461) and add net10.0.
Simplify conditional TFM by appending Windows-only targets (net462, net472)
to the base list.
- Cache computed styles in a dictionary across the entire traversal so
  the same element is never computed twice (hit as element, parent, and
  sibling).
- Hoist StyleCollection creation to the top of GetInnerText and reuse it
  throughout, eliminating repeated stylesheet enumeration and LINQ
  allocations.
- When the parent's computed style is already cached, use incremental
  computation (ComputeDeclarationsWithParent) that inherits from the
  cached parent instead of walking all ancestors - replacing the O(depth)
  ancestor loop with a single UpdateDeclarations call.
Files with non-trivial nullable warnings get #nullable disable to preserve current
behavior.
FlorianRappl and others added 12 commits March 28, 2026 14:07
Update target frameworks to netstandard2.0, net8.0, and net10.0
Optimize GetInnerText with style caching and incremental computation
…lings

Fix GetInnerText skipping table tabs/newlines when HTML has whitespace between elements
Update AngleSharp to 1.4.0 and add System.Memory for older TFMs
Enable nullable reference types solution-wide (but #nullable disabled marked for existing code)
Multi-target AngleSharp.Performance.Css to net472;net10.0 so that
Alba.CsCss (which only supports net462/net472) is excluded from the
net10.0 build. Update ExCSS from 2.0.6 to 4.3.1 and adapt to its
renamed StylesheetParser API.
Replace the custom TestSuite/ITestee infrastructure with BenchmarkDotNet
for statistically rigorous benchmarking with memory diagnostics. Inline
parser logic into a single CssParserBenchmarks class parameterized by
CSS sample file. Add benchmark usage instructions to README.
- Rewrite ContentFrom() to scan chars directly instead of
  re-invoking the full tokenizer, eliminating double-tokenization
- Cache single-char token strings via static lookup table,
  remove unused CssStringToken/CssUrlToken/CssCommentToken subclasses
- Add ToLowerFast() to skip allocation when strings are already
  lowercase, use StringBuilder for custom property name concatenation
- Replace @-rule if-else chain with dictionary dispatch, add
  dictionary index to CssStyleDeclaration for O(1) property lookups
- Avoid double-array allocation in PeriodicValueConverter when all
  4 values are present
Fix performance benchmark TFM compatibility. Update to latest ExCSS ver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.