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

Commit

Permalink
fix(datepicker): add missing type="button" and check for pane being in
Browse files Browse the repository at this point in the history
the DOM before removing. Fixes #4214 and #4192.
  • Loading branch information
jelbourn committed Aug 18, 2015
1 parent 1120c70 commit 314a05d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/datepicker/datePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
'ng-class="{\'md-datepicker-focused\': ctrl.isFocused}">' +
'<input class="md-datepicker-input" aria-haspopup="true" ' +
'ng-focus="ctrl.setFocused(true)" ng-blur="ctrl.setFocused(false)">' +
'<md-button md-no-ink class="md-datepicker-triangle-button md-icon-button" ' +
'<md-button type="button" md-no-ink ' +
'class="md-datepicker-triangle-button md-icon-button" ' +
'ng-click="ctrl.openCalendarPane($event)" ' +
'aria-label="{{::ctrl.dateLocale.msgOpenCalendar}}">' +
'<div class="md-datepicker-expand-triangle"></div>' +
Expand Down Expand Up @@ -319,9 +320,11 @@
this.$element.removeClass('md-datepicker-open');
this.calendarPane.classList.remove('md-pane-open');

// Use native DOM removal because we do not want any of the angular state of this element
// to be disposed.
this.calendarPane.parentNode.removeChild(this.calendarPane);
if (this.calendarPane.parentNode) {
// Use native DOM removal because we do not want any of the angular state of this element
// to be disposed.
this.calendarPane.parentNode.removeChild(this.calendarPane);
}
};

/**
Expand Down

0 comments on commit 314a05d

Please sign in to comment.