Exemplo n.º 1
0
        /// <summary>
        /// 创建带范畴限定的选择器
        /// </summary>
        /// <param name="expression">选择器表达式</param>
        /// <param name="scope">范畴限定,上溯时不超出此范畴</param>
        /// <returns>带范畴限定的层叠选择器</returns>
        public static ICssSelector Create(IHtmlContainer scope, string expression)
        {
            if (scope == null)
            {
                throw new ArgumentNullException("scope");
            }

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            return(CssCasecadingSelector.Create(new CssAncetorRelativeSelector(new ContainerRestrict(scope)), CssParser.ParseSelector(expression)));
        }