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

fix(radio-button): Cannot read property 'nodeName' of null #12013

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/components/radioButton/radio-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,17 @@ function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {
}

/**
* Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent).
* Update the `aria-activedescendant` attribute.
* Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent).
* Update the `aria-activedescendant` attribute.
*/
function render() {
var checked = radioGroupController.getViewValue() == attr.value;

if (checked === lastChecked) return;

if (element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') {
// If the radioButton is inside a div, then add class so highlighting will work
if (element[0] && element[0].parentNode &&
element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') {
// If the radioButton is inside a div, then add class so highlighting will work.
element.parent().toggleClass(CHECKED_CSS, checked);
}

Expand Down