|
@@ -72,7 +72,7 @@ static const String doc_end = R"(
|
|
|
</rml>
|
|
</rml>
|
|
|
)";
|
|
)";
|
|
|
|
|
|
|
|
-enum class SelectorOp { None, RemoveElementsByIds, InsertElementBefore, RemoveClasses, RemoveId, RemoveChecked, SetHover };
|
|
|
|
|
|
|
+enum class SelectorOp { None, RemoveElementsByIds, InsertElementBefore, RemoveClasses, RemoveId, RemoveChecked, RemoveAttributeUnit, SetHover };
|
|
|
|
|
|
|
|
struct QuerySelector {
|
|
struct QuerySelector {
|
|
|
QuerySelector(String selector, String expected_ids, int expect_num_warnings = 0, int expect_num_query_warnings = 0) :
|
|
QuerySelector(String selector, String expected_ids, int expect_num_warnings = 0, int expect_num_query_warnings = 0) :
|
|
@@ -114,7 +114,6 @@ static const Vector<QuerySelector> query_selectors =
|
|
|
{ "*.hello", "X Z H" },
|
|
{ "*.hello", "X Z H" },
|
|
|
{ "*:checked", "I" },
|
|
{ "*:checked", "I" },
|
|
|
|
|
|
|
|
- { "p[unit=m]", "B" },
|
|
|
|
|
{ "p[unit='m']", "B" },
|
|
{ "p[unit='m']", "B" },
|
|
|
{ "p[unit=\"m\"]", "B" },
|
|
{ "p[unit=\"m\"]", "B" },
|
|
|
{ "[class]", "X Y Z P F0 G H" },
|
|
{ "[class]", "X Y Z P F0 G H" },
|
|
@@ -216,6 +215,9 @@ static const Vector<QuerySelector> query_selectors =
|
|
|
{ ":not(:hover) + #P #D1", "D1", SelectorOp::SetHover, "Z", "" },
|
|
{ ":not(:hover) + #P #D1", "D1", SelectorOp::SetHover, "Z", "" },
|
|
|
{ "#X + #Y", "Y", SelectorOp::RemoveId, "X", "" },
|
|
{ "#X + #Y", "Y", SelectorOp::RemoveId, "X", "" },
|
|
|
|
|
|
|
|
|
|
+ { "p[unit=m]", "B", SelectorOp::RemoveAttributeUnit, "B", "" },
|
|
|
|
|
+ { "p[unit=m] + *", "C", SelectorOp::RemoveAttributeUnit, "B", "" },
|
|
|
|
|
+
|
|
|
{ "body > * #D0", "D0" },
|
|
{ "body > * #D0", "D0" },
|
|
|
{ "#E + * ~ *", "G H" },
|
|
{ "#E + * ~ *", "G H" },
|
|
|
{ "#B + * ~ #G", "G" },
|
|
{ "#B + * ~ #G", "G" },
|
|
@@ -352,6 +354,10 @@ TEST_CASE("Selectors")
|
|
|
document->GetElementById(selector.operation_argument)->SetId("");
|
|
document->GetElementById(selector.operation_argument)->SetId("");
|
|
|
operation_str = "RemoveId";
|
|
operation_str = "RemoveId";
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case SelectorOp::RemoveAttributeUnit:
|
|
|
|
|
+ document->GetElementById(selector.operation_argument)->RemoveAttribute("unit");
|
|
|
|
|
+ operation_str = "RemoveAttributeUnit";
|
|
|
|
|
+ break;
|
|
|
case SelectorOp::SetHover:
|
|
case SelectorOp::SetHover:
|
|
|
document->GetElementById(selector.operation_argument)->SetPseudoClass("hover", true);
|
|
document->GetElementById(selector.operation_argument)->SetPseudoClass("hover", true);
|
|
|
operation_str = "SetHover";
|
|
operation_str = "SetHover";
|