Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(select): fix infinite loop condition
Browse files Browse the repository at this point in the history
references #2379
  • Loading branch information
rschmukler committed Apr 20, 2015
1 parent bd566a5 commit 6e3b43c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/util/util.js
Expand Up @@ -45,7 +45,7 @@ angular.module('material.core')
disableScrollAround: function(element) {
var parentContent = element[0] || element;
var disableTarget, scrollEl, useDocElement;
while (parentContent = this.getClosest(parentContent.parentNode, 'MD-CONTENT')) {
while (parentContent = this.getClosest(parentContent.parentNode, 'MD-CONTENT', true)) {
if (isScrolling(parentContent)) {
disableTarget = angular.element(parentContent);
}
Expand Down Expand Up @@ -362,9 +362,11 @@ angular.module('material.core')
* @param el Element to start walking the DOM from
* @param tagName Tag name to find closest to el, such as 'form'
*/
getClosest: function getClosest(el, tagName) {
getClosest: function getClosest(el, tagName, onlyParent) {
el = el[0] || el;
tagName = tagName.toUpperCase();
if (onlyParent) el = el.parentNode;
if (!el) return null;
do {
if (el.nodeName === tagName) {
return el;
Expand Down

0 comments on commit 6e3b43c

Please sign in to comment.