- Linting (ESLint): Stricter rules (or switch to warning)

- Breaking internal API change: `updateGripCursor` moved to be class method of Selector rather than instance method
- Breaking internal API change: `subpathIsClosed` moved to be class method of `Path` rather than instance method
- Refactoring: Reuse utilities base64 encoder for SVG icons plugin
- Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and `mouseDown` (may also be a boolean) of `pathActions`; other JSDoc additions/improvements
This commit is contained in:
Brett Zamir
2018-11-07 14:51:50 +08:00
parent 901c9547fe
commit 7c470e9909
126 changed files with 2081 additions and 1373 deletions

View File

@@ -5,7 +5,7 @@
* @copyright 2010 Jeff Schiller
*/
import {getHref, setHref, getRotationAngle} from './utilities.js';
import {getHref, setHref, getRotationAngle, isNullish} from './utilities.js';
import {removeElementFromListMap} from './svgtransformlist.js';
/**
@@ -285,9 +285,9 @@ export class RemoveElementCommand extends Command {
}
removeElementFromListMap(this.elem);
if (this.nextSibling == null) {
if (isNullish(this.nextSibling)) {
if (window.console) {
console.log('Error: reference element was lost');
console.log('Error: reference element was lost'); // eslint-disable-line no-console
}
}
this.parent.insertBefore(this.elem, this.nextSibling); // Don't use `before` or `prepend` as `this.nextSibling` may be `null`
@@ -670,7 +670,7 @@ export class UndoManager {
const oldValues = new Array(i), elements = new Array(i);
while (i--) {
const elem = elems[i];
if (elem == null) { continue; }
if (isNullish(elem)) { continue; }
elements[i] = elem;
oldValues[i] = elem.getAttribute(attrName);
}
@@ -695,7 +695,7 @@ export class UndoManager {
let i = changeset.elements.length;
while (i--) {
const elem = changeset.elements[i];
if (elem == null) { continue; }
if (isNullish(elem)) { continue; }
const changes = {};
changes[attrName] = changeset.oldValues[i];
if (changes[attrName] !== elem.getAttribute(attrName)) {