mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 00:42:54 -05:00
Use == false
instead of === false
for all options that default to true.
These expression are true: - false == false - false == 0 While these are false: - false == null - false == undefined
This commit is contained in:
parent
dd56f86679
commit
ffa7e16f48
8 changed files with 9 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
"supernew": true,
|
||||
"laxbreak": true,
|
||||
"eqeqeq": false,
|
||||
"-W041": false,
|
||||
"eqnull": true,
|
||||
"loopfunc": true,
|
||||
"boss": true,
|
||||
|
|
|
@ -528,7 +528,7 @@ Base.inject(/** @lends Base# */{
|
|||
|
||||
exportJSON: function(obj, options) {
|
||||
var json = Base.serialize(obj, options);
|
||||
return options && options.asString === false
|
||||
return options && options.asString == false
|
||||
? json
|
||||
: JSON.stringify(json);
|
||||
},
|
||||
|
|
|
@ -90,7 +90,7 @@ var Emitter = {
|
|||
if (setTarget)
|
||||
event.currentTarget = this;
|
||||
for (var i = 0, l = handlers.length; i < l; i++) {
|
||||
if (handlers[i].apply(this, args) === false) {
|
||||
if (handlers[i].apply(this, args) == false) {
|
||||
// If the handler returns false, prevent the default behavior
|
||||
// and stop propagation of the event by calling stop()
|
||||
if (event && event.stop)
|
||||
|
|
|
@ -154,7 +154,7 @@ new function() { // Injection scope for various item event handlers
|
|||
this._style = new Style(project._currentStyle, this, project);
|
||||
// Do not add to the project if it's an internal path, or if
|
||||
// props.insert or settings.isnertItems is false.
|
||||
if (internal || hasProps && props.insert === false
|
||||
if (internal || hasProps && props.insert == false
|
||||
|| !settings.insertItems && !(hasProps && props.insert === true)) {
|
||||
this._setProject(project);
|
||||
} else {
|
||||
|
|
|
@ -22,7 +22,7 @@ Path.inject({ statics: new function() {
|
|||
|
||||
function createPath(segments, closed, args) {
|
||||
var props = Base.getNamed(args),
|
||||
path = new Path(props && props.insert === false && Item.NO_INSERT);
|
||||
path = new Path(props && props.insert == false && Item.NO_INSERT);
|
||||
path._add(segments);
|
||||
// No need to use setter for _closed since _add() called _changed().
|
||||
path._closed = closed;
|
||||
|
@ -335,7 +335,7 @@ Path.inject({ statics: new function() {
|
|||
to = Point.readNamed(arguments, 'to'),
|
||||
props = Base.getNamed(arguments),
|
||||
// See createPath() for an explanation of the following sequence
|
||||
path = new Path(props && props.insert === false
|
||||
path = new Path(props && props.insert == false
|
||||
&& Item.NO_INSERT);
|
||||
path.moveTo(from);
|
||||
path.arcTo(through, to);
|
||||
|
|
|
@ -67,7 +67,7 @@ PathItem.inject(new function() {
|
|||
// See if the item can be reduced to just a simple Path.
|
||||
if (reduce)
|
||||
result = result.reduce({ simplify: true });
|
||||
if (!(options && options.insert === false)) {
|
||||
if (!(options && options.insert == false)) {
|
||||
// Insert the resulting path above whichever of the two paths appear
|
||||
// further up in the stack.
|
||||
result.insertAbove(path2 && path1.isSibling(path2)
|
||||
|
|
|
@ -95,7 +95,7 @@ new function() {
|
|||
attrs.y -= size.height / 2;
|
||||
attrs.width = size.width;
|
||||
attrs.height = size.height;
|
||||
attrs.href = options.embedImages === false && image && image.src
|
||||
attrs.href = options.embedImages == false && image && image.src
|
||||
|| item.toDataURL();
|
||||
return SvgElement.create('image', attrs, formatter);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ test('SymbolDefinition item selection', function() {
|
|||
path.selected = true;
|
||||
var definition = new SymbolDefinition(path);
|
||||
equals(function() {
|
||||
return definition.item.selected === false;
|
||||
return definition.item.selected == false;
|
||||
}, true);
|
||||
equals(function() {
|
||||
return paper.project.selectedItems.length === 0;
|
||||
|
|
Loading…
Reference in a new issue