(sorta, load project anyway even though costumes / sounds are missing)
The cause for this defect is usually prior use of IE when saving a project
pull/68/head
jmoenig 2018-11-12 09:32:07 +01:00
rodzic accbc5c2f2
commit 82543618ee
4 zmienionych plików z 34 dodań i 10 usunięć

Wyświetl plik

@ -6,6 +6,7 @@
* BYOB: updated version date
* Objects: fixed #2250
* Frequency Distribution Analysis library: added "pipe" and "lower case" blocks
* Store, XML: fixed #2251 (sorta, load project anyway even though costumes / sounds are missing)
## v4.2.2.6
###2018-11-06

Wyświetl plik

@ -16,8 +16,8 @@
<script type="text/javascript" src="src/tables.js?version=2018-10-02"></script>
<script type="text/javascript" src="src/symbols.js?version=2018-10-02"></script>
<script type="text/javascript" src="src/sketch.js?version=2018-10-02"></script>
<script type="text/javascript" src="src/xml.js?version=2018-10-02"></script>
<script type="text/javascript" src="src/store.js?version=2018-10-05"></script>
<script type="text/javascript" src="src/xml.js?version=2018-11-12"></script>
<script type="text/javascript" src="src/store.js?version=2018-11-12"></script>
<script type="text/javascript" src="src/locale.js?version=2018-11-06"></script>
<script type="text/javascript" src="src/cloud.js?version=2018-10-04"></script>
<script type="text/javascript" src="src/sha512.js?version=2018-10-02"></script>

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2018-October-05';
modules.store = '2018-November-12';
// XML_Serializer ///////////////////////////////////////////////////////
@ -819,7 +819,14 @@ SnapSerializer.prototype.loadCostumes = function (object, model) {
var costumes = model.childNamed('costumes'),
costume;
if (costumes) {
object.costumes = this.loadValue(costumes.require('list'));
object.costumes = this.loadValue(costumes.require(
'list',
function () {
console.log(object.name + ': missing required costumes list, ' +
'improvising...');
return new XML_Element('list');
}
));
object.costumes.type = 'costume';
}
if (Object.prototype.hasOwnProperty.call(
@ -844,7 +851,16 @@ SnapSerializer.prototype.loadSounds = function (object, model) {
// private
var sounds = model.childNamed('sounds');
if (sounds) {
object.sounds = this.loadValue(sounds.require('list'));
// object.sounds = this.loadValue(sounds.require('list')); +++
object.sounds = this.loadValue(sounds.require(
'list',
function () {
console.log(object.name + ': missing required sounds list, ' +
'improvising...');
return new XML_Element('list');
}
));
object.sounds.type = 'sound';
}
};

Wyświetl plik

@ -7,7 +7,7 @@
written by Jens Mönig
jens@moenig.org
Copyright (C) 2015 by Jens Mönig
Copyright (C) 2018 by Jens Mönig
This file is part of Snap!.
@ -67,7 +67,7 @@
// Global stuff ////////////////////////////////////////////////////////
modules.xml = '2017-November-15';
modules.xml = '2018-November-12';
// Declarations
@ -178,11 +178,18 @@ XML_Element.prototype.init = function (tag, contents, parent) {
// XML_Element DOM navigation: (aside from what's inherited from Node)
XML_Element.prototype.require = function (tagName) {
// answer the first direct child with the specified tagName, or throw
// an error if it doesn't exist
XML_Element.prototype.require = function (tagName, fallback) { // +++
// answer the first direct child with the specified tagName.
// if it doesn't exist execute the fallback function or return the
// fallback value, otherwise throw an error
var child = this.childNamed(tagName);
if (!child) {
if (fallback instanceof Function) {
return fallback();
}
if (!isNil(fallback)) {
return fallback;
}
throw new Error('Missing required element <' + tagName + '>!');
}
return child;