Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jQuery dependency (#6504) #6575

Merged
merged 3 commits into from
Mar 14, 2019
Merged

Conversation

stephaniehobson
Copy link
Contributor

@stephaniehobson stephaniehobson commented Dec 7, 2018

Description

  • remove jQuery dependency
  • add test for initLangSwitcher

Issue / Bugzilla link

#6504

Testing

@stephaniehobson stephaniehobson added the Review: S Code review time: 30 mins to 1 hour label Dec 11, 2018
@alexgibson alexgibson added the P3 Third level priority - Nice to have label Dec 17, 2018
Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few fixups and I think we may need to dial back the use of dataset sadly, but otherwise looking great 👍

media/js/base/mozilla-utils.js Outdated Show resolved Hide resolved
tests/unit/spec/base/mozilla-utils.js Outdated Show resolved Hide resolved
media/js/base/mozilla-utils.js Outdated Show resolved Hide resolved
@stephaniehobson
Copy link
Contributor Author

Updated.

@alexgibson
Copy link
Member

This needs a rebase now that the footer PR merged.

@stephaniehobson
Copy link
Contributor Author

Updated.

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still one place using dataset, but otherwise lgtm 👍

media/js/base/mozilla-utils.js Outdated Show resolved Hide resolved
media/js/base/mozilla-utils.js Outdated Show resolved Hide resolved
@stephaniehobson
Copy link
Contributor Author

Updated.

Utils.trans = function(stringId) {
return _$strings.data(stringId);
if (_strings) {
return _strings.getAttribute('data-' + stringId);
Copy link
Member

@alexgibson alexgibson Mar 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this isn't quite going to work as-is.

Whilst some calls to this function use dashes to separate attribute names, other calls use camelCase, which for the jQuery API (and native dataset) is totally fine, but would break here as we're assuming dashes only.

Either this function should handle both cases (more complex), or we should choose one method over the other, and update all calls to use the same syntax. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. 🎣

In a perfect world we handle both cases but in the name of expediency I'm tempted to just go with dashes and update the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH there is a certain irony to talking about expediency in a 3 month old PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dash is way more common, converting to dashes.

@alexgibson alexgibson merged commit aabd069 into mozilla:master Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Third level priority - Nice to have Review: S Code review time: 30 mins to 1 hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants