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:
Christopher Brickley
2016-04-19 12:15:39 -04:00
parent beaa21fb3a
commit bf71894395

View File

@@ -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))
}
}) })
} }
} }