File event.js
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { document, modern, contains } from './browser';
import { isFn, noop, toLowerCase } from 'react-core/util';
import { Renderer } from 'react-core/createRenderer';
import { enqueueDuplex } from './duplex';
export let rform = /textarea|input|select|option/i;
Function collectPaths
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function collectPaths(begin, end, unique) {
let paths = [];
let node = begin;
//先判定路径上有绑定事件没有
while (node && node.nodeType == 1) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function blurFocus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function blurFocus(e) {
let dom = getTarget(e);
let type = focusMap[e.type];
if (Renderer.inserting) {
if (type === 'blur') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function collectPaths
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function collectPaths(begin, end, unique) {
let paths = [];
let node = begin;
//先判定路径上有绑定事件没有
while (node && node.nodeType == 1) {
Function wheel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
eventPropHooks.wheel = function(event) {
event.deltaX =
'deltaX' in event
? event.deltaX
: // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (!node) {
break inner;
}
Avoid deeply nested control flow statements. Open
if (node.__events && !unique[uid]) {
unique[uid] = 1;
paths.push({ node, events: node.__events });
}
Avoid deeply nested control flow statements. Open
if (node === end) {
return paths;
}
Function eventAction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function eventAction(dom, name, val, lastProps, fiber) {
let events = dom.__events || (dom.__events = {});
events.vnode = fiber;
let refName = toLowerCase(name.slice(2));
if (val === false) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function eventAction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function eventAction(dom, name, val, lastProps, fiber) {
Function getLowestCommonAncestor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getLowestCommonAncestor(instA, instB) {
let depthA = 0;
for (let tempA = instA; tempA; tempA = tempA.parentNode) {
depthA++;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function triggerEventFlow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function triggerEventFlow(paths, prop, e) {
for (let i = paths.length; i--; ) {
let path = paths[i];
let fn = path.events[prop];
if (isFn(fn)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"