@@ -64,7 +64,13 @@ internal static ICssProperty CreateShorthand(this IBrowsingContext context, Stri
6464 var factory = context . GetFactory < IDeclarationFactory > ( ) ;
6565 var info = factory . Create ( name ) ;
6666 var value = info . Combine ( factory , longhands ) ;
67- return new CssProperty ( name , info . Converter , info . Flags , value , important ) ;
67+
68+ if ( context . AllowsDeclaration ( info ) )
69+ {
70+ return new CssProperty ( name , info . Converter , info . Flags , value , important ) ;
71+ }
72+
73+ return null ;
6874 }
6975
7076 internal static ICssProperty [ ] CreateLonghands ( this IBrowsingContext context , ICssProperty shorthand )
@@ -78,16 +84,18 @@ internal static ICssProperty[] CreateLonghands(this IBrowsingContext context, IC
7884 internal static CssProperty CreateProperty ( this IBrowsingContext context , String propertyName )
7985 {
8086 var info = context . GetDeclarationInfo ( propertyName ) ;
81- var provider = context . GetProvider < CssParser > ( ) ;
8287
83- if ( info . Flags != PropertyFlags . Unknown || context . IsAllowingUnknownDeclarations ( ) )
88+ if ( context . AllowsDeclaration ( info ) )
8489 {
8590 return new CssProperty ( propertyName , info . Converter , info . Flags ) ;
8691 }
8792
8893 return null ;
8994 }
9095
96+ private static Boolean AllowsDeclaration ( this IBrowsingContext context , DeclarationInfo info ) =>
97+ info . Flags != PropertyFlags . Unknown || context . IsAllowingUnknownDeclarations ( ) ;
98+
9199 private static Boolean IsAllowingUnknownDeclarations ( this IBrowsingContext context )
92100 {
93101 var parser = context . GetProvider < CssParser > ( ) ;
0 commit comments