Skip to content

Commit

Permalink
Fall back to msMatchesSelector in findAssignedElement util (#396)
Browse files Browse the repository at this point in the history
* Fall back to msMatchesSelector in findAssignedElement util
* Add explicit dependencies on @material/dom
  • Loading branch information
aomarks authored Aug 22, 2019
1 parent df0bbe8 commit 0fd2793
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "Apache-2.0",
"dependencies": {
"@material/base": "^3.0.0",
"@material/dom": "^3.1.0",
"lit-element": "^2.2.1",
"lit-html": "^1.0.0"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/base/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ limitations under the License.
/**
* Return an element assigned to a given slot that matches the given selector
*/

import {matches} from '@material/dom/ponyfill';

export function findAssignedElement(slot: HTMLSlotElement, selector: string) {
for (const node of slot.assignedNodes({flatten: true})) {
if (node.nodeType === Node.ELEMENT_NODE) {
const el = (node as HTMLElement);
if (el.matches(selector)) {
if (matches(el, selector)) {
return el;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/ripple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@material/dom": "^3.1.0",
"@material/mwc-base": "^0.6.0",
"@material/ripple": "^3.0.0",
"lit-html": "^1.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/tab-scroller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@material/dom": "^3.1.0",
"@material/mwc-base": "^0.6.0",
"@material/tab-scroller": "^3.0.0"
},
Expand Down

0 comments on commit 0fd2793

Please sign in to comment.