Permalink
Browse files

wrap attribute setting in try/catch to avoid baling on terrible markup

  • Loading branch information...
noahadams committed Mar 5, 2013
1 parent 2585b16 commit 741a55e174abb492cbc06f200e473e12c55d9f41
Showing with 7 additions and 1 deletion.
  1. +7 −1 api/extractDOM.js
View
@@ -54,7 +54,13 @@ var guillotine = function(captured) {
var el = document.createElement(match[1]);
$.each($('<div' + match[2])[0].attributes, function(i, attr) {
- el.setAttribute(attr.nodeName, attr.nodeValue);
+ try{
+ el.setAttribute(attr.nodeName, attr.nodeValue);
+ }
+ catch(e) {
+ console.error("Can't set attribute " + attr.nodeName + " on element " + el.nodeName)
+ console.log(e);
+ }
});
return el;

0 comments on commit 741a55e

Please sign in to comment.