Преглед на файлове

fix(template): skip conditional attributes in per-context blocks

Prevents premature processing of spry-if/spry-else-if/spry-else
directives when nested inside spry-per-* containers. The
transform_per_attributes function will handle these with proper
context during its pass.

Removes leftover debug print statements.
Billy Barrow преди 1 месец
родител
ревизия
f01c4c9248
променени са 1 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 6 3
      src/Component.vala

+ 6 - 3
src/Component.vala

@@ -467,14 +467,17 @@ namespace Spry {
             MarkupNode node;
             // Select one by one, so we don't have problems with nesting
             while((node = doc.select_one("//*[@spry-if or @spry-else-if or @spry-else]")) != null) {
-                print(@"node $(node.tag_name)\n");
+                if (context == null && has_any_parent_where(node, n => n.get_attributes().keys.any(a => a.has_prefix("spry-per-")))) {
+                    // Don't process, or remove if an explicit context was not passed and the attribute is inside spry-per-* blocks
+                    // transform_per_attributes will call back later with more context information.
+                    break;
+                }
+
                 var expression_string = node.get_attribute("spry-if") ?? node.get_attribute("spry-else-if");
                 node.remove_attribute("spry-if");
                 node.remove_attribute("spry-else-if");
                 node.remove_attribute("spry-else");
                 if(expression_string == null) {
-                    print("null\n");
-                    // else case
                     continue;
                 }