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
I have to admit here, that I'm not sure how to fix it properly. Simple fix, which works in my case, is quite easy and includes adding [Symbol.hasInstance] implementation to DomConstructorInstance, but I have no idea if this a correct way, and even if it is, then if my implementation would not fail for some cases.
My solution
In DomConstructorInstance constructor, the following code was added
I investigated it a bit more, and it looks like the issue is related to prototype chains. My initial solution, while working for my case, is not a good one.
When BaseType is null, prototype is set to Object and I think it should be set to FunctionPrototype. Jint uses for this _realm.Intrinsics.Function.PrototypeObject, but I have no idea if this is the correct method for handling this in AngleSharp.
When DomPrototypeInstance is created for interface, concept of BaseType fails. For example, HTMLDivElement prototype is Object (due to p. 1) and should be HTMLElement. Fixing this would probably require analyze of implemented interfaces hierarchy and attaching the "top one" as a prototype.
I'll try to look into it in a couple of days, but some hints are welcome, especially to p.1 ;)
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
As title says - instanceof operator doesn't work e.g. for Window, Element, etc.
Steps to Reproduce
Expected behavior:
Console output: twice True
Actual behavior:
Console output: twice False
Environment details:
.NET Framework 4.8, Win 10
Possible Solution
I have to admit here, that I'm not sure how to fix it properly. Simple fix, which works in my case, is quite easy and includes adding [Symbol.hasInstance] implementation to
DomConstructorInstance
, but I have no idea if this a correct way, and even if it is, then if my implementation would not fail for some cases.My solution
In
DomConstructorInstance
constructor, the following code was addedEDIT: changed
PropertyFlag.Configurable
toPropertyFlag.None
And
IsInstance
method:The text was updated successfully, but these errors were encountered: