fix(attributes): for attributes without a value, add only the attribute
Some attributes, such as `itemscope` have no corresponding value. This change allows them to still be set.
This commit is contained in:
7
index.js
7
index.js
@@ -94,7 +94,12 @@ Pjax.prototype = {
|
|||||||
matches.shift()
|
matches.shift()
|
||||||
matches.forEach(function(htmlAttrib) {
|
matches.forEach(function(htmlAttrib) {
|
||||||
var attr = htmlAttrib.trim().split("=")
|
var attr = htmlAttrib.trim().split("=")
|
||||||
tmpEl.documentElement.setAttribute(attr[0], attr[1].slice(1, -1))
|
if (attr.length === 1) {
|
||||||
|
tmpEl.documentElement.setAttribute(attr[0], true)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmpEl.documentElement.setAttribute(attr[0], attr[1].slice(1, -1))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user