You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a disconnect between the way hint is called and how it works internally.
Signature: hint(text, cssClass)
It's probably due to a bad argument name that folks started applying quasi-CSS classes here. But hint doesn't work like that:
The top "hint" is called with hint('20', 'healing d20') – taken from code currently in the codebase.
The bottom "hint" is called with hint('20', 'healing') – invented, but it seems to do the right thing, i.e., make the text green.
The cssClass argument doesn't represent a real CSS class, but just a string that the hint internals use as a key in a {key:{fill:number, stroke:number}}. healing is a key in that Object, but healing d20 is not.
Options
Don't fix. Leave as-is.
Implement some CSS-ish behavior, to match the argument name and current callers.
Split the cssClass on spaces and Object.assign to the style where the substrings match a key.
Fix the hint callers so that they just pass, e.g., healing, instead of healing d20.
I'd lean towards 1 – since perhaps current behavior is the desired behavior – or 4.
2 and 3 are both possible, but more complicated than necessary for current usage.
I'll rename the argument in any case, unless the behavior ends up matching CSS classnames.
The text was updated successfully, but these errors were encountered:
There seems to be a disconnect between the way
hint
is called and how it works internally.Signature:
hint(text, cssClass)
It's probably due to a bad argument name that folks started applying quasi-CSS classes here. But
hint
doesn't work like that:hint('20', 'healing d20')
– taken from code currently in the codebase.hint('20', 'healing')
– invented, but it seems to do the right thing, i.e., make the text green.The
cssClass
argument doesn't represent a real CSS class, but just a string that thehint
internals use as a key in a{key:{fill:number, stroke:number}}
.healing
is a key in that Object, buthealing d20
is not.Options
cssClass
on spaces andObject.assign
to the style where the substrings match a key.healing
, instead ofhealing d20
.I'd lean towards 1 – since perhaps current behavior is the desired behavior – or 4.
2 and 3 are both possible, but more complicated than necessary for current usage.
I'll rename the argument in any case, unless the behavior ends up matching CSS classnames.
The text was updated successfully, but these errors were encountered: