You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
Did you perform a search in the issues?
For more information, see the CONTRIBUTING guide.
Description
JS in operator always return true for objects whose types have string indexers.
Steps to Reproduce
varconfig=Configuration.Default.WithJs();varcontext=BrowsingContext.New(config);vardocument=awaitcontext.OpenAsync(req =>req.Content("")).ConfigureAwait(false);Console.WriteLine(document.ExecuteScript("'somethingThatDoesntExist' in document.createElement('form')"));
Expected behavior:
Console output: False
Actual behavior:
Console output: True
Environment details:
.NET Framework 4.8, Win 10
Possible Solution
In the DomPrototypeInstance.TryGetFromIndex method, there code responsible for returning value is as follows:
This always returns true, no matter if the item is present or not. I think that in case when Invoke call returns null, false should be returned and result should be set to PropertyDescriptor.Undefined.
I checked all string based indexers in code (AngleSharp & AngleSharp.Js repositories only), and apart from the one in JsonObject (which I think is unrelated), none of them could return null if a matching value exists.
The text was updated successfully, but these errors were encountered:
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
JS
in
operator always return true for objects whose types have string indexers.Steps to Reproduce
Expected behavior:
Console output: False
Actual behavior:
Console output: True
Environment details:
.NET Framework 4.8, Win 10
Possible Solution
In the DomPrototypeInstance.TryGetFromIndex method, there code responsible for returning value is as follows:
This always returns true, no matter if the item is present or not. I think that in case when
Invoke
call returns null, false should be returned andresult
should be set toPropertyDescriptor.Undefined
.I checked all string based indexers in code (AngleSharp & AngleSharp.Js repositories only), and apart from the one in
JsonObject
(which I think is unrelated), none of them could return null if a matching value exists.The text was updated successfully, but these errors were encountered: