Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Remove uses of attr="${}" from ui.js #3840

Closed
ianb opened this issue Nov 27, 2017 · 0 comments
Closed

Remove uses of attr="${}" from ui.js #3840

ianb opened this issue Nov 27, 2017 · 0 comments
Assignees
Labels
code quality Not a bug, targeted for fixing in 2018 code Code quality issue, that does not have any outward effect on the product firefox Something that has to ship in the add-on in Firefox

Comments

@ianb
Copy link
Contributor

ianb commented Nov 27, 2017

We've grown a bunch of uses of:

someHtml = `<button title="${getAttributeText("saveScreenshotSelectedArea")}">`;

We have some quoting in place, but really we just shouldn't do this at all. We have a localizeText() function in ui.js, and should extend that to handle attributes. Maybe <button data-l10n-title="saveScreenshotSelectedArea"> (if it's just titles we're dealing with).

Otherwise if we don't go that route, we should do quoting inline IMHO. We should be able to statically determine that a value is properly quoted for its context, and not rely on secondary functions (like getAttributeText()). Or, maybe, we could name the functions to make it clear, like getHtmlQuotedLocalizedText() – but there's limited savings, because it takes a certain number of letters to say that something is quoted, and function composition or long names doesn't change it much.

@johngruen johngruen added this to the Sprint 5 (60-0) 🔘 milestone Nov 28, 2017
@ianb ianb added code Code quality issue, that does not have any outward effect on the product firefox Something that has to ship in the add-on in Firefox labels Jan 10, 2018
@jaredhirsch jaredhirsch self-assigned this Jan 16, 2018
@ianb ianb added the code quality Not a bug, targeted for fixing in 2018 label Jan 17, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
code quality Not a bug, targeted for fixing in 2018 code Code quality issue, that does not have any outward effect on the product firefox Something that has to ship in the add-on in Firefox
Projects
None yet
Development

No branches or pull requests

3 participants