Skip to content

Commit

Permalink
Merge pull request #1178 from AngleSharp/devel
Browse files Browse the repository at this point in the history
Release 1.1.1
  • Loading branch information
FlorianRappl committed Mar 1, 2024
2 parents 7ef54d4 + 58582a4 commit 9c1af1c
Show file tree
Hide file tree
Showing 23 changed files with 193 additions and 78 deletions.
34 changes: 23 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# 1.1.1

Released on Friday, March 1 2024.

- Fixed `ISourceReference` not using `HtmlToken` underneath
- Fixed handling of replacement characters in escaped script blocks (#1174)
- Fixed handling of empty template element in SVG foreign mode (#1176)
- Fixed handling of `<template>` in foreign elements (#1179)
- Improved pre-release version to follow semver (#1171) @georg-jung
- Improved NuGet package with link to repository (#1168) @thompson-tomo
- Added `PostAsMultipart` helper for multipart/form-data to `DocumentRequest` (#1173)

# 1.1.0

Released on Thursday, January 18 2024
Released on Thursday, January 18 2024.

- Fixed priority calculations for selector lists (#1161)
- Fixed `:where` and `:is` selectors using forgiving lists
Expand All @@ -10,15 +22,15 @@ Released on Thursday, January 18 2024

# 1.0.7

Released on Friday, November 17 2023
Released on Friday, November 17 2023.

- Fixed implementation of `IRange` using offsets (#1147) @zukarusan
- Improved performance in `Node.set_Owner` (#1149) @campersau
- Added `net8.0` as direct target framework

# 1.0.6

Released on Saturday, November 11 2023
Released on Saturday, November 11 2023.

- Fixed case-sensitiveness in virtual responses
- Fixed warning for outdated actions in CI/CD workflow (#1145) @martincostello
Expand All @@ -28,7 +40,7 @@ Released on Saturday, November 11 2023

# 1.0.5

Released on Tuesday, October 3 2023
Released on Tuesday, October 3 2023.

- Improved codebase (#1128, #1126, #1133) @matkoch @ivandrofly
- Improved documentation (#1127)
Expand All @@ -40,21 +52,21 @@ Released on Tuesday, October 3 2023

# 1.0.4

Released on Saturday, June 24 2023
Released on Saturday, June 24 2023.

- Fixed issue with gzip encoding under certain conditions (#1122)
- Fixed issue with `li` scope leading to stack overflow (#1123)
- Added more pseudo selectors from Selector L4 spec (#1121)

# 1.0.3

Released on Thursday, June 8 2023
Released on Thursday, June 8 2023.

- Fixed wrong escaping of CSS selector pseudo class functions (#1069)

# 1.0.2

Released on Tuesday, June 4 2023
Released on Tuesday, June 4 2023.

- Improved codebase (#1091, #1090, #1089, #1088, #1087, #1086) @SimonCropp
- Fixed potential stack overflow in `GetStyleSheets` (#1084) @bjornri
Expand All @@ -65,15 +77,15 @@ Released on Tuesday, June 4 2023

# 1.0.1

Released on Monday, January 16 2023
Released on Monday, January 16 2023.

- Fixed entities in `noscript` being double encoded (#1070)
- Added previous `Event` constructor overload for ABI compatibility
- Added README to NuGet package

# 1.0.0

Released on Tuesday, January 10 2023
Released on Tuesday, January 10 2023.

- Updated build system to use NUKE instead of CAKE (#1075) @driekus77
- Fixed `TagClosedWrong` error with nested formatting elements (#1052)
Expand All @@ -88,13 +100,13 @@ Released on Tuesday, January 10 2023

# 0.17.1

Released on Thursday, June 2 2022
Released on Thursday, June 2 2022.

- Fixed wrong reference to `System.Text.Encoding.CodePages` (#1046) @linkdotnet

# 0.17.0

Released on Tuesday, May 31 2022
Released on Tuesday, May 31 2022.

- Dropped .NET Framework 4.6 (#960)
- Updated GitHub actions logger (#1044) @Tyrrrz
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ AngleSharp contains code written by (in order of first pull request / commit):
* [Ivandro Jao](https://github.com/ivandrofly)
* [Muhammad Nabilasykar](https://github.com/zukarusan)
* [Dmitry Kushnir](https://github.com/dv00d00)
* [Georg Jung](https://github.com/georg-jung)
* [James Thompson ](https://github.com/thompson-tomo)

Without these awesome people AngleSharp could not exist. Thanks to everyone for your contributions! :beers:

Expand Down
4 changes: 2 additions & 2 deletions nuke/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ protected override void OnBuildInitialized()

if (ScheduledTargets.Contains(Default))
{
Version = $"{Version}-ci-{buildNumber}";
Version = $"{Version}-ci.{buildNumber}";
}
else if (ScheduledTargets.Contains(PrePublish))
{
Version = $"{Version}-alpha-{buildNumber}";
Version = $"{Version}-beta.{buildNumber}";
}
}

Expand Down
10 changes: 0 additions & 10 deletions nuke/ReleaseNotesParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@
/// </remarks>
public sealed class ReleaseNotesParser
{
private readonly Regex _versionRegex;

/// <summary>
/// Initializes a new instance of the <see cref="ReleaseNotesParser"/> class.
/// </summary>
public ReleaseNotesParser()
{
_versionRegex = new Regex(@"(?<Version>\d+(\s*\.\s*\d+){0,3})(?<Release>-[a-z][0-9a-z-]*)?");
}

/// <summary>
/// Parses all release notes.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/AngleSharp.Core.Docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anglesharp/core",
"version": "0.17.2",
"version": "1.1.1",
"preview": true,
"description": "The doclet for the AngleSharp.Core documentation.",
"keywords": [
Expand Down
51 changes: 51 additions & 0 deletions src/AngleSharp.Core.Tests/Html/Tricky.cs
Original file line number Diff line number Diff line change
Expand Up @@ -975,5 +975,56 @@ public void AttributeValuesWithAmpersandAndUnderscoreAreOkay_Issue902()
}).ParseDocument("<!DOCTYPE html><a href=\"https://test.de/?foo&_\"></a>");
Assert.IsNotNull(document);
}

[Test]
public void StackEmptyShouldNotAppearWithTemplate_Issue1176()
{
var html = "<svg><template><title><v></temPlate>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
parser.ParseDocument(html.ToCharArray(), 0);
}

[Test]
public void TableMenuShouldApplyHeisenbergCorrectly_Issue1179()
{
var html = "<table><a><menu>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
var document = parser.ParseDocument(html.ToCharArray(), 0);
Assert.AreEqual("<a><menu></menu></a><table></table>", document.Body.InnerHtml);
}

[Test]
public void TableMenuClosedAnchorShouldApplyHeisenbergCorrectly_Issue1179()
{
var html = "<table><a><menu></a><nobr>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
var document = parser.ParseDocument(html.ToCharArray(), 0);
Assert.AreEqual("<a></a><menu><a></a><nobr></nobr></menu><table></table>", document.Body.InnerHtml);
}

[Test]
public void TableMenuTemplateShouldApplyHeisenbergCorrectly_Issue1179()
{
var html = "<table><a><menu><svg><template></a><nobr>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
var document = parser.ParseDocument(html.ToCharArray(), 0);
Assert.AreEqual("<a></a><menu><a><svg><template></template></svg></a><nobr></nobr></menu><table></table>", document.Body.InnerHtml);
}

[Test]
public void TableMenuTemplateShouldNotHang_Issue1179()
{
var html = "<table><a><menu><svg><template></a><nobr><p><nobr>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
parser.ParseDocument(html.ToCharArray(), 0);
}

[Test]
public void TableMainTemplateShouldNotHang_Issue1179()
{
var html = "<table><a><main><svg><template></a><a><main><a>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
parser.ParseDocument(html.ToCharArray(), 0);
}
}
}
12 changes: 11 additions & 1 deletion src/AngleSharp.Core.Tests/Library/ArrayPoolBufferTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace AngleSharp.Core.Tests.Library;

using System;
using System.Text;
using Common;
using NUnit.Framework;

Expand Down Expand Up @@ -154,6 +155,15 @@ public void CanAppendMultipleTimesWhileDiscarding()
b.Append('l');
Assert.True(b.HasText("html".AsSpan()));
b.Discard();
}
}
}

[Test]
public void ShouldNotCrashForCertainInput_Issue1174()
{
var content = Convert.FromBase64String("PHNjcmlwdD58PCEtLTxzY3JpcHQ+AAAAAAAAAAAAAA==");
var html = Encoding.UTF8.GetString(content);
var parser = new AngleSharp.Html.Parser.HtmlParser();
parser.ParseDocument(html.ToCharArray(), 0);
}
}
34 changes: 31 additions & 3 deletions src/AngleSharp.Core.Tests/Library/FormSubmit.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace AngleSharp.Core.Tests.Library
namespace AngleSharp.Core.Tests.Library
{
using AngleSharp.Core.Tests.Mocks;
using AngleSharp.Dom;
using AngleSharp.Html;
using AngleSharp.Html.Dom;
using AngleSharp.Io;
using AngleSharp.Io.Dom;
Expand All @@ -18,10 +19,16 @@ public class FormSubmitTests
{
private const String BaseUrl = "http://anglesharp.azurewebsites.net/";

private static Task<IDocument> LoadDocumentAsync(String url)
private static Task<IDocument> LoadDocumentAsync(DocumentRequest request)
{
var config = new Configuration().WithDefaultLoader();
return BrowsingContext.New(config).OpenAsync(Url.Create(url));
return BrowsingContext.New(config).OpenAsync(request);
}

private static Task<IDocument> LoadDocumentAsync(String url)
{
var request = DocumentRequest.Get(Url.Create(url));
return LoadDocumentAsync(request);
}

private static Task<IDocument> PostDocumentAsync(Dictionary<String, String> fields, String encType = null)
Expand Down Expand Up @@ -246,6 +253,27 @@ public async Task PostMultipartFile()
}
}

[Test]
public async Task PostMultipartFile_DocumentRequest_1173()
{
if (Helper.IsNetworkAvailable())
{
var address = BaseUrl + "PostMultipartFile";
var fds = new FormDataSet();

fds.Append("Name", "Test", "text");
fds.Append("Number", "1", "number");
fds.Append("IsActive", "true", "checkbox");
fds.Append("File", GenerateFile(), "file");

var request = DocumentRequest.PostAsMultipart(Url.Create(address), fds);
var response = await LoadDocumentAsync(request);

Assert.IsNotNull(response);
Assert.AreEqual("okay", response.Body.TextContent);
}
}

[Test]
public async Task PostMultipartFiles()
{
Expand Down
1 change: 1 addition & 0 deletions src/AngleSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<authors>AngleSharp</authors>
<owners>Florian Rappl</owners>
<license type="expression">MIT</license>
<repository type="git" url="https://github.com/AngleSharp/AngleSharp" />
<projectUrl>https://anglesharp.github.io</projectUrl>
<icon>logo.png</icon>
<readme>README.md</readme>
Expand Down
9 changes: 2 additions & 7 deletions src/AngleSharp/Common/ArrayPoolBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@ namespace AngleSharp.Common;
/// Works under assumption that the buffer will be disposed after use
/// and max capacity can't be larger than char count in the source.
/// </summary>
internal sealed class ArrayPoolBuffer : IMutableCharBuffer
internal sealed class ArrayPoolBuffer(Int32 length) : IMutableCharBuffer
{
private Char[] _buffer;
private Char[] _buffer = ArrayPool<Char>.Shared.Rent(length);
private Int32 _start;
private Int32 _idx;
private Boolean _disposed;

private Int32 Pointer => _start + _idx;

public ArrayPoolBuffer(Int32 length)
{
_buffer = ArrayPool<Char>.Shared.Rent(length);
}

public void Append(Char c)
{
_buffer[_start + _idx] = c;
Expand Down
5 changes: 2 additions & 3 deletions src/AngleSharp/Dom/TagNames.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace AngleSharp.Dom
{
using System;
using System.Collections.Generic;
using System.Linq;
using Common;
using Html;
using System;
using System.Collections.Generic;

/// <summary>
/// The collection of (known / used) tags.
Expand Down
14 changes: 0 additions & 14 deletions src/AngleSharp/Html/Construction/SourceReference.cs

This file was deleted.

6 changes: 3 additions & 3 deletions src/AngleSharp/Html/Dom/Internal/HtmlFormElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ namespace AngleSharp.Html.Dom
using AngleSharp.Html.Forms.Submitters;
using AngleSharp.Io;
using AngleSharp.Text;
using Construction;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading.Tasks;
using Construction;

/// <summary>
/// Represents the form element.
Expand Down Expand Up @@ -113,7 +113,7 @@ public Task<IDocument> SubmitAsync()
{
var request = GetSubmission();
var context = Context.ResolveTargetContext(Target);
return Context.NavigateToAsync(request);
return context.NavigateToAsync(request);
}

public Task<IDocument> SubmitAsync(IHtmlElement sourceElement)
Expand Down Expand Up @@ -354,7 +354,7 @@ private DocumentRequest SubmitAsEntityBody(Url url, IHtmlElement submitter)

if (enctype.Isi(MimeTypeNames.MultipartForm))
{
enctype = String.Concat(MimeTypeNames.MultipartForm, "; boundary=", formDataSet.Boundary);
return DocumentRequest.PostAsMultipart(url, body, formDataSet.Boundary);
}

return DocumentRequest.Post(url, body, enctype, source: this, referer: Owner.DocumentUri);
Expand Down

0 comments on commit 9c1af1c

Please sign in to comment.