-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
For example, use the following two tags:
<Meta name="theme-color" media="(prefers-color-scheme: light)" content="#fff" />
<Meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000" />
Only the latter will actually be rendered.
The problem lies here:
Lines 156 to 170 in c9d21ef
actions.addServerTag = (tagDesc: TagDescription) => { | |
const { tags = [] } = props; | |
// tweak only cascading tags | |
if (cascadingTags.indexOf(tagDesc.tag) !== -1) { | |
const index = tags.findIndex(prev => { | |
const prevName = prev.props.name || prev.props.property; | |
const nextName = tagDesc.props.name || tagDesc.props.property; | |
return prev.tag === tagDesc.tag && prevName === nextName; | |
}); | |
if (index !== -1) { | |
tags.splice(index, 1); | |
} | |
} | |
tags.push(tagDesc); | |
}; |
This function seems to remove duplicate tags, but only name
or property
attributes are compared when checking whether they are duplicates.
I suppose to sort props
by key and then serialize it as the unique key of a tag for comparison.
Metadata
Metadata
Assignees
Labels
No labels