# HG changeset patch # User Nicholas Jillings # Date 1458573340 0 # Node ID bb2526dacfadbb07aa7ce47aac774b117460a347 # Parent e87c51088e1ef5a98565036ddcc753e807bd25f1 Moved returnDateNode() into interfaceContext. returnDateNode no longer uses deprecated Attribute Objects. diff -r e87c51088e1e -r bb2526dacfad core.js --- a/core.js Mon Mar 21 15:01:57 2016 +0000 +++ b/core.js Mon Mar 21 15:15:40 2016 +0000 @@ -1765,48 +1765,6 @@ return holdArr; } -function returnDateNode() -{ - // Create an XML Node for the Date and Time a test was conducted - // Structure is - // - // DD/MM/YY - // - // - var dateTime = new Date(); - var year = document.createAttribute('year'); - var month = document.createAttribute('month'); - var day = document.createAttribute('day'); - var hour = document.createAttribute('hour'); - var minute = document.createAttribute('minute'); - var secs = document.createAttribute('secs'); - - year.nodeValue = dateTime.getFullYear(); - month.nodeValue = dateTime.getMonth()+1; - day.nodeValue = dateTime.getDate(); - hour.nodeValue = dateTime.getHours(); - minute.nodeValue = dateTime.getMinutes(); - secs.nodeValue = dateTime.getSeconds(); - - var hold = document.createElement("datetime"); - var date = document.createElement("date"); - date.textContent = year.nodeValue+'/'+month.nodeValue+'/'+day.nodeValue; - var time = document.createElement("time"); - time.textContent = hour.nodeValue+':'+minute.nodeValue+':'+secs.nodeValue; - - date.setAttributeNode(year); - date.setAttributeNode(month); - date.setAttributeNode(day); - time.setAttributeNode(hour); - time.setAttributeNode(minute); - time.setAttributeNode(secs); - - hold.appendChild(date); - hold.appendChild(time); - return hold; - -} - function Specification() { // Handles the decoding of the project specification XML into a simple JavaScript Object. @@ -2489,6 +2447,31 @@ node.appendChild(screen); return node; }; + + this.returnDateNode = function() + { + // Create an XML Node for the Date and Time a test was conducted + // Structure is + // + // DD/MM/YY + // + // + var dateTime = new Date(); + var hold = storage.document.createElement("datetime"); + var date = storage.document.createElement("date"); + var time = storage.document.createElement("time"); + date.setAttribute('year',dateTime.getFullYear()); + date.setAttribute('month',dateTime.getMonth()+1); + date.setAttribute('day',dateTime.getDate()); + time.setAttribute('hour',dateTime.getHours()); + time.setAttribute('minute',dateTime.getMinutes); + time.setAttribute('secs',dateTime.getSeconds()); + + hold.appendChild(date); + hold.appendChild(time); + return hold; + + } this.commentBoxes = new function() { this.boxes = []; @@ -3189,7 +3172,7 @@ var projectDocument = specification.projectXML; projectDocument.setAttribute('file-name',url); this.root.appendChild(projectDocument); - this.root.appendChild(returnDateNode()); + this.root.appendChild(interfaceContext.returnDateNode()); this.root.appendChild(interfaceContext.returnNavigator()); } else { this.document = existingStore;