Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classList to Widget.title to streamline class manipulation #539

Open
andrii-i opened this issue Feb 13, 2023 · 0 comments
Open

Add classList to Widget.title to streamline class manipulation #539

andrii-i opened this issue Feb 13, 2023 · 0 comments

Comments

@andrii-i
Copy link

andrii-i commented Feb 13, 2023

Description

Unlike Widget, widget.title doesn't have access to classList and its methods for class manipulation, only to className string parameter. As a result, class manipulation can only be done done through className string manipulation which is not optimal, prone to errors and edge cases, requires string-manipulation workarounds as shown below

Reference

Originally posted by @krassowski in jupyterlab/jupyterlab#13921 (comment)

      args.oldValue.title.className = args.oldValue.title.className
        .replace(CURRENT_CLASS, '')
        .replace(ACTIVE_CLASS, '')
        .replace('  ', ' ');

but of course we could also add classList to Title

@andrii-i andrii-i changed the title Add classList to Widget title so streamline class manipulation Add classList to widget.title to streamline class manipulation Feb 14, 2023
@andrii-i andrii-i changed the title Add classList to widget.title to streamline class manipulation Add classList to Widget.title to streamline class manipulation Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant