Exam B2B-Commerce-Developer Topic 3 Question 50 Discussion
Actual exam question for Salesforce's B2B-Commerce-Developer exam
Question #: 50
Topic #: 3
Question #: 50
Topic #: 3
Which two event settings are required for a custom event called CustomEvent to fire from the Lightning web component and propagate up to the DOM?
Suggested Answer: A,B Vote an answer
To fire a custom event called CustomEvent from the Lightning web component and propagate it up to the DOM, the developer must set two event settings: bubbles and composed. The bubbles setting determines whether the event bubbles up through the component's ancestors in the DOM tree. The composed setting determines whether the event crosses the shadow boundary and reaches the light DOM. Setting both bubbles and composed to true allows the event to be handled by any element in the DOM that listens for it. The cancelable setting is not required for firing or propagating the event, as it only determines whether the event can be canceled by calling preventDefault() on it. Setting composed to false would prevent the event from reaching the light DOM and limit its propagation to the shadow DOM. Salesforce Reference: Lightning Web Components Developer Guide: Create and Dispatch Events, Lightning Web Components Developer Guide: Event Propagation
by Monica at Dec 17, 2023, 07:31 AM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).