Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(all): fix Trusted Types violations during initialization #12128

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
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 src/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,7 @@ angular

var MD_PANEL_Z_INDEX = 80;
var MD_PANEL_HIDDEN = '_md-panel-hidden';
var FOCUS_TRAP_TEMPLATE = angular.element(
'<div class="_md-panel-focus-trap" tabindex="0"></div>');
var FOCUS_TRAP_TEMPLATE;

var _presets = {};

Expand Down Expand Up @@ -2232,6 +2231,12 @@ MdPanelRef.prototype._configureTrapFocus = function() {
var element = this.panelEl;
// Set up elements before and after the panel to capture focus and
// redirect back into the panel.
if (!FOCUS_TRAP_TEMPLATE) {
var template = document.createElement('div');
template.className = '_md-panel-focus-trap';
template.tabIndex = 0;
FOCUS_TRAP_TEMPLATE = angular.element(template);
}
this._topFocusTrap = FOCUS_TRAP_TEMPLATE.clone()[0];
this._bottomFocusTrap = FOCUS_TRAP_TEMPLATE.clone()[0];

Expand Down
10 changes: 8 additions & 2 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

var SELECT_EDGE_MARGIN = 8;
var selectNextId = 0;
var CHECKBOX_SELECTION_INDICATOR =
angular.element('<div class="md-container"><div class="md-icon"></div></div>');
var CHECKBOX_SELECTION_INDICATOR;

angular.module('material.components.select', [
'material.core',
Expand Down Expand Up @@ -1017,6 +1016,13 @@ function OptionDirective($mdButtonInkRipple, $mdUtil, $mdTheming) {

if (selectCtrl.isMultiple) {
element.addClass('md-checkbox-enabled');
if (!CHECKBOX_SELECTION_INDICATOR) {
var indicator = document.createElement('div');
indicator.className = 'md-container';
indicator.appendChild(document.createElement('div'));
indicator.firstChild.className = 'md-icon';
CHECKBOX_SELECTION_INDICATOR = angular.element(indicator);
}
element.prepend(CHECKBOX_SELECTION_INDICATOR.clone());
}

Expand Down