# HG changeset patch # User Nicholas Jillings # Date 1464275220 -3600 # Node ID 2f6a1f510ade2f85d0a99d05082a2f74c61bf624 # Parent f595f5f5a7b9665acc637a124d4d96bde502a0ea# Parent 5d7ad658c69950cf2941f4072bf5f007ef6e8c47 Merge branch 'master' into Dev_main diff -r f595f5f5a7b9 -r 2f6a1f510ade js/core.js --- a/js/core.js Thu May 26 15:55:00 2016 +0100 +++ b/js/core.js Thu May 26 16:07:00 2016 +0100 @@ -1095,19 +1095,23 @@ { this.currentStateMap = this.stateMap[this.stateIndex]; // Find and extract the outside reference - var elements = [], ref = null; - for (var elem of this.currentStateMap.audioElements) { - if (elem.type == "outside-reference") {ref = elem;} - else {elements.push(elem);} + var elements = [], ref = []; + var elem; + while(elem = this.currentStateMap.audioElements.pop()) + { + if (elem.type == "outside-reference") { + ref.push(elem); + } + else { + elements.push(elem); + } } if (this.currentStateMap.randomiseOrder) { - this.currentStateMap.audioElements = randomiseOrder(elements); + elements = randomiseOrder(elements); } - if (ref != null) - { - this.currentStateMap.audioElements.push(ref); - } + this.currentStateMap.audioElements = elements.concat(ref); + this.currentStore = storage.testPages[this.stateIndex]; if (this.currentStateMap.preTest != null) { diff -r f595f5f5a7b9 -r 2f6a1f510ade js/specification.js --- a/js/specification.js Thu May 26 15:55:00 2016 +0100 +++ b/js/specification.js Thu May 26 16:07:00 2016 +0100 @@ -163,7 +163,7 @@ this.encode = function() { var RootDocument = document.implementation.createDocument(null,"waet"); - var root = RootDocument.children[0]; + var root = RootDocument.firstChild; root.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"); root.setAttribute("xsi:noNamespaceSchemaLocation","test-schema.xsd"); // Build setup node