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

Commit

Permalink
fix(mdSelect): Selected label shouldn't copy the ripple container in …
Browse files Browse the repository at this point in the history
…the md-option
  • Loading branch information
Emeegeemee authored and jelbourn committed Jan 27, 2016
1 parent 0918596 commit b707375
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,14 @@ function SelectMenuDirective($parse, $mdUtil, $mdTheming) {
var mapFn;

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

0 comments on commit b707375

Please sign in to comment.