Mercurial > hg > webaudioevaluationtool
comparison js/specification.js @ 3036:ae0950bc1c99
Close #218. Added to test_create.
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 26 Sep 2017 11:22:47 +0100 |
parents | 49eca76782d2 |
children | e441e3d5c7e7 |
comparison
equal
deleted
inserted
replaced
3035:1620cbee9111 | 3036:ae0950bc1c99 |
---|---|
702 | 702 |
703 for (i = 0; i < this.audioElements.length; i++) { | 703 for (i = 0; i < this.audioElements.length; i++) { |
704 AHNode.appendChild(this.audioElements[i].encode(root)); | 704 AHNode.appendChild(this.audioElements[i].encode(root)); |
705 } | 705 } |
706 // Create <CommentQuestion> | 706 // Create <CommentQuestion> |
707 for (i = 0; i < this.commentQuestions.length; i++) { | 707 if (this.commentQuestions.length > 0) { |
708 AHNode.appendChild(this.commentQuestions[i].encode(root)); | 708 var node = root.createElement("commentquestions"); |
709 for (i = 0; i < this.commentQuestions.length; i++) { | |
710 node.appendChild(this.commentQuestions[i].encode(root)); | |
711 } | |
712 AHNode.appendChild(node); | |
709 } | 713 } |
710 | 714 |
711 AHNode.appendChild(this.preTest.encode(root)); | 715 AHNode.appendChild(this.preTest.encode(root)); |
712 AHNode.appendChild(this.postTest.encode(root)); | 716 AHNode.appendChild(this.postTest.encode(root)); |
713 return AHNode; | 717 return AHNode; |
802 break; | 806 break; |
803 default: | 807 default: |
804 throw ("Unknown type " + this.type); | 808 throw ("Unknown type " + this.type); |
805 } | 809 } |
806 node.id = this.id; | 810 node.id = this.id; |
811 node.setAttribute("mandatory", this.mandatory); | |
807 node.setAttribute("type", this.type); | 812 node.setAttribute("type", this.type); |
808 if (this.name !== undefined) { | 813 if (this.name !== undefined) { |
809 node.setAttribute("name", this.name); | 814 node.setAttribute("name", this.name); |
810 } | 815 } |
811 var statement = root.createElement("statement"); | 816 var statement = root.createElement("statement"); |