Skip to content

Commit

Permalink
Check if document.body is available to prevent JS errors when Radze…
Browse files Browse the repository at this point in the history
…n.Blazor.js is incorrectly included in the `<head>`.
  • Loading branch information
akorchev committed Nov 15, 2024
1 parent fd4bd63 commit b8ddfa6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Radzen.Blazor/wwwroot/Radzen.Blazor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (!Element.prototype.closest) {
};
}

if (document.fonts) {
if (document.fonts && document.body) {
document.body.classList.add('rz-icons-loading');
document.fonts.load('16px Material Symbols').then(() => {
document.body.classList.remove('rz-icons-loading');
Expand Down Expand Up @@ -1048,7 +1048,7 @@ window.Radzen = {
handler(e, !e.currentTarget.classList.contains('rz-state-disabled') && (input ? !input.classList.contains('rz-readonly') : true));
};
}

if (input) {
input.onclick = function (e) {
handler(e, e.currentTarget.classList.contains('rz-input-trigger') && !e.currentTarget.classList.contains('rz-readonly'));
Expand Down Expand Up @@ -2455,7 +2455,7 @@ window.Radzen = {
x = Math.max(2, chartRect.left + x);
y = Math.max(2, chartRect.top + y);
Radzen.openPopup(chart, id, false, null, x, y, instance, callback, true, false, false);

var popup = document.getElementById(id);
if (!popup) {
return;
Expand Down

0 comments on commit b8ddfa6

Please sign in to comment.