Skip to content

Commit 17f30b7

Browse files
authoredFeb 14, 2019
fix: do not modify the HTML tag (#49)
1 parent 24a9d4c commit 17f30b7

File tree

8 files changed

+19
-33
lines changed

8 files changed

+19
-33
lines changed
 

‎packages/base/src/sap/ui/webcomponents/base/ControlRenderer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class ControlRenderer {
1010
// const oldCounter = window.renderStats.get(control.tagName) || 0;
1111
// window.renderStats.set(control.tagName, oldCounter + 1);
1212

13-
const placeholder = control._getPlaceholder();
13+
const root = control._getRoot();
1414
const templateContext = control._getTemplateContext();
1515
const renderer = Object.getPrototypeOf(control).constructor.renderer.render;
1616
const renderResult = renderer(templateContext);
1717

18-
RendererImpl.render(renderResult, placeholder);
18+
RendererImpl.render(renderResult, root);
1919
}
2020

2121
}

‎packages/base/src/sap/ui/webcomponents/base/Core.js

-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import ShadowDOM from './compatibility/ShadowDOM';
22
import whenDOMReady from './util/whenDOMReady';
3-
import setupBrowser from './util/setupBrowser';
4-
import setupOS from './util/setupOS';
5-
import setupSystem from './util/setupSystem';
63
import configuration from "./Configuration";
74
import { inject as injectCore } from "@ui5/webcomponents-core/dist/sap/ui/core/Core";
85
import "./jquery-shim";
@@ -64,13 +61,8 @@ const Core = {
6461
whenDOMReady().then(function() {
6562

6663
// This will only have effect if the polyfill is loaded
67-
ShadowDOM.setWebComponentRootOnHTML();
6864
attachThemeChange(ShadowDOM._applyTheme);
6965

70-
setupBrowser(document.documentElement);
71-
setupOS(document.documentElement);
72-
setupSystem(document.documentElement);
73-
7466
IconFonts.load();
7567
DOMEventHandler.start();
7668
resolve();

‎packages/base/src/sap/ui/webcomponents/base/WebComponent.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,15 @@ class WebComponent extends HTMLElement {
411411
return;
412412
}
413413

414-
return this._getPlaceholder().children[0];
414+
return this._getRoot().children[0];
415415
}
416416

417417
_waitForDomRef() {
418418
return this._domRefReadyPromise;
419419
}
420420

421-
_getPlaceholder() {
422-
return this.shadowRoot.querySelector("[data-sap-ui-wc-placeholder]");
421+
_getRoot() {
422+
return this.shadowRoot.querySelector("[data-sap-ui-wc-root]");
423423
}
424424

425425
getFocusDomRef() {

‎packages/base/src/sap/ui/webcomponents/base/compatibility/ShadowDOM.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ class ShadowDOM {
2525
constructor() {
2626
throw new Error("Static class");
2727
}
28-
29-
static setWebComponentRootOnHTML() {
30-
if (window.ShadyDOM) {
31-
document.documentElement.setAttribute("data-sap-ui-wc-root", "");
32-
}
33-
}
34-
28+
3529
static registerStyle(theme, styleName, styleObj) {
3630
if (typeof(styleObj) === "object" && styleObj._) {
3731
if (!styles.has(theme)) {
@@ -78,7 +72,7 @@ class ShadowDOM {
7872

7973
// Create the shadow DOM root span
8074
rootSpan = d.createElement("span");
81-
rootSpan.setAttribute("data-sap-ui-wc-placeholder", "");
75+
rootSpan.setAttribute("data-sap-ui-wc-root", "");
8276
shadowDOM = rootSpan;
8377
} else {
8478
let template = this._getTemplateFor(theme, tag);
@@ -90,12 +84,13 @@ class ShadowDOM {
9084
}
9185
shadowDOM = template.content.cloneNode(true);
9286

93-
rootSpan = shadowDOM.querySelector("span[data-sap-ui-wc-placeholder]");
94-
setupBrowser(rootSpan);
95-
setupOS(rootSpan);
96-
setupSystem(rootSpan);
87+
rootSpan = shadowDOM.querySelector("span[data-sap-ui-wc-root]");
9788
}
9889

90+
setupBrowser(rootSpan);
91+
setupOS(rootSpan);
92+
setupSystem(rootSpan);
93+
9994
if (isCompact) {
10095
rootSpan.classList.add("sapUiSizeCompact");
10196
}
@@ -212,7 +207,6 @@ class ShadowDOM {
212207

213208
// Create a root span
214209
let root = d.createElement("span");
215-
root.setAttribute("data-sap-ui-wc-placeholder", "");
216210
root.setAttribute("data-sap-ui-wc-root", "");
217211

218212
template.content.appendChild(root);

‎packages/main/src/themes/base/Button.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ span[dir="rtl"] {
4141
}
4242
}
4343

44-
span[data-sap-ui-wc-placeholder] {
44+
span[data-sap-ui-wc-root] {
4545
display: inline-block;
4646
width: 100%;
4747
height: 100%;

‎packages/main/src/themes/base/Icon.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ui5-icon {
2222

2323
// workaround for IE
2424
// pressing on the span does not propagate active state to the web component
25-
& span[data-sap-ui-wc-placeholder] {
25+
& span[data-sap-ui-wc-root] {
2626
pointer-events: none;
2727
}
2828
}

‎packages/main/src/themes/base/Label.less

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
cursor: text;
1616
max-width: 100%;
1717

18-
& span[data-sap-ui-wc-placeholder] {
18+
& span[data-sap-ui-wc-root] {
1919
display: flex;
2020
}
2121
}
@@ -25,7 +25,7 @@ ui5-label {
2525
cursor: text;
2626
max-width: 100%;
2727

28-
& span[data-sap-ui-wc-placeholder] {
28+
& span[data-sap-ui-wc-root] {
2929
display: flex;
3030
}
3131
}
@@ -57,4 +57,4 @@ ui5-label {
5757
display: inline-flex;
5858
align-items: flex-start;
5959
}
60-
}
60+
}

‎packages/main/src/themes/base/Link.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ui5-link {
1414
display: inline-block;
1515
max-width: 100%;
1616

17-
& span[data-sap-ui-wc-placeholder] {
17+
& span[data-sap-ui-wc-root] {
1818
display: flex;
1919
}
2020
}
@@ -82,4 +82,4 @@ ui5-link {
8282
.sapMLnk.sapMLnkWrapping {
8383
white-space: normal;
8484
word-wrap: break-word;
85-
}
85+
}

0 commit comments

Comments
 (0)
Please sign in to comment.