Skip to content

Return empty string if argument is an empty hash - #665

Merged
gettalong merged 1 commit into
gettalong:masterfrom
ashmaroli:empty-html-attributes
May 14, 2020
Merged

Return empty string if argument is an empty hash#665
gettalong merged 1 commit into
gettalong:masterfrom
ashmaroli:empty-html-attributes

Conversation

@ashmaroli

Copy link
Copy Markdown
Contributor

When attr == {}, then end result to Kramdown::Utils::Html#html_attributes(attr) is always "", but involves allocation of intermediate empty array and the returned new empty string.

These allocations can be eliminated by returning a single frozen string every time attr is an empty hash.

@gettalong
gettalong merged commit fc910f9 into gettalong:master May 14, 2020
@gettalong

Copy link
Copy Markdown
Owner

Thanks!

@ashmaroli
ashmaroli deleted the empty-html-attributes branch May 15, 2020 07:01
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