kopia lustrzana https://github.com/backface/turtlestitch
commit
cfc84accea
|
@ -5657,7 +5657,7 @@ InputSlotMorph.prototype.dropDownMenu = function () {
|
|||
}
|
||||
menu.addItem(' ', null);
|
||||
for (key in choices) {
|
||||
if (choices.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(choices, key)) {
|
||||
if (key[0] === '~') {
|
||||
menu.addLine();
|
||||
} else {
|
||||
|
|
4
gui.js
4
gui.js
|
@ -2079,7 +2079,7 @@ IDE_Morph.prototype.aboutSnap = function () {
|
|||
+ '\nJoe Otto: Morphic Testing and Debugging';
|
||||
|
||||
for (module in modules) {
|
||||
if (modules.hasOwnProperty(module)) {
|
||||
if (Object.prototype.hasOwnProperty.call(modules, module)) {
|
||||
versions += ('\n' + module + ' (' +
|
||||
modules[module] + ')');
|
||||
}
|
||||
|
@ -3816,7 +3816,7 @@ ProjectDialogMorph.prototype.getLocalProjectList = function () {
|
|||
var stored, name, dta,
|
||||
projects = [];
|
||||
for (stored in localStorage) {
|
||||
if (localStorage.hasOwnProperty(stored)
|
||||
if (Object.prototype.hasOwnProperty.call(localStorage, stored)
|
||||
&& stored.substr(0, 14) === '-snap-project-') {
|
||||
name = stored.substr(14);
|
||||
dta = {
|
||||
|
|
10
locale.js
10
locale.js
|
@ -61,13 +61,16 @@ function Localizer(language, dict) {
|
|||
}
|
||||
|
||||
Localizer.prototype.translate = function (string) {
|
||||
return this.dict[this.language][string] || string;
|
||||
return Object.prototype.hasOwnProperty.call(
|
||||
this.dict[this.language],
|
||||
string
|
||||
) ? this.dict[this.language][string] || string;
|
||||
};
|
||||
|
||||
Localizer.prototype.languages = function () {
|
||||
var property, arr = [];
|
||||
for (property in this.dict) {
|
||||
if (this.dict.hasOwnProperty(property)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.dict, property)) {
|
||||
arr.push(property);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +103,8 @@ Localizer.prototype.unload = function () {
|
|||
if (lang !== 'en') {
|
||||
dict = myself.dict[lang];
|
||||
for (key in dict) {
|
||||
if (dict.hasOwnProperty(key) && !contains(keep, key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(dict, key)
|
||||
&& !contains(keep, key)) {
|
||||
delete dict[key];
|
||||
}
|
||||
}
|
||||
|
|
16
morphic.js
16
morphic.js
|
@ -1114,7 +1114,7 @@ function sizeOf(object) {
|
|||
// answer the number of own properties
|
||||
var size = 0, key;
|
||||
for (key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ function copy(target) {
|
|||
target.constructor !== Object) {
|
||||
c = clone(target.constructor.prototype);
|
||||
for (property in target) {
|
||||
if (target.hasOwnProperty(property)) {
|
||||
if (Object.prototype.hasOwnProperty.call(target, property)) {
|
||||
c[property] = target[property];
|
||||
}
|
||||
}
|
||||
|
@ -6202,7 +6202,10 @@ InspectorMorph.prototype.buildPanes = function () {
|
|||
[ // format element: [color, predicate(element]
|
||||
new Color(0, 0, 180),
|
||||
function (element) {
|
||||
return myself.target.hasOwnProperty(element);
|
||||
return Object.prototype.hasOwnProperty.call(
|
||||
myself.target,
|
||||
element
|
||||
);
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -9580,7 +9583,10 @@ HandMorph.prototype.processMouseScroll = function (event) {
|
|||
if (morph) {
|
||||
morph.mouseScroll(
|
||||
(event.detail / -3) || (
|
||||
event.hasOwnProperty('wheelDeltaY') ?
|
||||
Object.prototype.hasOwnProperty.call(
|
||||
event,
|
||||
'wheelDeltaY'
|
||||
) ?
|
||||
event.wheelDeltaY / 120 :
|
||||
event.wheelDelta / 120
|
||||
),
|
||||
|
@ -10500,7 +10506,7 @@ WorldMorph.prototype.about = function () {
|
|||
var versions = '', module;
|
||||
|
||||
for (module in modules) {
|
||||
if (modules.hasOwnProperty(module)) {
|
||||
if (Object.prototype.hasOwnProperty.call(modules, module)) {
|
||||
versions += ('\n' + module + ' (' + modules[module] + ')');
|
||||
}
|
||||
}
|
||||
|
|
77
store.js
77
store.js
|
@ -319,7 +319,8 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
|||
if (!project.name) {
|
||||
nameID = 1;
|
||||
while (
|
||||
localStorage.hasOwnProperty(
|
||||
Object.prototype.hasOwnProperty.call(
|
||||
localStorage,
|
||||
'-snap-project-Untitled ' + nameID
|
||||
)
|
||||
) {
|
||||
|
@ -339,7 +340,10 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
|||
model.stage = model.project.require('stage');
|
||||
StageMorph.prototype.frameRate = 0;
|
||||
project.stage = new StageMorph(project.globalVariables);
|
||||
if (model.stage.attributes.hasOwnProperty('id')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.stage.attributes,
|
||||
'id'
|
||||
)) {
|
||||
this.objects[model.stage.attributes.id] = project.stage;
|
||||
}
|
||||
if (model.stage.attributes.name) {
|
||||
|
@ -399,17 +403,24 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
|||
var watcher, color, target, hidden, extX, extY;
|
||||
|
||||
color = myself.loadColor(model.attributes.color);
|
||||
target = model.attributes.hasOwnProperty('scope') ?
|
||||
project.sprites[model.attributes.scope] : null;
|
||||
target = Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'scope'
|
||||
) ? project.sprites[model.attributes.scope] : null;
|
||||
|
||||
// determine whether the watcher is hidden, slightly
|
||||
// complicated to retain backward compatibility
|
||||
// with former tag format: hidden="hidden"
|
||||
// now it's: hidden="true"
|
||||
hidden = model.attributes.hasOwnProperty('hidden')
|
||||
&& (model.attributes.hidden !== 'false');
|
||||
hidden = Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'hidden'
|
||||
) && (model.attributes.hidden !== 'false');
|
||||
|
||||
if (model.attributes.hasOwnProperty('var')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'var'
|
||||
)) {
|
||||
watcher = new WatcherMorph(
|
||||
model.attributes['var'],
|
||||
color,
|
||||
|
@ -584,7 +595,10 @@ SnapSerializer.prototype.loadCostumes = function (object, model) {
|
|||
if (costumes) {
|
||||
object.costumes = this.loadValue(costumes.require('list'));
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('costume')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'costume'
|
||||
)) {
|
||||
costume = object.costumes.asArray()[model.attributes.costume - 1];
|
||||
if (costume) {
|
||||
if (costume.loaded) {
|
||||
|
@ -807,7 +821,10 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter) {
|
|||
// private
|
||||
var block, info, inputs, isGlobal, rm, receiver;
|
||||
if (model.tag === 'block') {
|
||||
if (model.attributes.hasOwnProperty('var')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'var'
|
||||
)) {
|
||||
return SpriteMorph.prototype.variableBlock(
|
||||
model.attributes['var']
|
||||
);
|
||||
|
@ -930,19 +947,28 @@ SnapSerializer.prototype.loadValue = function (model) {
|
|||
myself = this;
|
||||
|
||||
function record() {
|
||||
if (model.attributes.hasOwnProperty('id')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'id'
|
||||
)) {
|
||||
myself.objects[model.attributes.id] = v;
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'mediaID'
|
||||
)) {
|
||||
myself.mediaDict[model.attributes.mediaID] = v;
|
||||
}
|
||||
}
|
||||
switch (model.tag) {
|
||||
case 'ref':
|
||||
if (model.attributes.hasOwnProperty('id')) {
|
||||
if (Object.prototype.hasOwnProperty.call(model.attributes, 'id')) {
|
||||
return this.objects[model.attributes.id];
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'mediaID'
|
||||
)) {
|
||||
return this.mediaDict[model.attributes.mediaID];
|
||||
}
|
||||
throw new Error('expecting a reference id');
|
||||
|
@ -1060,16 +1086,28 @@ SnapSerializer.prototype.loadValue = function (model) {
|
|||
return v;
|
||||
case 'costume':
|
||||
center = new Point();
|
||||
if (model.attributes.hasOwnProperty('center-x')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'center-x'
|
||||
)) {
|
||||
center.x = parseFloat(model.attributes['center-x']);
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('center-y')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'center-y'
|
||||
)) {
|
||||
center.y = parseFloat(model.attributes['center-y']);
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('name')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'name'
|
||||
)) {
|
||||
name = model.attributes.name;
|
||||
}
|
||||
if (model.attributes.hasOwnProperty('image')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'image'
|
||||
)) {
|
||||
image = new Image();
|
||||
if (model.attributes.image.indexOf('data:image/svg+xml') === 0
|
||||
&& !MorphicPreferences.rasterizeSVGs) {
|
||||
|
@ -1108,7 +1146,10 @@ SnapSerializer.prototype.loadValue = function (model) {
|
|||
audio = new Audio();
|
||||
audio.src = model.attributes.sound;
|
||||
v = new Sound(audio, model.attributes.name);
|
||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
model.attributes,
|
||||
'mediaID'
|
||||
)) {
|
||||
myself.mediaDict[model.attributes.mediaID] = v;
|
||||
}
|
||||
return v;
|
||||
|
|
10
threads.js
10
threads.js
|
@ -1821,10 +1821,10 @@ Process.prototype.reportIsIdentical = function (a, b) {
|
|||
}
|
||||
|
||||
function clear() {
|
||||
if (a.hasOwnProperty(tag)) {
|
||||
if (Object.prototype.hasOwnProperty.call(a, tag)) {
|
||||
delete a[tag];
|
||||
}
|
||||
if (b.hasOwnProperty(tag)) {
|
||||
if (Object.prototype.hasOwnProperty.call(b, tag)) {
|
||||
delete b[tag];
|
||||
}
|
||||
}
|
||||
|
@ -2710,7 +2710,7 @@ VariableFrame.prototype.deleteVar = function (name) {
|
|||
VariableFrame.prototype.names = function () {
|
||||
var each, names = [];
|
||||
for (each in this.vars) {
|
||||
if (this.vars.hasOwnProperty(each)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.vars, each)) {
|
||||
names.push(each);
|
||||
}
|
||||
}
|
||||
|
@ -2723,7 +2723,7 @@ VariableFrame.prototype.allNamesDict = function () {
|
|||
function addKeysToDict(srcDict, trgtDict) {
|
||||
var eachKey;
|
||||
for (eachKey in srcDict) {
|
||||
if (srcDict.hasOwnProperty(eachKey)) {
|
||||
if (Object.prototype.hasOwnProperty.call(srcDict, eachKey)) {
|
||||
trgtDict[eachKey] = eachKey;
|
||||
}
|
||||
}
|
||||
|
@ -2744,7 +2744,7 @@ VariableFrame.prototype.allNames = function () {
|
|||
var answer = [], each, dict = this.allNamesDict();
|
||||
|
||||
for (each in dict) {
|
||||
if (dict.hasOwnProperty(each)) {
|
||||
if (Object.prototype.hasOwnProperty.call(dict, each)) {
|
||||
answer.push(each);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2776,7 +2776,7 @@ InputFieldMorph.prototype.dropDownMenu = function () {
|
|||
}
|
||||
menu.addItem(' ', null);
|
||||
for (key in choices) {
|
||||
if (choices.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(choices, key)) {
|
||||
if (key[0] === '~') {
|
||||
menu.addLine();
|
||||
} else {
|
||||
|
|
3
xml.js
3
xml.js
|
@ -246,7 +246,8 @@ XML_Element.prototype.toString = function (isFormatted, indentationLevel) {
|
|||
|
||||
// attributes, if any
|
||||
for (key in this.attributes) {
|
||||
if (this.attributes.hasOwnProperty(key) && this.attributes[key]) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.attributes, key)
|
||||
&& this.attributes[key]) {
|
||||
result += ' ' + key + '="' + this.attributes[key] + '"';
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue