jupyterlab/lumino

Add classList to Widget.title to streamline class manipulation

andrii-i opened this issue · 0 comments

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