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

Use ES2015+ syntax #8

Merged
merged 15 commits into from
Jul 31, 2018
Merged

Use ES2015+ syntax #8

merged 15 commits into from
Jul 31, 2018

Conversation

knagurski
Copy link
Contributor

When looking through the examples in MDN, I noticed a few places that I thought might be better served with things like template literals and using const instead of var and let. None of the changes included should have any functional impact.

this.itemList.children[childrenLength].appendChild(button);
li.textContent = textInput.value;
button.classList.add('editable-list-remove-item', 'icon');
button.innerHTML = '⊖';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed a bit of an inconsistency here. New list items were added with a different remove icon. Ideally, I like to double back and extract the rendering of the list to a function, so that all items are treated exactly the same.

removeListItem(e) {
e.target.parentNode.remove();
}
handleRemoveItemListeners(arrayOfElements) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was considering a PR to move the handlers from the elements themselves, to the surrounding ul. I think it would reduce the lines of code and complexity of this example pretty significantly.

@chrisdavidmills
Copy link
Contributor

I've checked all your changes, and they seem fine. Thanks @knagurski !

One small ask; these examples are used in many of our web components reference pages — see all of the pages linked from https://developer.mozilla.org/en-US/docs/Web/Web_Components.

Could you take a little bit of time, go through a few of these a day, and update the code examples to use your new code? I'd really appreciate that ;-)

@chrisdavidmills chrisdavidmills merged commit ba7a650 into mdn:master Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants