From cc8356089eb7ee226521162a23c32d48407833bb Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 6 Sep 2017 14:53:27 +0200 Subject: [PATCH] css parser: handle single quotes for property values And modify one of the testcases where there are already two double-quoted strings, so that one of them is single-quoted. This way make check fails without the code change. --- include/orcus/css_parser.hpp | 10 +++++----- test/css/basic8.css | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/orcus/css_parser.hpp b/include/orcus/css_parser.hpp index 2a31ae0a7..c2ffc9d89 100644 --- a/include/orcus/css_parser.hpp +++ b/include/orcus/css_parser.hpp @@ -42,7 +42,7 @@ private: void simple_selector_name(); void property_name(); void property(); - void quoted_value(); + void quoted_value(char c); void value(); void function_value(const char* p, size_t len); void function_rgb(bool alpha); @@ -314,12 +314,12 @@ void css_parser<_Handler>::property() } template -void css_parser<_Handler>::quoted_value() +void css_parser<_Handler>::quoted_value(char c) { // Parse until the the end quote is reached. const char* p = nullptr; size_t len = 0; - literal(p, len, '"'); + literal(p, len, c); next(); skip_blanks(); @@ -335,9 +335,9 @@ void css_parser<_Handler>::value() { assert(has_char()); char c = cur_char(); - if (c == '"') + if (c == '"' || c == '\'') { - quoted_value(); + quoted_value(c); return; } diff --git a/test/css/basic8.css b/test/css/basic8.css index 15ef2cf94..f467bef44 100644 --- a/test/css/basic8.css +++ b/test/css/basic8.css @@ -11,5 +11,5 @@ } .ribbon::after::selection { - content: "Selected orange box."; + content: 'Selected orange box.'; } -- GitLab