mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-20 11:00:34 +03:00
test: add e2e tests
fix: boolean attributes client side
This commit is contained in:
committed by
Alexander Lichter
parent
a853ce3de7
commit
05b8891110
@@ -15,9 +15,7 @@ const startUpdate = (hasGlobalWindow ? window.requestAnimationFrame : null) || (
|
||||
* @return {Number} id - a new ID
|
||||
*/
|
||||
export default function batchUpdate(id, callback) {
|
||||
if (id) {
|
||||
stopUpdate(id)
|
||||
}
|
||||
stopUpdate(id)
|
||||
|
||||
return startUpdate(() => {
|
||||
id = null
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function updateClientMetaInfo(options = {}, newInfo) {
|
||||
const htmlTag = getTag(tags, 'html')
|
||||
|
||||
// if this is a server render, then dont update
|
||||
if (htmlTag.getAttribute(ssrAttribute)) {
|
||||
if (htmlTag.hasAttribute(ssrAttribute)) {
|
||||
// remove the server render attribute so we can update on (next) changes
|
||||
htmlTag.removeAttribute(ssrAttribute)
|
||||
return false
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { booleanHtmlAttributes } from '../../shared/constants'
|
||||
import isArray from '../../shared/isArray'
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,9 @@ export default function updateAttribute({ attribute } = {}, attrs, tag) {
|
||||
const keepIndexes = []
|
||||
for (const attr in attrs) {
|
||||
if (attrs.hasOwnProperty(attr)) {
|
||||
const value = isArray(attrs[attr]) ? attrs[attr].join(' ') : attrs[attr]
|
||||
const value = booleanHtmlAttributes.includes(attr)
|
||||
? ''
|
||||
: isArray(attrs[attr]) ? attrs[attr].join(' ') : attrs[attr]
|
||||
|
||||
tag.setAttribute(attr, value || '')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user