diff --git a/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj b/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj
index 01bfbe1..af2e8a9 100644
--- a/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj
+++ b/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj
@@ -6,9 +6,9 @@
true
Key.snk
false
- 7.1
AngleSharp.Js.Tests
true
+ true
diff --git a/src/AngleSharp.Js.Tests/Mocks/MockHttpClientRequester.cs b/src/AngleSharp.Js.Tests/Mocks/MockHttpClientRequester.cs
index 65277d5..a2355cf 100644
--- a/src/AngleSharp.Js.Tests/Mocks/MockHttpClientRequester.cs
+++ b/src/AngleSharp.Js.Tests/Mocks/MockHttpClientRequester.cs
@@ -21,7 +21,7 @@ public MockHttpClientRequester(Dictionary mockResponses) : base(
_mockResponses = mockResponses;
}
- protected override async Task PerformRequestAsync(Request request, CancellationToken cancel)
+ protected override Task PerformRequestAsync(Request request, CancellationToken cancel)
{
var response = new DefaultResponse();
@@ -36,7 +36,7 @@ protected override async Task PerformRequestAsync(Request request, Ca
response.Content = new MemoryStream(Encoding.UTF8.GetBytes(string.Empty));
}
- return response;
+ return Task.FromResult(response);
}
}
}
diff --git a/src/AngleSharp.Js/AngleSharp.Js.csproj b/src/AngleSharp.Js/AngleSharp.Js.csproj
index 8ac2c94..ed2be73 100644
--- a/src/AngleSharp.Js/AngleSharp.Js.csproj
+++ b/src/AngleSharp.Js/AngleSharp.Js.csproj
@@ -2,27 +2,28 @@
AngleSharp.Js
AngleSharp.Js
- netstandard2.0;net6.0;net7.0;net8.0
- netstandard2.0;net462;net472;net6.0;net7.0;net8.0
+ netstandard2.0;net6.0;net7.0;net8.0
+ $(TargetFrameworks);net462;net472
true
Key.snk
true
- 7.1
https://github.com/AngleSharp/AngleSharp.Js
git
true
true
true
snupkg
+ MIT
+ true
-
+
-
-
+
+
diff --git a/src/AngleSharp.Js/Extensions/EngineExtensions.cs b/src/AngleSharp.Js/Extensions/EngineExtensions.cs
index a28f7c9..e84e3d2 100644
--- a/src/AngleSharp.Js/Extensions/EngineExtensions.cs
+++ b/src/AngleSharp.Js/Extensions/EngineExtensions.cs
@@ -148,21 +148,18 @@ private static JsValue[] ExpandInitDict(JsValue[] arguments, ParameterInfo[] par
newArgs[i] = arguments[i];
}
- if (obj != null)
+ for (var i = end + offset; i < max; i++)
{
- for (var i = end + offset; i < max; i++)
- {
- var p = parameters[i];
- var name = p.Name;
+ var p = parameters[i];
+ var name = p.Name;
- if (obj.HasProperty(name))
- {
- newArgs[i - offset] = obj.GetProperty(name).Value;
- }
- else
- {
- newArgs[i - offset] = JsValue.Undefined;
- }
+ if (obj.HasProperty(name))
+ {
+ newArgs[i - offset] = obj.Get(name);
+ }
+ else
+ {
+ newArgs[i - offset] = JsValue.Undefined;
}
}
diff --git a/src/AngleSharp.Js/Proxies/DomNodeInstance.cs b/src/AngleSharp.Js/Proxies/DomNodeInstance.cs
index 3705b46..2d4dec8 100644
--- a/src/AngleSharp.Js/Proxies/DomNodeInstance.cs
+++ b/src/AngleSharp.Js/Proxies/DomNodeInstance.cs
@@ -32,9 +32,11 @@ public override PropertyDescriptor GetOwnProperty(JsValue property)
{
return descriptor;
}
- else if (prototype.HasProperty(property))
+
+ var prototypeProperty = prototype.GetOwnProperty(property);
+ if (prototypeProperty != PropertyDescriptor.Undefined)
{
- return prototype.GetProperty(property);
+ return prototypeProperty;
}
}
diff --git a/src/AngleSharp.Js/Proxies/DomPrototypeInstance.cs b/src/AngleSharp.Js/Proxies/DomPrototypeInstance.cs
index 183439e..1967c15 100644
--- a/src/AngleSharp.Js/Proxies/DomPrototypeInstance.cs
+++ b/src/AngleSharp.Js/Proxies/DomPrototypeInstance.cs
@@ -1,9 +1,7 @@
namespace AngleSharp.Js
{
using AngleSharp.Attributes;
- using AngleSharp.Dom;
using AngleSharp.Text;
- using Jint.Native;
using Jint.Native.Object;
using Jint.Native.Symbol;
using Jint.Runtime.Descriptors;
@@ -55,7 +53,7 @@ public Boolean TryGetFromIndex(Object value, String index, out PropertyDescripto
{
if (ex.InnerException is ArgumentOutOfRangeException)
{
- result = new PropertyDescriptor(JsValue.Undefined, false, false, false);
+ result = PropertyDescriptor.Undefined;
return true;
}
@@ -104,12 +102,9 @@ private void SetNormalEvents(IEnumerable eventInfos)
{
foreach (var eventInfo in eventInfos)
{
- var names = eventInfo.GetCustomAttributes()
- .Select(m => m.OfficialName);
-
- foreach (var name in names)
+ foreach (var m in eventInfo.GetCustomAttributes())
{
- SetEvent(name, eventInfo.AddMethod, eventInfo.RemoveMethod);
+ SetEvent(m.OfficialName, eventInfo.AddMethod, eventInfo.RemoveMethod);
}
}
}
@@ -123,6 +118,7 @@ private void SetExtensionMethods(IEnumerable methods)
if (HasProperty(name))
{
+ // skip
}
else if (value.Adder != null && value.Remover != null)
{
@@ -148,9 +144,10 @@ private void SetNormalProperties(IEnumerable properties)
var putsForward = property.GetCustomAttribute();
var names = property
.GetCustomAttributes()
- .Select(m => m.OfficialName);
+ .Select(m => m.OfficialName)
+ .ToArray();
- if (index != null || names.Any(m => m.Is("item")))
+ if (index != null || Array.Exists(names, m => m.Is("item")))
{
SetIndexer(property, indexParameters);
}
@@ -166,12 +163,9 @@ private void SetNormalMethods(IEnumerable methods)
{
foreach (var method in methods)
{
- var names = method.GetCustomAttributes()
- .Select(m => m.OfficialName);
-
- foreach (var name in names)
+ foreach (var m in method.GetCustomAttributes())
{
- SetMethod(name, method);
+ SetMethod(m.OfficialName, method);
}
}
}