Fix #1429 - Use basic-devtools module (#1430)

This MR brings in `$`, `$$`, and `$x` browsers devtools' utilities to our code so we can use these whenever we find it convenient.
This commit is contained in:
Andrea Giammarchi
2023-05-02 15:12:28 +02:00
committed by GitHub
parent 3a66be585f
commit 82613d016a
11 changed files with 47 additions and 27 deletions

View File

@@ -1,3 +1,5 @@
import { $$ } from 'basic-devtools';
import { _createAlertBanner } from './exceptions';
export function addClasses(element: HTMLElement, classes: string[]) {
@@ -101,7 +103,7 @@ export function createDeprecationWarning(msg: string, elementName: string): void
* If null, the full text of 'msg' is used instead.
*/
export function createSingularWarning(msg: string, sentinelText: string | null = null): void {
const banners = document.getElementsByClassName('alert-banner py-warning');
const banners = $$('.alert-banner, .py-warning', document);
let bannerCount = 0;
for (const banner of banners) {
if (banner.innerHTML.includes(sentinelText ? sentinelText : msg)) {