From bf7189439504ce9fc9ea6b3770c1166a75254904 Mon Sep 17 00:00:00 2001 From: Christopher Brickley Date: Tue, 19 Apr 2016 12:15:39 -0400 Subject: [PATCH] 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. --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a548998..efa2517 100644 --- a/index.js +++ b/index.js @@ -94,7 +94,12 @@ Pjax.prototype = { matches.shift() matches.forEach(function(htmlAttrib) { 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)) + } }) } }