phpgt / phpgt/DomTemplate

`data-element` should look at curly parameters

Open
#532 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
PHP
Stars
18
Forks
4
PR merge metrics
No merged PRs in 30d

Description

data-element marks an element as optional. It will be removed from the document if nothing is bound to it.

Docs: https://github.com/phpgt/DomTemplate/wiki/Conditional-and-optional-elements#data-element

I've just been adding the pagination of www.php.gt and I wanted to have a previous/next link. <a href="?page={{prevPage}} data-element>Previous page`

The data-element should remove the link if there is no previous page, but I had to add another data-bind parameter on it to trigger this functionality. <a href="?page={{prevPage}} data-element data-bind:data-prev="prevPage">Previous page`.

If something is bound via the curly braces, it should trigger the data-element functionality, just like it does already with data-bind attributes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of data-element and the existing handling for curly-brace parameters and data-bind attributes. Verify how an unbound parameter affects optional elements, then add coverage showing that an unbound {{prevPage}} removes the link while a bound value preserves it.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.