예제 #1
0
        private void PseudoClass()
        {
            //pseudo
            //  : ':' [ IDENT | functional_pseudo ]
            //  ;

            Read(ToTokenSpec(Token.Colon()));
            if (!TryFunctionalPseudo())
            {
                var clazz = Read(ToTokenSpec(TokenKind.Ident)).Text;
                switch (clazz)
                {
                case "first-child": _generator.FirstChild(); break;

                case "last-child": _generator.LastChild(); break;

                case "only-child": _generator.OnlyChild(); break;

                case "empty": _generator.Empty(); break;

                case "last": _generator.Last(); break;

                case "select-parent": _generator.SelectParent(); break;

                default: CustomSelector(clazz, false); break;
                }
            }
        }
예제 #2
0
        private void PseudoClass()
        {
            //pseudo
            //  : ':' [ IDENT | functional_pseudo ]
            //  ;

            Read(ToTokenSpec(Token.Colon()));
            if (!TryFunctionalPseudo())
            {
                var clazz = Read(ToTokenSpec(TokenKind.Ident)).Text;
                switch (clazz)
                {
                case "first-child": _generator.FirstChild(); break;

                case "last-child": _generator.LastChild(); break;

                case "only-child": _generator.OnlyChild(); break;

                case "empty": _generator.Empty(); break;

                default:
                {
                    throw new FormatException(string.Format(
                                                  "Unknown pseudo-class '{0}'. Use either first-child, last-child, only-child or empty.", clazz));
                }
                }
            }
        }