11namespace AngleSharp . Js
22{
33 using AngleSharp . Attributes ;
4- using AngleSharp . Dom ;
54 using AngleSharp . Text ;
6- using Jint . Native ;
75 using Jint . Native . Object ;
86 using Jint . Native . Symbol ;
97 using Jint . Runtime . Descriptors ;
@@ -55,7 +53,7 @@ public Boolean TryGetFromIndex(Object value, String index, out PropertyDescripto
5553 {
5654 if ( ex . InnerException is ArgumentOutOfRangeException )
5755 {
58- result = new PropertyDescriptor ( JsValue . Undefined , false , false , false ) ;
56+ result = PropertyDescriptor . Undefined ;
5957 return true ;
6058 }
6159
@@ -104,12 +102,9 @@ private void SetNormalEvents(IEnumerable<EventInfo> eventInfos)
104102 {
105103 foreach ( var eventInfo in eventInfos )
106104 {
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 > ( ) )
111106 {
112- SetEvent ( name , eventInfo . AddMethod , eventInfo . RemoveMethod ) ;
107+ SetEvent ( m . OfficialName , eventInfo . AddMethod , eventInfo . RemoveMethod ) ;
113108 }
114109 }
115110 }
@@ -123,6 +118,7 @@ private void SetExtensionMethods(IEnumerable<MethodInfo> methods)
123118
124119 if ( HasProperty ( name ) )
125120 {
121+ // skip
126122 }
127123 else if ( value . Adder != null && value . Remover != null )
128124 {
@@ -148,9 +144,10 @@ private void SetNormalProperties(IEnumerable<PropertyInfo> properties)
148144 var putsForward = property . GetCustomAttribute < DomPutForwardsAttribute > ( ) ;
149145 var names = property
150146 . GetCustomAttributes < DomNameAttribute > ( )
151- . Select ( m => m . OfficialName ) ;
147+ . Select ( m => m . OfficialName )
148+ . ToArray ( ) ;
152149
153- if ( index != null || names . Any ( m => m . Is ( "item" ) ) )
150+ if ( index != null || Array . Exists ( names , m => m . Is ( "item" ) ) )
154151 {
155152 SetIndexer ( property , indexParameters ) ;
156153 }
@@ -166,12 +163,9 @@ private void SetNormalMethods(IEnumerable<MethodInfo> methods)
166163 {
167164 foreach ( var method in methods )
168165 {
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 > ( ) )
173167 {
174- SetMethod ( name , method ) ;
168+ SetMethod ( m . OfficialName , method ) ;
175169 }
176170 }
177171 }
0 commit comments