Skip to content

Commit

Permalink
Make PathSegList.numberOfItems enumerable to match other properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
progers committed Nov 7, 2015
1 parent 3db3c23 commit 2e904ac
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions pathseg.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,25 @@
get: function() {
this._checkPathSynchronizedToList();
return this._list.length;
}
},
enumerable: true
});

// Add the pathSegList accessors to SVGPathElement.
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData
Object.defineProperty(SVGPathElement.prototype, "pathSegList", {
get: function() {
if (!this._pathSegList)
this._pathSegList = new SVGPathSegList(this);
return this._pathSegList;
},
enumerable: true
});
// FIXME: The following are not implemented and simply return SVGPathElement.pathSegList.
Object.defineProperty(SVGPathElement.prototype, "normalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
Object.defineProperty(SVGPathElement.prototype, "animatedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
Object.defineProperty(SVGPathElement.prototype, "animatedNormalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });

// Process any pending mutations to the path element and update the list as needed.
// This should be the first call of all public functions and is needed because
// MutationObservers are not synchronous so we can have pending asynchronous mutations.
Expand Down Expand Up @@ -802,20 +818,5 @@

return builder.pathSegList;
}

// Add the pathSegList accessors to SVGPathElement.
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData
Object.defineProperty(SVGPathElement.prototype, "pathSegList", {
get: function() {
if (!this._pathSegList)
this._pathSegList = new SVGPathSegList(this);
return this._pathSegList;
},
enumerable: true
});
// FIXME: The following are not implemented and simply return SVGPathElement.pathSegList.
Object.defineProperty(SVGPathElement.prototype, "normalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
Object.defineProperty(SVGPathElement.prototype, "animatedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
Object.defineProperty(SVGPathElement.prototype, "animatedNormalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
}
}());
}());

0 comments on commit 2e904ac

Please sign in to comment.