예제 #1
0
		private static CssUsageInfo AnalyzeInternalStyles(Uri pageUrl, HtmlDocument html)
		{
			var inlineCss = html.GetInlineStyles();

			var styleSheet = new CssStylesheet(pageUrl, inlineCss);

			return AnalyzeCssStylesheet(styleSheet, html);
		}
예제 #2
0
		public async Task<PageAnalysisResult> Analyze(Uri pageUrl, HtmlDocument html)
		{
			var cssInfos = new List<CssUsageInfo>();

			

			if (!String.IsNullOrWhiteSpace(html.GetInlineStyles()))
			{
				cssInfos.Add(AnalyzeInternalStyles(pageUrl, html)); 
			}

			cssInfos.AddRange(await AnalyzeExternalStyles(pageUrl, html));

			var filteredCssInfos = cssInfos.Where(z => z.UnusedSelectors.Any()).ToList();
			
			return new PageAnalysisResult(pageUrl, filteredCssInfos)
			{
				InternalLinks = html.GetInternalLinks(pageUrl)
			};
		}