Fix up Flow annotations to be a bit more explicit where the unsoundness is
Sebastian Markbage committed
Nov 18, 2016 at 14:40 UTC
cd0f963fa366ac6eaf154fd2b3e616a04feeef33
1 file changed
+6
-4
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+6
-4
@@ -159,7 +159,7 @@ var mediaEvents = {
159
topWaiting: 'waiting',
160
};
161
162
-function trapClickOnNonInteractiveElement(node : any) {
162
+function trapClickOnNonInteractiveElement(node : HTMLElement) {
163
// Mobile Safari does not fire properly bubble click events on
164
// non-interactive elements, which means delegated click listeners do not
165
// fire. The workaround for this bug involves attaching an empty click
@@ -496,7 +496,7 @@ var ReactDOMFiberComponent = {
496
var div = ownerDocument.createElement('div');
497
div.innerHTML = '<script></script>';
498
// This is guaranteed to yield a script element.
499
- var firstChild = ((div.firstChild : any) : Element);
499
+ var firstChild = ((div.firstChild : any) : HTMLScriptElement);
500
domElement = div.removeChild(firstChild);
501
} else if (props.is) {
502
domElement = ownerDocument.createElement(tag, props.is);
@@ -622,7 +622,8 @@ var ReactDOMFiberComponent = {
622
break;
623
default:
624
if (typeof props.onClick === 'function') {
625
- trapClickOnNonInteractiveElement(domElement);
625
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
626
+ trapClickOnNonInteractiveElement(((domElement : any) : HTMLElement));
627
}
628
break;
629
}
@@ -655,7 +656,8 @@ var ReactDOMFiberComponent = {
656
default:
657
if (typeof lastProps.onClick !== 'function' &&
658
typeof nextProps.onClick === 'function') {
658
- trapClickOnNonInteractiveElement(domElement);
659
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
660
+ trapClickOnNonInteractiveElement(((domElement : any) : HTMLElement));
661
}
662
break;
663
}