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

Render HTML dependency <meta> tag contents correctly #1463

Merged
merged 2 commits into from Nov 10, 2016
Merged

Conversation

jmcphers
Copy link
Member

@jmcphers jmcphers commented Nov 10, 2016

Prior to this change, HTML dependencies that included meta tags were rendered like this:

<meta name="0" content="[object Object]" />

This appears to be because the function invoked in the $.map is being called not with the name and value of the <meta> tag but rather with an object having that name and value, plus an index.

It feels like there should be a more idiomatic way to do this (feedback welcome!).

@wch
Copy link
Collaborator

wch commented Nov 10, 2016

You could do this - it's not really prettier, but the intent is slightly clearer IMO.

var name = Object.keys(obj)[0];
return $("<meta>").attr("name", name).attr("content", obj[name]);

Could you also add an entry in the NEWS.md?

If you feel confident that this change is safe, I'm happy to merge.

@jmcphers
Copy link
Member Author

Okay, I'll change that, and add the NEWS entry.

My only concern is that this code has existed for about a year and a half in its present form, so either (a) it has never worked, or (b) there's an upstream change or a difference in usage at play.

@jmcphers
Copy link
Member Author

Okay, should be ready for merge now.

@wch wch merged commit 28965b7 into master Nov 10, 2016
@wch wch deleted the bugfix/render-metas branch November 10, 2016 21:10
@wch wch removed the review label Nov 10, 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.

None yet

3 participants