diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/react-dom/lib/ReactDOMComponent.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/react-dom/lib/ReactDOMComponent.js')
-rw-r--r-- | node_modules/react-dom/lib/ReactDOMComponent.js | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/node_modules/react-dom/lib/ReactDOMComponent.js b/node_modules/react-dom/lib/ReactDOMComponent.js index 725918ca6..7306071f6 100644 --- a/node_modules/react-dom/lib/ReactDOMComponent.js +++ b/node_modules/react-dom/lib/ReactDOMComponent.js @@ -39,6 +39,7 @@ var escapeTextContentForBrowser = require('./escapeTextContentForBrowser'); var invariant = require('fbjs/lib/invariant'); var isEventSupported = require('./isEventSupported'); var shallowEqual = require('fbjs/lib/shallowEqual'); +var inputValueTracking = require('./inputValueTracking'); var validateDOMNesting = require('./validateDOMNesting'); var warning = require('fbjs/lib/warning'); @@ -49,7 +50,7 @@ var listenTo = ReactBrowserEventEmitter.listenTo; var registrationNameModules = EventPluginRegistry.registrationNameModules; // For quickly matching children type, to test if can be treated as content. -var CONTENT_TYPES = { 'string': true, 'number': true }; +var CONTENT_TYPES = { string: true, number: true }; var STYLE = 'style'; var HTML = '__html'; @@ -158,7 +159,7 @@ function enqueuePutListener(inst, registrationName, listener, transaction) { if (process.env.NODE_ENV !== 'production') { // IE8 has no API for event capturing and the `onScroll` event doesn't // bubble. - process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0; + process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), "This browser doesn't support the `onScroll` event") : void 0; } var containerInfo = inst._hostContainerInfo; var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; @@ -248,6 +249,10 @@ var mediaEvents = { topWaiting: 'waiting' }; +function trackInputValue() { + inputValueTracking.track(this); +} + function trapBubbledEventsLocal() { var inst = this; // If a component renders to null or if another component fatals and causes @@ -263,7 +268,6 @@ function trapBubbledEventsLocal() { break; case 'video': case 'audio': - inst._wrapperState.listeners = []; // Create listener for each media event for (var event in mediaEvents) { @@ -297,34 +301,35 @@ function postUpdateSelectWrapper() { // those special-case tags. var omittedCloseTags = { - 'area': true, - 'base': true, - 'br': true, - 'col': true, - 'embed': true, - 'hr': true, - 'img': true, - 'input': true, - 'keygen': true, - 'link': true, - 'meta': true, - 'param': true, - 'source': true, - 'track': true, - 'wbr': true + area: true, + base: true, + br: true, + col: true, + embed: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true + // NOTE: menuitem's close tag should be omitted, but that causes problems. }; var newlineEatingTags = { - 'listing': true, - 'pre': true, - 'textarea': true + listing: true, + pre: true, + textarea: true }; // For HTML, certain tags cannot have children. This has the same purpose as // `omittedCloseTags` except that `menuitem` should still have its closing tag. var voidElementTags = _assign({ - 'menuitem': true + menuitem: true }, omittedCloseTags); // We accept any tag to be rendered but since this gets injected into arbitrary @@ -388,7 +393,6 @@ function ReactDOMComponent(element) { ReactDOMComponent.displayName = 'ReactDOMComponent'; ReactDOMComponent.Mixin = { - /** * Generates root tag markup then recurses. This method has side effects and * is not idempotent. @@ -425,6 +429,7 @@ ReactDOMComponent.Mixin = { case 'input': ReactDOMInput.mountWrapper(this, props, hostParent); props = ReactDOMInput.getHostProps(this, props); + transaction.getReactMountReady().enqueue(trackInputValue, this); transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); break; case 'option': @@ -439,6 +444,7 @@ ReactDOMComponent.Mixin = { case 'textarea': ReactDOMTextarea.mountWrapper(this, props, hostParent); props = ReactDOMTextarea.getHostProps(this, props); + transaction.getReactMountReady().enqueue(trackInputValue, this); transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); break; } @@ -964,6 +970,10 @@ ReactDOMComponent.Mixin = { } } break; + case 'input': + case 'textarea': + inputValueTracking.stopTracking(this); + break; case 'html': case 'head': case 'body': @@ -992,7 +1002,6 @@ ReactDOMComponent.Mixin = { getPublicInstance: function () { return getNode(this); } - }; _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); |