comparison test_create/test_core.js @ 2109:3bbb357004e4

Started Bug #1604: New test dialog windows now use <label> instead of span.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 22 Feb 2016 14:20:50 +0000
parents b65c4941fc1f
children 27be75c51b5c
comparison
equal deleted inserted replaced
2108:b65c4941fc1f 2109:3bbb357004e4
334 } else { 334 } else {
335 testNode = undefined; 335 testNode = undefined;
336 } 336 }
337 var obj = { 337 var obj = {
338 root: document.createElement("div"), 338 root: document.createElement("div"),
339 text: document.createElement("span"), 339 text: document.createElement("label"),
340 input: document.createElement("input"), 340 input: document.createElement("input"),
341 parent: this, 341 parent: this,
342 name: checkName, 342 name: checkName,
343 handleEvent: function(event) { 343 handleEvent: function(event) {
344 if (this.input.checked) { 344 if (this.input.checked) {
362 } 362 }
363 363
364 obj.input.addEventListener("click",obj); 364 obj.input.addEventListener("click",obj);
365 obj.root.className = "popup-checkbox"; 365 obj.root.className = "popup-checkbox";
366 obj.input.type = "checkbox"; 366 obj.input.type = "checkbox";
367 obj.input.setAttribute('name',checkName); 367 obj.input.setAttribute('id',checkName);
368 obj.text.setAttribute("for",checkName);
368 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent; 369 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
369 obj.root.appendChild(obj.input); 370 obj.root.appendChild(obj.input);
370 obj.root.appendChild(obj.text); 371 obj.root.appendChild(obj.text);
371 if(testNode != undefined) 372 if(testNode != undefined)
372 { 373 {
460 } else { 461 } else {
461 testNode = undefined; 462 testNode = undefined;
462 } 463 }
463 var obj = { 464 var obj = {
464 root: document.createElement("div"), 465 root: document.createElement("div"),
465 text: document.createElement("span"), 466 text: document.createElement("label"),
466 input: document.createElement("input"), 467 input: document.createElement("input"),
467 parent: this, 468 parent: this,
468 name: checkName, 469 name: checkName,
469 handleEvent: function(event) { 470 handleEvent: function(event) {
470 if (this.input.checked) { 471 if (this.input.checked) {
488 } 489 }
489 490
490 obj.input.addEventListener("click",obj); 491 obj.input.addEventListener("click",obj);
491 obj.root.className = "popup-checkbox"; 492 obj.root.className = "popup-checkbox";
492 obj.input.type = "checkbox"; 493 obj.input.type = "checkbox";
493 obj.input.setAttribute('name',checkName); 494 obj.input.setAttribute('id',checkName);
495 obj.text.setAttribute("for",checkName);
494 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent; 496 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
495 obj.root.appendChild(obj.input); 497 obj.root.appendChild(obj.input);
496 obj.root.appendChild(obj.text); 498 obj.root.appendChild(obj.text);
497 if(testNode != undefined) 499 if(testNode != undefined)
498 { 500 {
586 } else { 588 } else {
587 testNode = undefined; 589 testNode = undefined;
588 } 590 }
589 var obj = { 591 var obj = {
590 root: document.createElement("div"), 592 root: document.createElement("div"),
591 text: document.createElement("span"), 593 text: document.createElement("label"),
592 input: document.createElement("input"), 594 input: document.createElement("input"),
593 parent: this, 595 parent: this,
594 name: checkName, 596 name: checkName,
595 handleEvent: function(event) { 597 handleEvent: function(event) {
596 if (this.input.checked) { 598 if (this.input.checked) {
614 } 616 }
615 617
616 obj.input.addEventListener("click",obj); 618 obj.input.addEventListener("click",obj);
617 obj.root.className = "popup-checkbox"; 619 obj.root.className = "popup-checkbox";
618 obj.input.type = "checkbox"; 620 obj.input.type = "checkbox";
619 obj.input.setAttribute('name',checkName); 621 obj.input.setAttribute('id',checkName);
622 obj.text.setAttribute("for",checkName);
620 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent; 623 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
621 obj.root.appendChild(obj.input); 624 obj.root.appendChild(obj.input);
622 obj.root.appendChild(obj.text); 625 obj.root.appendChild(obj.text);
623 if(testNode != undefined) 626 if(testNode != undefined)
624 { 627 {