A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AngleSharp/AngleSharp.XPath/commit/1bb16a9ca5f0760ec39b61b1d4efca2eec75a5fe below:

#37 Fix non-first attributes finding · AngleSharp/AngleSharp.XPath@1bb16a9 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+34

-15

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+34

-15

lines changed Original file line number Diff line number Diff line change

@@ -1,10 +1,10 @@

1 -

using System.Xml;

2 -

using AngleSharp.Xml.Parser;

1 +

using AngleSharp.Dom;

3 2

using AngleSharp.Html.Parser;

3 +

using AngleSharp.Xml.Parser;

4 4

using NUnit.Framework;

5 5

using System.Threading.Tasks;

6 +

using System.Xml;

6 7

using System.Xml.XPath;

7 -

using AngleSharp.Dom;

8 8 9 9

namespace AngleSharp.XPath.Tests

10 10

{

@@ -173,5 +173,29 @@ public void MoveToParent_CallWhenCurrentNodeIsAttr_ShouldBeMovedToAttrOwnerEleme

173 173

// Assert

174 174

Assert.AreEqual(nav.Name, "root");

175 175

}

176 + 177 +

[Test]

178 +

public void SelectSingleNodeTest_AttributesOrder()

179 +

{

180 +

// Arrange

181 +

const string html =

182 +

@"<body>

183 +

<div id='div1'>First</div>

184 +

<div id='div2' class='mydiv'>Second</div>

185 +

<div class='mydiv' id='div3'>Third</div>

186 +

</body>";

187 +

var parser = new HtmlParser();

188 +

var document = parser.ParseDocument(html);

189 + 190 +

// Act

191 +

var div1 = document.DocumentElement.SelectSingleNode("//div[@id='div1']");

192 +

var div2 = document.DocumentElement.SelectSingleNode("//div[@id='div2']");

193 +

var div3 = document.DocumentElement.SelectSingleNode("//div[@id='div3']");

194 + 195 +

// Assert

196 +

Assert.That(div1, Is.Not.Null);

197 +

Assert.That(div2, Is.Not.Null);

198 +

Assert.That(div3, Is.Not.Null); // currently fails

199 +

}

176 200

}

177 201

}

Original file line number Diff line number Diff line change

@@ -1,8 +1,8 @@

1 1

<Project Sdk="Microsoft.NET.Sdk">

2 2

<PropertyGroup>

3 -

<Version>2.0.0</Version>

4 -

<AssemblyVersion>2.0.0</AssemblyVersion>

5 -

<FileVersion>2.0.0</FileVersion>

3 +

<Version>2.0.1</Version>

4 +

<AssemblyVersion>2.0.1</AssemblyVersion>

5 +

<FileVersion>2.0.1</FileVersion>

6 6

<Authors>Denis Ivanov</Authors>

7 7

<PackageId>AngleSharp.XPath</PackageId>

8 8

<AssemblyName>AngleSharp.XPath</AssemblyName>

@@ -20,7 +20,7 @@

20 20

</PropertyGroup>

21 21 22 22

<ItemGroup>

23 -

<PackageReference Include="AngleSharp" Version="0.17.0" />

23 +

<PackageReference Include="AngleSharp" Version="0.17.1" />

24 24

</ItemGroup>

25 25 26 26

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'net6.0' ">

Original file line number Diff line number Diff line change

@@ -283,11 +283,6 @@ public override bool MoveToNext()

283 283

/// <inheritdoc />

284 284

public override bool MoveToNextAttribute()

285 285

{

286 -

if (CurrentElement == null)

287 -

{

288 -

return false;

289 -

}

290 - 291 286

if (!(CurrentNode is IAttr attr))

292 287

{

293 288

return false;

@@ -300,10 +295,10 @@ public override bool MoveToNextAttribute()

300 295 301 296

var attrIndex = attr.OwnerElement.Attributes.Index(attr);

302 297 303 -

if (attrIndex >= CurrentElement.Attributes.Length - 1)

304 -

{

298 +

if (attrIndex == attr.OwnerElement.Attributes.Length - 1)

299 +

{

305 300

return false;

306 -

}

301 +

}

307 302 308 303

_currentNode = attr.OwnerElement.Attributes[attrIndex + 1];

309 304

return true;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4