ocsigen / ocsigen/tyxml

Merge classes when several class attributes given

Open
#69 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
OCaml
Stars
179
Forks
63
Avg merge
5h
Merged PRs (30d)
22

Description

I think it would be interesting to be able to put several class attributes.

let popup ?(a = []) content =
  let box = D.div ~a:(a_class ["popup"]::a) content in
  ...

Here my function creates a widget popup.
All popups have class "popup".
But I'd like to make possible for user to customize the widget by adding any attribute he wants.

With the current version of tyxml, the code below does not work if a contains a class ...

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 tracing the D.div call and a_class usage shown in the issue to see how the supplied attribute list handles multiple class attributes. Done means a widget can provide a default "popup" class while accepting additional user attributes, including another class, without the current failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.