Skip to content

Parser silently drops invalid boolean attribute (?attr="value") instead of reporting a warning #181

@akroshg

Description

@akroshg

Summary

When a boolean attribute (prefixed with ?) has a non-handlebars value (e.g., ?disabled="true", ?disabled="Hello {{name}}"), the Rust parser silently drops the attribute with no output and no error/warning. The template author gets no feedback that their attribute was ignored.

Current behavior

  • <button ?disabled="true">Click renders Click (attribute silently lost)
  • <input ?checked="Hello {{name}}"> renders (attribute silently lost)
  • No warning or error is reported to the caller

Code path: process_boolean_attribute in crates/webui-parser/src/lib.rs returns Ok(false) when parse_boolean_condition returns None, and the caller in process_tag_attributes simply skips the attribute.

Expected behavior

The parser should report a warning/diagnostic when a boolean attribute has an invalid value (non-handlebars expression). This matches the Edge JS implementation which logs console.error("[btr] boolean attribute must only contain a value in handlebars") and continues parsing.

Proposed approach

  1. Add a ParserWarning enum to the parser crate
  2. Add a warnings: Vec field to HtmlParser
  3. Push a warning in process_boolean_attribute when the value is not a valid handlebars expression
  4. Thread warnings through BuildResult JsBuildResult (NAPI) and CLI stderr output so consumers can see them
  5. Expose warnings via FFI accessor for C ABI consumers

References

  • Rust parser: crates/webui-parser/src/lib.rs (lines ~1118-1130)
  • Edge JS equivalent: �dge_webui/packages/build/src/btr/generator.js (lines ~447-465)
  • Existing tests that assert the silent drop: lib.rs lines ~2556-2582

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions