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

Optimize attribute escaping #137

Merged
merged 1 commit into from
Mar 25, 2015
Merged

Optimize attribute escaping #137

merged 1 commit into from
Mar 25, 2015

Conversation

mishanga
Copy link
Member

No description provided.

var attrEscape = BH.prototype.attrEscape = function(str) {
return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
str += '';
if (~str.indexOf('&')) {
Copy link
Member

Choose a reason for hiding this comment

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

А явное сравнение не лучше/быстрее?

Copy link
Member Author

Choose a reason for hiding this comment

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

Не лучше, разница в пределах погрешности. Но я решил даже эту проверку оторвать, т.к. она тоже не добавляет скорости.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a2068ed on escape into 57466ed on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 416c013 on escape into 57466ed on master.

mishanga added a commit that referenced this pull request Mar 25, 2015
Optimize attribute escaping
@mishanga mishanga merged commit cc66d6d into master Mar 25, 2015
@mishanga mishanga deleted the escape branch March 25, 2015 08:15
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.

3 participants