Skip to content

Commit adc490f

Browse files
committed
Consider all methods from full type tree
1 parent 0bdcf5b commit adc490f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

AngleSharp.Scripting.JavaScript/DomNodeInstance.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public DomNodeInstance(EngineInstance engine, Object value)
2020
{
2121
_engine = engine;
2222
_value = value;
23-
SetMembers(value.GetType());
23+
SetAllMembers(value.GetType());
2424

2525
// DOM objects can have properties added dynamically
2626
Extensible = true;
@@ -53,14 +53,23 @@ public override PropertyDescriptor GetOwnProperty(String propertyName)
5353
return base.GetOwnProperty(propertyName);
5454
}
5555

56-
void SetMembers(Type type)
56+
void SetAllMembers(Type type)
5757
{
58-
if (type.GetCustomAttribute<DomNameAttribute>() == null)
58+
var types = new List<Type>(type.GetInterfaces());
59+
60+
do
5961
{
60-
foreach (var contract in type.GetInterfaces())
61-
SetMembers(contract);
62+
types.Add(type);
63+
type = type.BaseType;
6264
}
63-
else
65+
while (type != null);
66+
67+
SetMembers(types);
68+
}
69+
70+
void SetMembers(IEnumerable<Type> types)
71+
{
72+
foreach (var type in types)
6473
{
6574
SetProperties(type.GetProperties());
6675
SetMethods(type.GetMethods());

0 commit comments

Comments
 (0)