8000 Should :@text be interchangeable with @text for consistency? · Issue #221 · 11ty/webc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Should :@text be interchangeable with @text for consistency? #221
Open
@ollicle

Description

@ollicle

Posing this question as I spent some time looking elsewhere for an issue that was ultimately caused by my accidental use of :@text="prop" when I meant @text="prop.

A breaking change

Using :@text it is currently possible to assign to a property called text to a component, hypothetical example to ponder:

<mark-down :@text="post"></mark-down>

Where the component does something like:

<div @text="this.text"></div>

Changing this would need consistency with @html which has a similar implied dynamic property behaviour.

Consistency or contrast

If considering a breaking change 😱, I suggest the problem here may be some misplaced consistency. Reusing the @ prefix for @text and @html is confusing as the value is dynamically evaluated without :.

I would also like to suggest two different tokens for text/html is not better than one (i.e. if :@text === @text).

An alternative, bigger breaking change

How about _text and _html in place of @text and @html?

  • Clearer contrast with other attr/props
  • No need to ever:_text/:_html (they look weird anyway which is good I reckon).
  • Un-reserving @text/@html for properties.
  • Distinguished from :@text, :@html, :text, :html, text, html.

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

      0