jupyterlab / lumino

Lumino is a library for building interactive web applications
https://lumino.readthedocs.io/
Other
635 stars 126 forks source link

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

Open andrii-i opened 1 year ago

andrii-i commented 1 year ago

Description

Unlike Widget, widget.titledoesn'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 https://github.com/jupyterlab/jupyterlab/pull/13921#discussion_r1104963926_

      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