Permalink
Browse files

added specified setter for default attributes and fixed the issue whe…

…re default attributes were being copied
  • Loading branch information...
1 parent 89e03af commit bdd9ccd384c244b82cc6a791b3c57c3cb3952633 @tmpvar tmpvar committed Feb 6, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/jsdom/level1/core.js
View
@@ -241,6 +241,10 @@ var attrCopy = function(src, dest, fn) {
var attrs = src.attributes, i, l = attrs.length, attr, copied;
for (i=0;i<l;i++) {
attr = attrs[i];
+ // skip over default attributes
+ if (!attr.specified) {
+ continue;
+ }
// TODO: consider duplicating this code and moving it into level2/core
if (attr.namespaceURI) {
copied = dest.setAttributeNS(attr.namespaceURI,
@@ -1592,7 +1596,8 @@ core.Attr.prototype = {
this._nodeValue = value;
},
get name() { return this._name;},
- get specified() { return this._specified;},
+ get specified() { return this._specified },
+ set specified(val) { this._specified = !!val },
get value() {
return this.nodeValue;
},

0 comments on commit bdd9ccd

Please sign in to comment.