Skip to content

Commit

Permalink
Patch for issue #162
Browse files Browse the repository at this point in the history
  • Loading branch information
arvgta committed Apr 1, 2019
1 parent f8702a5 commit 481737f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ajaxify.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ function _copyAttributes(el, $S, flush) { //copy all attributes of element gener
if (flush) //delete all old attributes
for (var i = el.attributes.length - 1; i >= 0; i--) el.removeAttribute(el.attributes[i].name);

var attr, attributes = Array.prototype.slice.call($S[0].attributes); //slice performs a copy, too
try { //in case of bad input data, $S may contain garbage or nothing
attributes = Array.prototype.slice.call($S[0].attributes); //slice performs a copy, too
} catch(e) {
$.log("Bad input data");
}

while (attr = attributes.pop()) { //fetch one of all the attributes at a time
el.setAttribute(attr.nodeName, attr.nodeValue); //low-level insertion
}
Expand Down

0 comments on commit 481737f

Please sign in to comment.