- Refactoring: Use static keyword for classes

This commit is contained in:
Brett Zamir
2019-05-08 09:58:18 +08:00
parent fc0c53f61a
commit 597644999d
22 changed files with 615 additions and 557 deletions

View File

@@ -922,6 +922,21 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
return builder.pathSegList;
}
// STATIC
static _pathSegArrayAsString (pathSegArray) {
let string = '';
let first = true;
pathSegArray.forEach((pathSeg) => {
if (first) {
first = false;
string += pathSeg._asPathString();
} else {
string += ' ' + pathSeg._asPathString();
}
});
return string;
}
}
SVGPathSegList.prototype.classname = 'SVGPathSegList';
@@ -934,20 +949,6 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
enumerable: true
});
SVGPathSegList._pathSegArrayAsString = function (pathSegArray) {
let string = '';
let first = true;
pathSegArray.forEach((pathSeg) => {
if (first) {
first = false;
string += pathSeg._asPathString();
} else {
string += ' ' + pathSeg._asPathString();
}
});
return string;
};
// Add the pathSegList accessors to SVGPathElement.
// Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData
Object.defineProperties(SVGPathElement.prototype, {