-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui5-badge): correctly detect if default slot is provided (#5334)
Fixes: #5328
- Loading branch information
1 parent
c2341e8
commit 0dceaf5
Showing
3 changed files
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { getSlotName } from "./SlotsHelper.js"; | ||
|
||
const isDefaultSlotProvided = element => { | ||
return Array.from(element.childNodes).filter(node => { | ||
return node.nodeType !== Node.COMMENT_NODE | ||
&& getSlotName(node) === "default" | ||
&& (node.nodeType !== Node.TEXT_NODE || node.nodeValue.trim().length !== 0); | ||
}).length; | ||
}).length > 0; | ||
}; | ||
|
||
export default isDefaultSlotProvided; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters