+
Skip to content

The "client only" directive pre-modifier #43

@lowlighter

Description

@lowlighter

Scope

unstable

What do you want to define?

The new ^ (sigil subject to change) would prevent the directive from being executed by server-side APIs, but would be processed by client-side APIs

Considerations:

  • There-is no need for a server-side equivalent, since the use case would be to partially render with ssr before submitting to client which will then be able to use mizu normally
  • It is unclear whether this should be a regex directive, or handled by the renderer directly
    • It could be either the client side api choose accepts and ignore the ^ sigil altogether
      • Then the parseAttribute method would take this into account
    • Or the server would "clean" the ^ sigil before serving to client, through an API
      • Unlike former solution, this one "loses" information since once processed it's not possible to know whether a directive was client-side only
      • Additionally this force an attribute ref changes since names cannot be modified
  • A directive with this pre-modifier should not be cleaned by *clean.directives as it wasn't processed yet

Example usage

<p *if="true" ^*text="new Date()"></p>
await Mizu.render(template)

<p *text="new Date()"></p>
<p ^*text="new Date()"></p>

I have searched for existing issues

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    specSpec definition for non-well defined behaviors

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载