Преглед изворни кода

#8331 Maximize browser compatibility

mathieu-mp пре 4 година
родитељ
комит
60f48326e1

+ 4 - 4
netbox/project-static/src/select/api/apiSelect.ts

@@ -461,7 +461,7 @@ export class APISelect {
       // Set any primitive k/v pairs as data attributes on each option.
       for (const [k, v] of Object.entries(result)) {
         if (!['id', 'slug'].includes(k) && ['string', 'number', 'boolean'].includes(typeof v)) {
-          const key = k.replaceAll('_', '-');
+          const key = k.replace(/_/g, '-');
           data[key] = String(v);
         }
         // Set option to disabled if the result contains a matching key and is truthy.
@@ -659,7 +659,7 @@ export class APISelect {
     for (const [key, value] of this.pathValues.entries()) {
       for (const result of this.url.matchAll(new RegExp(`({{${key}}})`, 'g'))) {
         if (isTruthy(value)) {
-          url = url.replaceAll(result[1], value.toString());
+          url = url.replace(result[1], value.toString());
         }
       }
     }
@@ -741,7 +741,7 @@ export class APISelect {
    * @param id DOM ID of the other element.
    */
   private updatePathValues(id: string): void {
-    const key = id.replaceAll(/^id_/gi, '');
+    const key = id.replace(/^id_/gi, '');
     const element = getElement<HTMLSelectElement>(`id_${key}`);
     if (element !== null) {
       // If this element's URL contains Django template tags ({{), replace the template tag
@@ -927,7 +927,7 @@ export class APISelect {
     color: ${fg} !important;
   }
               `
-          .replaceAll('\n', '')
+          .replace(/\n/g, '')
           .trim();
 
         // Add the style element to the DOM.

+ 2 - 2
netbox/project-static/src/tables/interfaceTable.ts

@@ -105,9 +105,9 @@ class ButtonState {
    */
   private toggleButton(): void {
     if (this.buttonState === 'show') {
-      this.button.innerText = this.button.innerText.replaceAll('Show', 'Hide');
+      this.button.innerText = this.button.innerText.replace(/Show/g, 'Hide');
     } else if (this.buttonState === 'hide') {
-      this.button.innerText = this.button.innerText.replaceAll('Hide', 'Show');
+      this.button.innerText = this.button.innerText.replace(/Hide/g, 'Show');
     }
   }
 

+ 1 - 1
netbox/project-static/src/util.ts

@@ -315,7 +315,7 @@ export function* getRowValues(table: HTMLTableRowElement): Generator<string> {
   for (const element of table.querySelectorAll<HTMLTableCellElement>('td')) {
     if (element !== null) {
       if (isTruthy(element.innerText) && element.innerText !== '—') {
-        yield element.innerText.replaceAll(/[\n\r]/g, '').trim();
+        yield element.innerText.replace(/[\n\r]/g, '').trim();
       }
     }
   }