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

Commit b707375

Browse files
Emeegeemeejelbourn
authored andcommitted
fix(mdSelect): Selected label shouldn't copy the ripple container in the md-option
1 parent 0918596 commit b707375

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/select/select.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,14 @@ function SelectMenuDirective($parse, $mdUtil, $mdTheming) {
648648
var mapFn;
649649

650650
if (mode == 'html') {
651-
mapFn = function(el) { return el.innerHTML; };
651+
// Map the given element to its innerHTML string. If the element has a child ripple
652+
// container remove it from the HTML string, before returning the string.
653+
mapFn = function(el) {
654+
var html = el.innerHTML;
655+
// Remove the ripple container from the selected option, copying it would cause a CSP violation.
656+
var rippleContainer = el.querySelector('.md-ripple-container');
657+
return rippleContainer ? html.replace(rippleContainer.outerHTML, '') : html;
658+
};
652659
} else if (mode == 'aria') {
653660
mapFn = function(el) { return el.hasAttribute('aria-label') ? el.getAttribute('aria-label') : el.textContent; };
654661
}

0 commit comments

Comments
 (0)