changeset 1903:bb2526dacfad

Moved returnDateNode() into interfaceContext. returnDateNode no longer uses deprecated Attribute Objects.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 21 Mar 2016 15:15:40 +0000
parents e87c51088e1e
children ce2af603962d
files core.js
diffstat 1 files changed, 26 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- 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
-	// <datetime> 
-	//	<date year="##" month="##" day="##">DD/MM/YY</date>
-	//	<time hour="##" minute="##" sec="##">HH:MM:SS</time>
-	// </datetime>
-	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
+        // <datetime> 
+        //	<date year="##" month="##" day="##">DD/MM/YY</date>
+        //	<time hour="##" minute="##" sec="##">HH:MM:SS</time>
+        // </datetime>
+        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;