From 5caacc3848652d9c38a22a5ad8383a41c195c70e Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Sat, 28 Mar 2015 01:47:27 +0100 Subject: [PATCH] Implement `/deep/` shadow DOM selector Fixes https://github.com/sass/libsass/issues/452 --- constants.cpp | 3 +++ constants.hpp | 3 +++ parser.cpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/constants.cpp b/constants.cpp index b2491c5449..a7dd3c6bee 100644 --- a/constants.cpp +++ b/constants.cpp @@ -78,6 +78,9 @@ namespace Sass { extern const char webkit_calc_kwd[] = "-webkit-calc("; extern const char ms_calc_kwd[] = "-ms-calc("; + // css selector keywords + extern const char sel_deep_kwd[] = "/deep/"; + // css attribute-matching operators extern const char tilde_equal[] = "~="; extern const char pipe_equal[] = "|="; diff --git a/constants.hpp b/constants.hpp index 2b15bf158d..a48360bdb0 100644 --- a/constants.hpp +++ b/constants.hpp @@ -80,6 +80,9 @@ namespace Sass { extern const char webkit_calc_kwd[]; extern const char ms_calc_kwd[]; + // css selector keywords + extern const char sel_deep_kwd[]; + // css attribute-matching operators extern const char tilde_equal[]; extern const char pipe_equal[]; diff --git a/parser.cpp b/parser.cpp index f21752e22d..0e5f4aa3b9 100644 --- a/parser.cpp +++ b/parser.cpp @@ -628,6 +628,9 @@ namespace Sass { else if (lex< quoted_string >() || lex< number >()) { return new (ctx.mem) Type_Selector(pstate, unquote(lexed)); } + else if (lex< exactly < sel_deep_kwd > >()) { + return new (ctx.mem) Type_Selector(pstate, unquote(lexed)); + } else if (peek< pseudo_not >()) { return parse_negated_selector(); } @@ -1984,6 +1987,7 @@ namespace Sass { (q = peek< dimension >(p)) || (q = peek< quoted_string >(p)) || (q = peek< exactly<'*'> >(p)) || + (q = peek< exactly >(p)) || (q = peek< exactly<'('> >(p)) || (q = peek< exactly<')'> >(p)) || (q = peek< exactly<'['> >(p)) ||