mirror of https://git.48k.eu/ogcp
Replace "." with "_" in HTML scopes IDs
Otherwise, scopes with dots in their names breaks the javascript code. From https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id: --- Note: Technically, in HTML5, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used and the value for an id attribute should start with a letter. For example, . has a special meaning in CSS (it acts as a class selector). Unless you are careful to escape it in the CSS, it won't be recognized as part of the value of an id attribute. It is easy to forget to do this, resulting in bugs in your code that could be hard to detect. ---multi-ogserver
parent
23d9799e09
commit
500d92007f
|
@ -107,7 +107,7 @@ function updateScopeState() {
|
|||
function updateScopes(scopes) {
|
||||
scopes.forEach((scope) => {
|
||||
if (scope.state) {
|
||||
const scopeId = `${scope.name}_${scope.id}`;
|
||||
const scopeId = `${scope.name}_${scope.id}`.replaceAll('.', '_');
|
||||
const iconEl = document.querySelector(`#${scopeId} .nav-icon`);
|
||||
const iconCls = ['fas', 'far', 'text-danger', 'text-success',
|
||||
'text-warning', 'text-wol'];
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
{% macro scopes_tree_collapse_level(scopes, i, parent_id) -%}
|
||||
{% for scope in scopes %}
|
||||
<li id="{{ scope["name"] }}_{{ scope["id"] }}" class="nav-item">
|
||||
<li id="{{ scope["name"]|replace(".", "_") }}_{{ scope["id"] }}" class="nav-item">
|
||||
{% if " ".join(scope["ip"]) %}
|
||||
<input class="form-check-input" type="checkbox" form="scopesForm"
|
||||
value="{{ " ".join(scope["ip"]) }}"
|
||||
|
|
Loading…
Reference in New Issue