(rootNode, props)
| 3827 | } |
| 3828 | |
| 3829 | function updateNamedCousins(rootNode, props) { |
| 3830 | var name = props.name; |
| 3831 | if (props.type === 'radio' && name != null) { |
| 3832 | var queryRoot = rootNode; |
| 3833 | |
| 3834 | while (queryRoot.parentNode) { |
| 3835 | queryRoot = queryRoot.parentNode; |
| 3836 | } |
| 3837 | |
| 3838 | // If `rootNode.form` was non-null, then we could try `form.elements`, |
| 3839 | // but that sometimes behaves strangely in IE8. We could also try using |
| 3840 | // `form.getElementsByName`, but that will only return direct children |
| 3841 | // and won't include inputs that use the HTML5 `form=` attribute. Since |
| 3842 | // the input might not even be in a form. It might not even be in the |
| 3843 | // document. Let's just use the local `querySelectorAll` to ensure we don't |
| 3844 | // miss anything. |
| 3845 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); |
| 3846 | |
| 3847 | for (var i = 0; i < group.length; i++) { |
| 3848 | var otherNode = group[i]; |
| 3849 | if (otherNode === rootNode || otherNode.form !== rootNode.form) { |
| 3850 | continue; |
| 3851 | } |
| 3852 | // This will throw if radio buttons rendered by different copies of React |
| 3853 | // and the same name are rendered into the same form (same as #1939). |
| 3854 | // That's probably okay; we don't support it just as we don't support |
| 3855 | // mixing React radio buttons with non-React ones. |
| 3856 | var otherProps = getFiberCurrentPropsFromNode$1(otherNode); |
| 3857 | !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0; |
| 3858 | |
| 3859 | // We need update the tracked value on the named cousin since the value |
| 3860 | // was changed but the input saw no event or value set |
| 3861 | updateValueIfChanged(otherNode); |
| 3862 | |
| 3863 | // If this is a controlled radio button group, forcing the input that |
| 3864 | // was previously checked to update will cause it to be come re-checked |
| 3865 | // as appropriate. |
| 3866 | updateWrapper(otherNode, otherProps); |
| 3867 | } |
| 3868 | } |
| 3869 | } |
| 3870 | |
| 3871 | // In Chrome, assigning defaultValue to certain input types triggers input validation. |
| 3872 | // For number inputs, the display value loses trailing decimal points. For email inputs, |
no test coverage detected