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 the need for an "output" class. #845

Merged
merged 1 commit into from
Jan 2, 2016

Conversation

chriswells0
Copy link
Contributor

@zeitgeist87: These are the changes you suggested in PR #831.

var node = prompt.children[j - 1];
node.removeAttribute('data-user');
node.removeAttribute('data-host');
node.removeAttribute('data-prompt');
Copy link
Member

Choose a reason for hiding this comment

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

How about something like:

["user", "host", "prompt"].forEach(function(attr) { node.removeAttribute("data-" + attr); });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, the original code is cleaner and easier to read. It's "nice" that it could be done in 1 line, but saving those 18 characters effectively adds 4 function calls and 3 string concatenations.

Copy link
Member

Choose a reason for hiding this comment

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

It’s not about doing it in one line, it's about removing repetition. Actually, I wouldn't do it in one line, I would format it as 3, for readability. Anyhow, no strong opinion here.

@LeaVerou
Copy link
Member

Thanks! LGTM, see comment :)

LeaVerou added a commit that referenced this pull request Jan 2, 2016
Remove the need for an "output" class.
@LeaVerou LeaVerou merged commit dfa5263 into PrismJS:gh-pages Jan 2, 2016
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