Skip to content

Commit f9604c0

Browse files
committed
fix: use Array.from
1 parent 3cfbf87 commit f9604c0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/client/updaters/tag.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// borrow the slice method
2-
const toArray = Function.prototype.call.bind(Array.prototype.slice)
3-
41
/**
52
* Updates meta tags inside <head> and <body> on the client. Borrowed from `react-helmet`:
63
* https://github.com/nfl/react-helmet/blob/004d448f8de5f823d10f838b02317521180f34da/src/Helmet.js#L195-L245
@@ -10,8 +7,8 @@ const toArray = Function.prototype.call.bind(Array.prototype.slice)
107
* @return {Object} - a representation of what tags changed
118
*/
129
export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags, headTag, bodyTag) {
13-
const oldHeadTags = toArray(headTag.querySelectorAll(`${type}[${attribute}]`))
14-
const oldBodyTags = toArray(bodyTag.querySelectorAll(`${type}[${attribute}][data-body="true"]`))
10+
const oldHeadTags = Array.from(headTag.querySelectorAll(`${type}[${attribute}]`))
11+
const oldBodyTags = Array.from(bodyTag.querySelectorAll(`${type}[${attribute}][data-body="true"]`))
1512
const newTags = []
1613

1714
if (tags.length > 1) {

0 commit comments

Comments
 (0)