Skip to content

Commit

Permalink
Merge 96f9369 into ddcdc31
Browse files Browse the repository at this point in the history
  • Loading branch information
KentarouTakeda committed Jan 18, 2020
2 parents ddcdc31 + 96f9369 commit 3057592
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/html_tag.js
Expand Up @@ -25,7 +25,7 @@ function htmlTag(tag, attrs, text, escape = true) {
if (attrs[i] == null) result += '';
else {
if (i.match(regexUrl)
|| (tag === 'meta' && !attrs[i].match(regexMeta) && Object.values(attrs)[0].match(regexMeta))) {
|| (tag === 'meta' && !attrs[i].toString().match(regexMeta) && Object.values(attrs)[0].match(regexMeta))) {
result += ` ${escapeHTML(i)}="${encodeURL(attrs[i])}"`;
} else if (attrs[i] === true || i === attrs[i]) result += ` ${escapeHTML(i)}`;
else if (i.match(/srcset$/i)) result += ` ${escapeHTML(i)}="${encSrcset(attrs[i])}"`;
Expand Down
7 changes: 7 additions & 0 deletions test/html_tag.spec.js
Expand Up @@ -151,4 +151,11 @@ describe('htmlTag', () => {
content: 'bar " baz'
}).should.eql('<meta name="foo image" content="bar &quot; baz">');
});

it('meta tag - numeric property', () => {
htmlTag('meta', {
property: 'fb:app_id',
content: 123456789
}).should.eql('<meta property="fb:app_id" content="123456789">');
});
});

0 comments on commit 3057592

Please sign in to comment.