Skip to content

Commit

Permalink
handle for style="" when there no style:display
Browse files Browse the repository at this point in the history
  • Loading branch information
adiguba committed Dec 21, 2024
1 parent 313a561 commit 272f7d4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/svelte/src/internal/client/dom/blocks/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ export function display(node, get_visibility, render_fn, get_value, default_impo
/** @type {string | null | undefined | typeof UNINITIALIZED} */
let prev_value = UNINITIALIZED;

// special case when style:display is missing
// we get the style value from the node :
if (get_value === undefined) {
/** @type {string | null} */
let anchor_display = null;
get_value = () => {
if (prev_visible !== false) {
anchor_display = anchor.style.display || null;
if (anchor_display) {
default_important = anchor.style.getPropertyPriority('display') === 'important';
}
}
return anchor_display;
};
}

const effect = block(render_fn);
template_effect(() => {
const visible = !!get_visibility();
Expand Down

0 comments on commit 272f7d4

Please sign in to comment.