1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #7075: Wrap label selectors in quotes to ensure IDs with spaces are properly selected

This commit is contained in:
thatmattlove
2021-08-30 17:48:33 -07:00
parent bf05bc2986
commit db2993035d
4 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -715,7 +715,7 @@ export class APISelect {
private getPlaceholder(): string {
let placeholder = this.name;
if (this.base.id) {
const label = document.querySelector(`label[for=${this.base.id}]`) as HTMLLabelElement;
const label = document.querySelector(`label[for="${this.base.id}"]`) as HTMLLabelElement;
// Set the placeholder text to the label value, if it exists.
if (label !== null) {
placeholder = `Select ${label.innerText.trim()}`;

View File

@ -4,7 +4,7 @@ import { getElements } from '../util';
export function initStaticSelect(): void {
for (const select of getElements<HTMLSelectElement>('.netbox-static-select')) {
if (select !== null) {
const label = document.querySelector(`label[for=${select.id}]`) as HTMLLabelElement;
const label = document.querySelector(`label[for="${select.id}"]`) as HTMLLabelElement;
let placeholder;
if (label !== null) {