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
♻️ Refactor dom.js to have similar functions be close to each other and have more accurate names. #20717
♻️ Refactor dom.js to have similar functions be close to each other and have more accurate names. #20717
Conversation
…ml into delima02-double-functions
This pull request introduces 2 alerts when merging 788d692 into 9f78741 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 2 alerts when merging 1230192 into 9f78741 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
src/service/navigation.js
Outdated
@@ -310,7 +310,8 @@ export class Navigation { | |||
if (e.defaultPrevented) { | |||
return; | |||
} | |||
const target = closestByTag(dev().assertElement(e.target), 'A'); | |||
const target = | |||
closestAncestorElementByTag(dev().assertElement(e.target), 'A'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This indentation is wrong.
const element = dev().assertElement(e.target);
const target = closestAncestorElementByTag(element, 'A');
Check out the Google JS style guide (we don't follow this exactly): https://google.github.io/styleguide/jsguide.html
…nd have more accurate names. (ampproject#20717) * Move ancestorElementsByTag closer to similar functions. * Rename 'closest' functions in dom.js to more accurate nomenclature. * Have child-related functions be next to ancestor-related ones in dom.js. * Make all usages of the renamed functions use the correct names. * Make all usages of the renamed functions use the correct names. * Lint all changes in this branch. * Update usages of closestAncestorElementBySelector missed in past commits * Indentation formatting at navigation.js.
ancestorElements
andancestorElementsByTag
close to other similar functions indom.js
.closestByTag
andclosestBySelector
toclosestAncestorElementByTag
andclosestAncestorElementBySelector
, respectively.child
related functions be next to allancestor
related functions indom.js
.📖 ♻️
@choumx @jridgewell