mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-30438 Lesson Module: fixed input text editable capability after checking/unchecking unmask option
This commit is contained in:
parent
41e2a9591f
commit
3bd18935d7
@ -1063,34 +1063,46 @@ function findChildNodes(start, tagName, elementClass, elementID, elementName) {
|
||||
}
|
||||
|
||||
function unmaskPassword(id) {
|
||||
var pw = document.getElementById(id);
|
||||
var chb = document.getElementById(id+'unmask');
|
||||
var pw = document.getElementById(id);
|
||||
var chb = document.getElementById(id+'unmask');
|
||||
|
||||
try {
|
||||
// first try IE way - it can not set name attribute later
|
||||
if (chb.checked) {
|
||||
var newpw = document.createElement('<input type="text" autocomplete="off" name="'+pw.name+'">');
|
||||
} else {
|
||||
var newpw = document.createElement('<input type="password" autocomplete="off" name="'+pw.name+'">');
|
||||
// MDL-30438 - The capability to changing the value of input type is not supported by IE8 or lower.
|
||||
// Replacing existing child with a new one, removed all yui properties for the node. Therefore, this
|
||||
// functionality won't work in IE8 or lower.
|
||||
// This is a temporary fixed to allow other browsers to function properly.
|
||||
if (Y.UA.ie == 0 || Y.UA.ie >= 9) {
|
||||
if (chb.checked) {
|
||||
pw.type = "text";
|
||||
} else {
|
||||
pw.type = "password";
|
||||
}
|
||||
} else { //IE Browser version 8 or lower
|
||||
try {
|
||||
// first try IE way - it can not set name attribute later
|
||||
if (chb.checked) {
|
||||
var newpw = document.createElement('<input type="text" autocomplete="off" name="'+pw.name+'">');
|
||||
} else {
|
||||
var newpw = document.createElement('<input type="password" autocomplete="off" name="'+pw.name+'">');
|
||||
}
|
||||
newpw.attributes['class'].nodeValue = pw.attributes['class'].nodeValue;
|
||||
} catch (e) {
|
||||
var newpw = document.createElement('input');
|
||||
newpw.setAttribute('autocomplete', 'off');
|
||||
newpw.setAttribute('name', pw.name);
|
||||
if (chb.checked) {
|
||||
newpw.setAttribute('type', 'text');
|
||||
} else {
|
||||
newpw.setAttribute('type', 'password');
|
||||
}
|
||||
newpw.setAttribute('class', pw.getAttribute('class'));
|
||||
}
|
||||
newpw.id = pw.id;
|
||||
newpw.size = pw.size;
|
||||
newpw.onblur = pw.onblur;
|
||||
newpw.onchange = pw.onchange;
|
||||
newpw.value = pw.value;
|
||||
pw.parentNode.replaceChild(newpw, pw);
|
||||
}
|
||||
newpw.attributes['class'].nodeValue = pw.attributes['class'].nodeValue;
|
||||
} catch (e) {
|
||||
var newpw = document.createElement('input');
|
||||
newpw.setAttribute('autocomplete', 'off');
|
||||
newpw.setAttribute('name', pw.name);
|
||||
if (chb.checked) {
|
||||
newpw.setAttribute('type', 'text');
|
||||
} else {
|
||||
newpw.setAttribute('type', 'password');
|
||||
}
|
||||
newpw.setAttribute('class', pw.getAttribute('class'));
|
||||
}
|
||||
newpw.id = pw.id;
|
||||
newpw.size = pw.size;
|
||||
newpw.onblur = pw.onblur;
|
||||
newpw.onchange = pw.onchange;
|
||||
newpw.value = pw.value;
|
||||
pw.parentNode.replaceChild(newpw, pw);
|
||||
}
|
||||
|
||||
function filterByParent(elCollection, parentFinder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user