• reactjs源码


    'use strict';

    var EventConstants = _dereq_(15);
    var EventPropagators = _dereq_(19);
    var ExecutionEnvironment = _dereq_(130);
    var FallbackCompositionState = _dereq_(20);
    var SyntheticCompositionEvent = _dereq_(90);
    var SyntheticInputEvent = _dereq_(94);

    var keyOf = _dereq_(148);

    var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space 很出彩啊
    var START_KEYCODE = 229;

    var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;

    var documentMode = null;
    if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
    documentMode = document.documentMode;
    }

    // Webkit offers a very useful `textInput` event that can be used to
    // directly represent `beforeInput`. The IE `textinput` event is not as
    // useful, so we don't use it.
    var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();

    // In IE9+, we have access to composition events, but the data supplied
    // by the native compositionend event may be incorrect. Japanese ideographic
    // spaces, for instance (u3000) are not recorded correctly.
    var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);

    /**
    * Opera <= 12 includes TextEvent in window, but does not fire
    * text input events. Rely on keypress instead.
    */
    function isPresto() {
    var opera = window.opera;
    return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
    }

    var SPACEBAR_CODE = 32;
    var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);

    var topLevelTypes = EventConstants.topLevelTypes;

    // Events and their corresponding property names.
    var eventTypes = {
    beforeInput: {
    phasedRegistrationNames: {
    bubbled: keyOf({ onBeforeInput: null }),
    captured: keyOf({ onBeforeInputCapture: null })
    },
    dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
    },
    compositionEnd: {
    phasedRegistrationNames: {
    bubbled: keyOf({ onCompositionEnd: null }),
    captured: keyOf({ onCompositionEndCapture: null })
    },
    dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
    },
    compositionStart: {
    phasedRegistrationNames: {
    bubbled: keyOf({ onCompositionStart: null }),
    captured: keyOf({ onCompositionStartCapture: null })
    },
    dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
    },
    compositionUpdate: {
    phasedRegistrationNames: {
    bubbled: keyOf({ onCompositionUpdate: null }),
    captured: keyOf({ onCompositionUpdateCapture: null })
    },
    dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
    }
    };

  • 相关阅读:
    leetcode56 合并区间(Medium)
    leetcode215 数组中的第k大元素(Medium)
    leetcode76 最小覆盖子串(Hard)
    leetcode75 颜色分类(Medium)
    leetcode64 最小路径和(Medium)
    Android 开发技巧
    Android 常用开源代码整理
    Android 屏幕尺寸知识
    Intellij IDEA 常用 设置 及 快捷键 (持续更新)
    Gradle Maven 依赖管理
  • 原文地址:https://www.cnblogs.com/wcLT/p/4979980.html
Copyright © 2020-2023  润新知