1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 14:57:52 +00:00

Set property instead of set attribute

This commit resolves an issue with Safari not properly selecting an `<option>`.

Closes #17866.
PR #19024.
This commit is contained in:
Jimmy Axenhus 2023-08-03 07:34:24 +02:00 committed by GitHub
parent e68cf87f05
commit c4ed40b82f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -173,7 +173,7 @@ window.qBittorrent.PropFiles = (function() {
elem.set('value', priority.toString()); elem.set('value', priority.toString());
elem.set('html', html); elem.set('html', html);
if (selected) if (selected)
elem.setAttribute('selected', ''); elem.selected = true;
return elem; return elem;
}; };
@ -210,9 +210,9 @@ window.qBittorrent.PropFiles = (function() {
for (let i = 0; i < options.length; ++i) { for (let i = 0; i < options.length; ++i) {
const option = options[i]; const option = options[i];
if (parseInt(option.value) === priority) if (parseInt(option.value) === priority)
option.setAttribute('selected', ''); option.selected = true;
else else
option.removeAttribute('selected'); option.selected = false;
} }
combobox.value = priority; combobox.value = priority;

View File

@ -191,10 +191,10 @@
const init = () => { const init = () => {
$('logLevelSelect').getElements('option').each((x) => { $('logLevelSelect').getElements('option').each((x) => {
if (selectedLogLevels.indexOf(x.value.toString()) !== -1) { if (selectedLogLevels.indexOf(x.value.toString()) !== -1) {
x.setAttribute('selected', ''); x.selected = true;
} }
else { else {
x.removeAttribute('selected'); x.selected = false;
} }
}); });

View File

@ -1887,7 +1887,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
index = 2; index = 2;
break; break;
} }
$('contentlayout_select').getChildren('option')[index].setAttribute('selected', ''); $('contentlayout_select').getChildren('option')[index].selected = true;
$('addToTopOfQueueCheckbox').setProperty('checked', pref.add_to_top_of_queue); $('addToTopOfQueueCheckbox').setProperty('checked', pref.add_to_top_of_queue);
$('dontstartdownloads_checkbox').setProperty('checked', pref.start_paused_enabled); $('dontstartdownloads_checkbox').setProperty('checked', pref.start_paused_enabled);
switch (pref.torrent_stop_condition) { switch (pref.torrent_stop_condition) {
@ -1901,7 +1901,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
index = 2; index = 2;
break; break;
} }
$('stopConditionSelect').getChildren('option')[index].setAttribute('selected', ''); $('stopConditionSelect').getChildren('option')[index].selected = true;
$('deletetorrentfileafter_checkbox').setProperty('checked', pref.auto_delete_mode); $('deletetorrentfileafter_checkbox').setProperty('checked', pref.auto_delete_mode);
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all); $('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
@ -2072,7 +2072,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
$('pex_checkbox').setProperty('checked', pref.pex); $('pex_checkbox').setProperty('checked', pref.pex);
$('lsd_checkbox').setProperty('checked', pref.lsd); $('lsd_checkbox').setProperty('checked', pref.lsd);
const encryption = pref.encryption.toInt(); const encryption = pref.encryption.toInt();
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', ''); $('encryption_select').getChildren('option')[encryption].selected = true;
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode); $('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
$('maxActiveCheckingTorrents').setProperty('value', pref.max_active_checking_torrents); $('maxActiveCheckingTorrents').setProperty('value', pref.max_active_checking_torrents);
@ -2111,7 +2111,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
maxRatioAct = 2; maxRatioAct = 2;
break; break;
} }
$('max_ratio_act').getChildren('option')[maxRatioAct].setAttribute('selected', ''); $('max_ratio_act').getChildren('option')[maxRatioAct].selected = true;
updateMaxRatioTimeEnabled(); updateMaxRatioTimeEnabled();
// Add trackers // Add trackers