File tree 10 files changed +1064
-1331
lines changed
base/src/sap/ui/webcomponents/base
test/sap/ui/webcomponents/main/qunit
10 files changed +1064
-1331
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import ShadowDOM from './compatibility/ShadowDOM';
2
2
import whenDOMReady from './util/whenDOMReady' ;
3
3
import setupBrowser from './util/setupBrowser' ;
4
4
import setupOS from './util/setupOS' ;
5
+ import setupSystem from './util/setupSystem' ;
5
6
import configuration from "./Configuration" ;
6
7
import { inject as injectCore } from "@ui5/webcomponents-core/dist/sap/ui/core/Core" ;
7
8
import "./jquery-shim" ;
@@ -66,8 +67,9 @@ const Core = {
66
67
ShadowDOM . setWebComponentRootOnHTML ( ) ;
67
68
attachThemeChange ( ShadowDOM . _applyTheme ) ;
68
69
69
- setupBrowser ( ) ;
70
- setupOS ( ) ;
70
+ setupBrowser ( document . documentElement ) ;
71
+ setupOS ( document . documentElement ) ;
72
+ setupSystem ( document . documentElement ) ;
71
73
72
74
IconFonts . load ( ) ;
73
75
DOMEventHandler . start ( ) ;
@@ -86,4 +88,4 @@ window.sap.ui.getWCCore = function() {
86
88
} ;
87
89
88
90
injectCore ( Core ) ;
89
- export default Core ;
91
+ export default Core ;
Original file line number Diff line number Diff line change 1
1
import WCPolyfill from '../thirdparty/webcomponents-polyfill' ;
2
2
import configuration from "../Configuration" ;
3
3
import { fetchThemeBundle } from "../ThemeBundle" ;
4
+ import setupBrowser from '../util/setupBrowser' ;
5
+ import setupOS from '../util/setupOS' ;
6
+ import setupSystem from '../util/setupSystem' ;
4
7
5
8
// Shorthands
6
9
const d = document ;
@@ -88,8 +91,9 @@ class ShadowDOM {
88
91
shadowDOM = template . content . cloneNode ( true ) ;
89
92
90
93
rootSpan = shadowDOM . querySelector ( "span[data-sap-ui-wc-placeholder]" ) ;
91
- rootSpan . setAttribute ( "data-sap-ui-browser" , document . documentElement . getAttribute ( "data-sap-ui-browser" ) ) ;
92
- rootSpan . setAttribute ( "data-sap-ui-os" , document . documentElement . getAttribute ( "data-sap-ui-os" ) ) ;
94
+ setupBrowser ( rootSpan ) ;
95
+ setupOS ( rootSpan ) ;
96
+ setupSystem ( rootSpan ) ;
93
97
}
94
98
95
99
if ( isCompact ) {
@@ -264,4 +268,4 @@ class ShadowDOM {
264
268
}
265
269
}
266
270
267
- export default ShadowDOM ;
271
+ export default ShadowDOM ;
Original file line number Diff line number Diff line change 1
1
import Device from "@ui5/webcomponents-core/dist/sap/ui/Device" ;
2
2
3
- const setupBrowser = ( ) => {
4
- var html = document . documentElement ;
5
-
6
- var b = Device . browser ;
7
- var id = b . name ;
3
+ const setupBrowser = ( node ) => {
4
+ const b = Device . browser ;
5
+ let id = b . name ;
8
6
9
7
if ( id ) {
10
8
if ( id === b . BROWSER . SAFARI && b . mobile ) {
11
9
id = "m" + id ;
12
10
}
13
11
id = id + ( b . version === - 1 ? "" : Math . floor ( b . version ) ) ;
14
- html . dataset . sapUiBrowser = id ;
12
+ node . dataset . sapUiBrowser = id ;
15
13
}
16
14
} ;
17
15
18
- export default setupBrowser ;
16
+ export default setupBrowser ;
Original file line number Diff line number Diff line change 1
1
import Device from "@ui5/webcomponents-core/dist/sap/ui/Device" ;
2
2
3
- const setupOS = ( ) => {
4
- var html = document . documentElement ;
3
+ const setupOS = ( node ) => {
4
+ node . dataset . sapUiOs = Device . os . name + Device . os . versionStr ;
5
5
6
- html . dataset . sapUiOs = Device . os . name + Device . os . versionStr ;
7
-
8
- var osCSS = null ;
6
+ let osCSS = null ;
9
7
switch ( Device . os . name ) {
10
8
case Device . os . OS . IOS :
11
9
osCSS = "sap-ios" ;
@@ -21,8 +19,8 @@ const setupOS = () => {
21
19
break ;
22
20
}
23
21
if ( osCSS ) {
24
- html . classList . add ( osCSS ) ;
22
+ node . classList . add ( osCSS ) ;
25
23
}
26
24
} ;
27
25
28
- export default setupOS ;
26
+ export default setupOS ;
Original file line number Diff line number Diff line change
1
+ import Device from "@ui5/webcomponents-core/dist/sap/ui/Device" ;
2
+
3
+ const setupSystem = ( node ) => {
4
+ const sysTypes = Object . entries ( Device . system . SYSTEMTYPE ) . map ( ( [ _key , value ] ) => value ) ;
5
+
6
+ node . classList . remove ( ...sysTypes ) ;
7
+ sysTypes . forEach ( sysType => {
8
+ if ( Device . system [ sysType ] ) {
9
+ node . classList . add ( "sap-" + sysType ) ;
10
+ }
11
+ } ) ;
12
+ } ;
13
+
14
+ export default setupSystem ;
You can’t perform that action at this time.
0 commit comments