version switch: turn into a custom element #104778

Open
Tobias Heinke wants to merge 3 commits from Tobias/blender-manual:switcher-two into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

store single state as class
to be then replaced by upcoming custom states
https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class
remove function name prefix no longer confusable with JQuery
move animation to css
transition requires visibility instead of display
not toggle/ replace event listeners
no class properties
split toggle function
css: use tagnames instead of class if not div
rename class selected -> current
mark previously selected with a class

store single state as class to be then replaced by upcoming custom states https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class remove function name prefix no longer confusable with JQuery move animation to css transition requires visibility instead of display not toggle/ replace event listeners no class properties split toggle function css: use tagnames instead of class if not div rename class selected -> current mark previously selected with a class
Author
Member

multiple states? like a deactivated attr
minimize var names?
rename to "variant selector" better in a separate commit

multiple states? like a deactivated attr minimize var names? rename to "variant selector" better in a separate commit
Tobias Heinke requested review from Aaron Carlisle 2024-04-28 14:32:38 +02:00
Tobias Heinke changed title from WIP: version switch: turn into a custom element to version switch: turn into a custom element 2024-05-06 00:53:05 +02:00
Tobias Heinke force-pushed switcher-two from 77febf6234 to 7409670ef6 2024-05-06 01:15:11 +02:00 Compare
Member

What is the advatage of using a custom element? Seems like this can be done with pure HTML. Refactoring out the dropdown to a small JS library might make more sense... Or is there an existing library we could use?

What is the advatage of using a custom element? Seems like this can be done with pure HTML. Refactoring out the dropdown to a small JS library might make more sense... Or is there an existing library we could use?
Author
Member

It has no disadvantages and it's the current way of implementing custom widgets so it's better comparable.
Also this points to the element instead of having two with this.menu.
A small lib is a security issue and the main bulk of work on this is done.

It has no disadvantages and it's the current way of implementing custom widgets so it's better comparable. Also `this` points to the element instead of having two with `this.menu`. A small lib is a security issue and the main bulk of work on this is done.
Tobias Heinke added 1 commit 2024-05-24 05:48:25 +02:00
rename closed state to adjective
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u switcher-two:Tobias-switcher-two
git checkout Tobias-switcher-two
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-manual#104778
No description provided.