1
1
namespace AngleSharp . Js
2
2
{
3
3
using AngleSharp . Attributes ;
4
- using AngleSharp . Dom ;
5
4
using AngleSharp . Text ;
6
- using Jint . Native ;
7
5
using Jint . Native . Object ;
8
6
using Jint . Native . Symbol ;
9
7
using Jint . Runtime . Descriptors ;
@@ -55,7 +53,7 @@ public Boolean TryGetFromIndex(Object value, String index, out PropertyDescripto
55
53
{
56
54
if ( ex . InnerException is ArgumentOutOfRangeException )
57
55
{
58
- result = new PropertyDescriptor ( JsValue . Undefined , false , false , false ) ;
56
+ result = PropertyDescriptor . Undefined ;
59
57
return true ;
60
58
}
61
59
@@ -104,12 +102,9 @@ private void SetNormalEvents(IEnumerable<EventInfo> eventInfos)
104
102
{
105
103
foreach ( var eventInfo in eventInfos )
106
104
{
107
- var names = eventInfo . GetCustomAttributes < DomNameAttribute > ( )
108
- . Select ( m => m . OfficialName ) ;
109
-
110
- foreach ( var name in names )
105
+ foreach ( var m in eventInfo . GetCustomAttributes < DomNameAttribute > ( ) )
111
106
{
112
- SetEvent ( name , eventInfo . AddMethod , eventInfo . RemoveMethod ) ;
107
+ SetEvent ( m . OfficialName , eventInfo . AddMethod , eventInfo . RemoveMethod ) ;
113
108
}
114
109
}
115
110
}
@@ -123,6 +118,7 @@ private void SetExtensionMethods(IEnumerable<MethodInfo> methods)
123
118
124
119
if ( HasProperty ( name ) )
125
120
{
121
+ // skip
126
122
}
127
123
else if ( value . Adder != null && value . Remover != null )
128
124
{
@@ -148,9 +144,10 @@ private void SetNormalProperties(IEnumerable<PropertyInfo> properties)
148
144
var putsForward = property . GetCustomAttribute < DomPutForwardsAttribute > ( ) ;
149
145
var names = property
150
146
. GetCustomAttributes < DomNameAttribute > ( )
151
- . Select ( m => m . OfficialName ) ;
147
+ . Select ( m => m . OfficialName )
148
+ . ToArray ( ) ;
152
149
153
- if ( index != null || names . Any ( m => m . Is ( "item" ) ) )
150
+ if ( index != null || Array . Exists ( names , m => m . Is ( "item" ) ) )
154
151
{
155
152
SetIndexer ( property , indexParameters ) ;
156
153
}
@@ -166,12 +163,9 @@ private void SetNormalMethods(IEnumerable<MethodInfo> methods)
166
163
{
167
164
foreach ( var method in methods )
168
165
{
169
- var names = method . GetCustomAttributes < DomNameAttribute > ( )
170
- . Select ( m => m . OfficialName ) ;
171
-
172
- foreach ( var name in names )
166
+ foreach ( var m in method . GetCustomAttributes < DomNameAttribute > ( ) )
173
167
{
174
- SetMethod ( name , method ) ;
168
+ SetMethod ( m . OfficialName , method ) ;
175
169
}
176
170
}
177
171
}
0 commit comments