Stop pages from being able to style the shadow DOM wrapper div element.

This commit is contained in:
Stefan Sundin 2023-12-22 14:20:08 -08:00
parent 5b87a10cbb
commit 62a9bb59e1
6 changed files with 6 additions and 0 deletions

View file

@ -88,6 +88,7 @@ class Autocomplete {
const colorStyleSheet = createStylesheet('css/colors.css');
this.wrapper = kpxcUI.createElement('div');
this.wrapper.style.display = 'none';
this.wrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => this.wrapper.style.display = 'block');
this.container = kpxcUI.createElement('div', 'kpxcAutocomplete-container', { 'id': 'kpxcAutocomplete-container' });

View file

@ -123,6 +123,7 @@ kpxcBanner.create = async function(credentials = {}) {
const wrapper = document.createElement('div');
wrapper.style.display = 'none';
wrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
this.shadowRoot.append(colorStyleSheet);

View file

@ -129,6 +129,7 @@ kpxcCustomLoginFieldsBanner.create = async function() {
const wrapper = document.createElement('div');
wrapper.style.display = 'none';
wrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
this.shadowRoot.append(colorStyleSheet);

View file

@ -161,6 +161,7 @@ TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) {
const styleSheet = createStylesheet('css/totp.css');
const wrapper = document.createElement('div');
wrapper.style.display = 'none';
wrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });

View file

@ -293,6 +293,7 @@ kpxcUI.createNotification = function(type, message) {
const styleSheet = createStylesheet('css/notification.css');
notificationWrapper = notificationWrapper || document.createElement('div');
notificationWrapper.style.display = 'none';
notificationWrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => notificationWrapper.style.display = 'block');
this.shadowRoot = notificationWrapper.attachShadow({ mode: 'closed' });
if (!this.shadowRoot) {

View file

@ -110,6 +110,7 @@ UsernameFieldIcon.prototype.createIcon = function(field) {
const styleSheet = createStylesheet('css/username.css');
const wrapper = document.createElement('div');
wrapper.style.display = 'none';
wrapper.style.all = 'unset';
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });