Fixed #31028 -- Used classList API to check, add and remove DOM classes.
Thanks to Claude Paroz for review.
This commit is contained in:
parent
c8bd37a860
commit
46a0edc3ba
|
@ -26,10 +26,10 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
|
|
||||||
var ps = from_box.parentNode.getElementsByTagName('p');
|
var ps = from_box.parentNode.getElementsByTagName('p');
|
||||||
for (var i = 0; i < ps.length; i++) {
|
for (var i = 0; i < ps.length; i++) {
|
||||||
if (ps[i].className.indexOf("info") !== -1) {
|
if (ps[i].classList.contains("info")) {
|
||||||
// Remove <p class="info">, because it just gets in the way.
|
// Remove <p class="info">, because it just gets in the way.
|
||||||
from_box.parentNode.removeChild(ps[i]);
|
from_box.parentNode.removeChild(ps[i]);
|
||||||
} else if (ps[i].className.indexOf("help") !== -1) {
|
} else if (ps[i].classList.contains("help")) {
|
||||||
// Move help text up to the top so it isn't below the select
|
// Move help text up to the top so it isn't below the select
|
||||||
// boxes or wrapped off on the side to the right of the add
|
// boxes or wrapped off on the side to the right of the add
|
||||||
// button:
|
// button:
|
||||||
|
@ -112,7 +112,7 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
|
|
||||||
// Set up the JavaScript event handlers for the select box filter interface
|
// Set up the JavaScript event handlers for the select box filter interface
|
||||||
var move_selection = function(e, elem, move_func, from, to) {
|
var move_selection = function(e, elem, move_func, from, to) {
|
||||||
if (elem.className.indexOf('active') !== -1) {
|
if (elem.classList.contains('active')) {
|
||||||
move_func(from, to);
|
move_func(from, to);
|
||||||
SelectFilter.refresh_icons(field_id);
|
SelectFilter.refresh_icons(field_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
var inputs = document.getElementsByTagName('input');
|
var inputs = document.getElementsByTagName('input');
|
||||||
for (var i = 0; i < inputs.length; i++) {
|
for (var i = 0; i < inputs.length; i++) {
|
||||||
var inp = inputs[i];
|
var inp = inputs[i];
|
||||||
if (inp.type === 'text' && inp.className.match(/vTimeField/)) {
|
if (inp.type === 'text' && inp.classList.contains('vTimeField')) {
|
||||||
DateTimeShortcuts.addClock(inp);
|
DateTimeShortcuts.addClock(inp);
|
||||||
DateTimeShortcuts.addTimezoneWarning(inp);
|
DateTimeShortcuts.addTimezoneWarning(inp);
|
||||||
}
|
}
|
||||||
else if (inp.type === 'text' && inp.className.match(/vDateField/)) {
|
else if (inp.type === 'text' && inp.classList.contains('vDateField')) {
|
||||||
DateTimeShortcuts.addCalendar(inp);
|
DateTimeShortcuts.addCalendar(inp);
|
||||||
DateTimeShortcuts.addTimezoneWarning(inp);
|
DateTimeShortcuts.addTimezoneWarning(inp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
function dismissRelatedLookupPopup(win, chosenId) {
|
function dismissRelatedLookupPopup(win, chosenId) {
|
||||||
var name = windowname_to_id(win.name);
|
var name = windowname_to_id(win.name);
|
||||||
var elem = document.getElementById(name);
|
var elem = document.getElementById(name);
|
||||||
if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
|
if (elem.classList.contains('vManyToManyRawIdAdminField') && elem.value) {
|
||||||
elem.value += ',' + chosenId;
|
elem.value += ',' + chosenId;
|
||||||
} else {
|
} else {
|
||||||
document.getElementById(name).value = chosenId;
|
document.getElementById(name).value = chosenId;
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
if (elemName === 'SELECT') {
|
if (elemName === 'SELECT') {
|
||||||
elem.options[elem.options.length] = new Option(newRepr, newId, true, true);
|
elem.options[elem.options.length] = new Option(newRepr, newId, true, true);
|
||||||
} else if (elemName === 'INPUT') {
|
} else if (elemName === 'INPUT') {
|
||||||
if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
|
if (elem.classList.contains('vManyToManyRawIdAdminField') && elem.value) {
|
||||||
elem.value += ',' + newId;
|
elem.value += ',' + newId;
|
||||||
} else {
|
} else {
|
||||||
elem.value = newId;
|
elem.value = newId;
|
||||||
|
|
|
@ -8,7 +8,7 @@ var GeometryTypeControl = function(opt_options) {
|
||||||
var element = document.createElement('div');
|
var element = document.createElement('div');
|
||||||
element.className = 'switch-type type-' + options.type + ' ol-control ol-unselectable';
|
element.className = 'switch-type type-' + options.type + ' ol-control ol-unselectable';
|
||||||
if (options.active) {
|
if (options.active) {
|
||||||
element.className += " type-active";
|
element.classList.add("type-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -21,10 +21,9 @@ var GeometryTypeControl = function(opt_options) {
|
||||||
type: options.type
|
type: options.type
|
||||||
});
|
});
|
||||||
options.widget.map.addInteraction(options.widget.interactions.draw);
|
options.widget.map.addInteraction(options.widget.interactions.draw);
|
||||||
var className = options.widget.currentGeometryType.element.className.replace(/ type-active/g, '');
|
options.widget.currentGeometryType.element.classList.remove('type-active');
|
||||||
options.widget.currentGeometryType.element.className = className;
|
|
||||||
options.widget.currentGeometryType = self;
|
options.widget.currentGeometryType = self;
|
||||||
element.className += " type-active";
|
element.classList.add("type-active");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue