comparison test_create/test_core.js @ 2565:bc6edd2c8772

Completed #5
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 08 Sep 2016 11:05:23 +0100
parents 26045169b4b5
children 172c76d9414b
comparison
equal deleted inserted replaced
2564:26045169b4b5 2565:bc6edd2c8772
2009 2009
2010 this.deleteNode = { 2010 this.deleteNode = {
2011 root: document.createElement("button"), 2011 root: document.createElement("button"),
2012 parent: this, 2012 parent: this,
2013 handleEvent: function(event) { 2013 handleEvent: function(event) {
2014 this.root.parentElement.removeChild(this.root); 2014 this.parent.parent.childrenDOM.removeChild(this.parent.rootDOM);
2015 this.parent.parent.addConditional.root.disabled = false; 2015 this.parent.parent.addConditional.root.disabled = false;
2016 var index = this.parent.parent.children.findIndex(function(element){ 2016 var index = this.parent.parent.children.findIndex(function(element){
2017 if (this == element) {return true;} return false; 2017 if (this == element) {return true;} return false;
2018 },this.parent); 2018 },this.parent);
2019 if (index >= 0) { 2019 if (index >= 0) {
2020 this.parent.parent.children.splice(index,1); 2020 this.parent.parent.children.splice(index,1);
2021 }
2022 index = this.parent.parent.specification.conditions.findIndex(function(element){
2023 if (this == element) {return true;} return false;
2024 },this.parent.specification);
2025 if (index >= 0) {
2026 this.parent.parent.specification.conditions.splice(index);
2021 } 2027 }
2022 } 2028 }
2023 } 2029 }
2024 this.deleteNode.root.textContent = "Delete"; 2030 this.deleteNode.root.textContent = "Delete";
2025 this.deleteNode.root.addEventListener("click",this.deleteNode); 2031 this.deleteNode.root.addEventListener("click",this.deleteNode);