Skip to content

Commit c1fa7ce

Browse files
committed
Merge branch 'devel' of github.com:AngleSharp/AngleSharp.XPath into devel
2 parents 2a08fc9 + d23c268 commit c1fa7ce

5 files changed

Lines changed: 34 additions & 12 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ language: csharp
22
solution: src/AngleSharp.XPath.sln
33
dotnet : 2.0.3
44
script :
5-
- dotnet restore
6-
- dotnet build
5+
- dotnet restore src/AngleSharp.XPath.sln
6+
- dotnet build src/AngleSharp.XPath.sln
77
- dotnet test ./**/*Tests/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# AngleSharp.XPath
44

5-
[![Build Status](https://travis-ci.org/denis-ivanov/AngleSharp.XPath.svg?branch=master&style=flat-square)](https://travis-ci.org/denis-ivanov/AngleSharp.XPath)
5+
[![Build Status](https://travis-ci.org/AngleSharp/AngleSharp.XPath.svg?branch=master&style=flat-square)](https://travis-ci.org/AngleSharp/AngleSharp.XPath)
66
[![GitHub Tag](https://img.shields.io/github/tag/AngleSharp/AngleSharp.XPath.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.XPath/releases)
77
[![NuGet Count](https://img.shields.io/nuget/dt/AngleSharp.XPath.svg?style=flat-square)](https://www.nuget.org/packages/AngleSharp.XPath/)
88
[![Issues Open](https://img.shields.io/github/issues/AngleSharp/AngleSharp.XPath.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.XPath/issues)

src/AngleSharp.XPath.Tests/HtmlDocumentNavigatorTests.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AngleSharp.XPath.Tests
88
public class HtmlDocumentNavigatorTests
99
{
1010
[Test, Retry(5)]
11-
public async Task SelectSinleNodeTest()
11+
public async Task SelectSingleNodeTest()
1212
{
1313
// Arrange
1414
const string address = "https://stackoverflow.com/questions/39471800/is-anglesharps-htmlparser-threadsafe";
@@ -41,5 +41,25 @@ public void SelectNodes_SelectList_ShouldReturnList()
4141
// Assert
4242
Assert.That(nodes, Has.Count.EqualTo(3));
4343
}
44+
45+
[Test]
46+
public void SelectPrecedingNodeInDocumentWithDoctype_ShouldReturnNode()
47+
{
48+
// Arrange
49+
const string html =
50+
@"<!DOCTYPE html>
51+
<body>
52+
<span></span>
53+
<div></div>
54+
</body>";
55+
var parser = new HtmlParser();
56+
var document = parser.ParseDocument(html);
57+
58+
// Act
59+
var node = document.DocumentElement.SelectSingleNode("//div/preceding::span");
60+
61+
// Assert
62+
Assert.That(node, Is.Not.Null);
63+
}
4464
}
4565
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<Version>1.1.0</Version>
3+
<Version>1.1.2</Version>
44
<Authors>Denis Ivanov</Authors>
55
<PackageId>AngleSharp.XPath</PackageId>
6-
<AssemblyVersion>1.1.0</AssemblyVersion>
6+
<AssemblyVersion>1.1.2</AssemblyVersion>
77
<AssemblyName>AngleSharp.XPath</AssemblyName>
88
<RootNamespace>AngleSharp.XPath</RootNamespace>
99
<TargetFramework>netstandard2.0</TargetFramework>
10-
<FileVersion>1.1.0</FileVersion>
10+
<FileVersion>1.1.2</FileVersion>
1111
<Description>XPath support for AngleSharp</Description>
1212
<PackageProjectUrl>https://github.com/AngleSharp/AngleSharp.XPath/</PackageProjectUrl>
13-
<PackageLicenseUrl>https://github.com/AngleSharp/AngleSharp.XPath/blob/master/LICENSE</PackageLicenseUrl>
13+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1414
<PackageTags>HTML XPath AngleSharp</PackageTags>
1515
<SignAssembly>true</SignAssembly>
1616
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
1717
<GenerateDocumentationFile>true</GenerateDocumentationFile>
18+
<PublicSign>True</PublicSign>
1819
</PropertyGroup>
1920

2021
<ItemGroup>
21-
<PackageReference Include="AngleSharp" Version="0.10.0" />
22-
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0" />
22+
<PackageReference Include="AngleSharp" Version="0.11.0" />
2323
</ItemGroup>
2424

2525
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
2626
<DelaySign>false</DelaySign>
2727
</PropertyGroup>
28-
</Project>
28+
</Project>

src/AngleSharp.XPath/HtmlDocumentNavigator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public override XPathNodeType NodeType
9191

9292
case Dom.NodeType.Document:
9393
return XPathNodeType.Element;
94+
95+
case Dom.NodeType.DocumentType:
96+
return XPathNodeType.Element;
9497

9598
case Dom.NodeType.Element:
9699
if (_attrIndex != -1)
@@ -110,7 +113,6 @@ public override XPathNodeType NodeType
110113
case Dom.NodeType.EntityReference:
111114
case Dom.NodeType.Notation:
112115
case Dom.NodeType.DocumentFragment:
113-
case Dom.NodeType.DocumentType:
114116
default:
115117
throw new NotImplementedException();
116118
}

0 commit comments

Comments
 (0)