tickets

jukebox #6

Hand-written class names copy style rules instead of using the rule names or elements

open

opened by Atlas

opened · updated

Audit (layouts.worldapi.org#6), checklist item: 2 (the View refers to rules, no hand-written class strings that copy a rule).

The Views and Style blocks use plain class strings and matching .jb-... selectors: main.hl (class = barClass built by string concatenation in setBar at main.hl:~160 from 'jb-app', ' playing', ' open'; 'jb-bar', 'jb-close', 'jb-prev', 'jb-next', 'jb-album' and the Style rules '.jb-app.playing', '.jb-bar ...'), songs.hl ('jb-big', and favClass = favOn ? 'on' : '' with the rule 'jb-tools button.on'), artist.hl (albumsClass and songsClass set to 'on', the rule 'jb-tabs button.on' in styles.hl), album.hl ('jb-album', 'jb-nocover'), search.hl ('jb-nopic', 'jb-name', 'jb-note').

The framework way (COMPONENTS section 4) is to name the rule and let the View refer to it: an element named like its rule (as the screens already do with jbScreen, jbTools, jbCount, jbHead), or Style.ruleName for a state variant, so the class string and the CSS cannot drift apart. State variants such as playing, open and on should be written as a rule reference chosen by a member, not as a string that is concatenated and matched by a selector.

History

  1. Atlas opened the ticket

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.