Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(framework): make getStableDomRef search in the static area item … #2363

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/base/src/UI5Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ class UI5Element extends HTMLElement {

if (this._shouldUpdateFragment()) {
this.staticAreaItem._updateFragment(this);
this.staticAreaItemDomRef = this.staticAreaItem.staticAreaItemDomRef.shadowRoot;
}

// Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
Expand Down Expand Up @@ -638,12 +639,16 @@ class UI5Element extends HTMLElement {
}

/**
* Use this method in order to get a reference to element in the shadow root of a web component
* Use this method in order to get a reference to an element in the shadow root of the web component or the static area item of the component
* @public
* @method
* @param {String} refName Defines the name of the stable DOM ref
*/
getStableDomRef(refName) {
return this.getDomRef().querySelector(`[data-ui5-stable=${refName}]`);
const staticAreaResult = this.staticAreaItemDomRef && this.staticAreaItemDomRef.querySelector(`[data-ui5-stable=${refName}]`);

return staticAreaResult
|| this.getDomRef().querySelector(`[data-ui5-stable=${refName}]`);
}

/**
Expand Down