Skip to content

Commit 90feb7d

Browse files
committed
release v2.1.1
1 parent 73840a9 commit 90feb7d

72 files changed

Lines changed: 21303 additions & 19563 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/ReactSelection.js

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { options } from "../src/util";
1+
import { options, Fragment } from "../src/util";
22
import { Children } from "../src/Children";
33
import * as eventSystem from "../src/event";
44
import { PropTypes } from "../src/PropTypes";
55
import { Component } from "../src/Component";
6-
import { win as window, inBrowser, document } from "../src/browser";
6+
import { win as window, contains as containsNode } from "../src/browser";
77
import { createClass } from "../src/createClass";
88
import { cloneElement } from "../src/cloneElement";
99
import { PureComponent } from "../src/PureComponent";
1010
import { createElement } from "../src/createElement";
11+
import { createContext } from "../src/createContext";
1112
import { createPortal } from "../src/createPortal";
12-
1313
import {
1414
render,
1515
findDOMNode,
@@ -18,49 +18,45 @@ import {
1818
unstable_renderSubtreeIntoContainer
1919
} from "../src/diff";
2020

21-
var React = {
22-
version: "VERSION",
23-
render,
24-
hydrate: render,
25-
options,
26-
PropTypes,
27-
createPortal,
28-
Children,
29-
Component,
30-
eventSystem,
31-
findDOMNode,
32-
createClass,
33-
createElement,
34-
cloneElement,
35-
PureComponent,
36-
isValidElement,
37-
unmountComponentAtNode,
38-
unstable_renderSubtreeIntoContainer,
39-
40-
createFactory(type) {
41-
console.warn("createFactory is deprecated"); // eslint-disable-line
42-
var factory = createElement.bind(null, type);
43-
factory.type = type;
44-
return factory;
45-
}
46-
};
21+
var React;
22+
if (window.React && window.React.options) {
23+
React = window.React; //解决引入多个
24+
} else {
25+
React = window.React = window.ReactDOM = {
26+
version: "VERSION",
27+
render,
28+
hydrate: render,
29+
options,
30+
Fragment,
31+
PropTypes,
32+
Children,
33+
createPortal,
34+
createContext,
35+
Component,
36+
eventSystem,
37+
findDOMNode,
38+
createClass,
39+
createElement,
40+
cloneElement,
41+
PureComponent,
42+
isValidElement,
43+
unmountComponentAtNode,
44+
unstable_renderSubtreeIntoContainer,
45+
createFactory(type) {
46+
console.warn("createFactory is deprecated"); // eslint-disable-line
47+
var factory = createElement.bind(null, type);
48+
factory.type = type;
49+
return factory;
50+
}
51+
};
52+
}
4753

4854
function isInDocument(node) {
4955
if (!inBrowser) {
5056
return false;
5157
}
5258
return containsNode(document.documentElement, node);
5359
}
54-
function containsNode(a, b) {
55-
if (b) {
56-
while ((b = b.parentNode)) {
57-
if (b === a) {
58-
return true;
59-
}
60-
}
61-
}
62-
return false;
63-
}
6460

6561
function focusNode(node) {
6662
//如果此元素不可见,IE8会抛错

build/rollup.ie.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import babel from "rollup-plugin-babel";
22
import replace from "rollup-plugin-re";
33
import filesize from "rollup-plugin-filesize";
4+
import cleanup from "rollup-plugin-cleanup";
45

56
const license = require("rollup-plugin-license");
67
const json = require("../package.json");
@@ -30,7 +31,7 @@ export default {
3031
new Date()
3132
).replace(/T.*|"/g, "")}`
3233
}),
33-
34+
cleanup(),
3435
replace({
3536
patterns: [
3637
{

build/rollup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import babel from "rollup-plugin-babel";
22
import replace from "rollup-plugin-re";
33
import filesize from "rollup-plugin-filesize";
4+
import cleanup from "rollup-plugin-cleanup";
45

56
const license = require("rollup-plugin-license");
67
const json = require("../package.json");
@@ -33,7 +34,7 @@ export default {
3334
IE9+
3435
`
3536
}),
36-
37+
cleanup(),
3738
replace({
3839
// ... do replace before commonjs
3940
patterns: [

build/rollup.selection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import babel from "rollup-plugin-babel";
22
import replace from "rollup-plugin-re";
33
import filesize from "rollup-plugin-filesize";
4+
import cleanup from "rollup-plugin-cleanup";
45

56
const license = require("rollup-plugin-license");
67
const json = require("../package.json");
@@ -31,7 +32,7 @@ export default {
3132
IE9+
3233
`
3334
}),
34-
35+
cleanup(),
3536
replace({
3637
// ... do replace before commonjs
3738
patterns: [

build/rollup.shim.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import babel from "rollup-plugin-babel";
22
import replace from "rollup-plugin-re";
33
import filesize from "rollup-plugin-filesize";
4+
import cleanup from "rollup-plugin-cleanup";
45

56
const license = require("rollup-plugin-license");
67
const json = require("../package.json");
@@ -24,7 +25,7 @@ export default {
2425
]
2526
]
2627
}),
27-
28+
cleanup(),
2829
license({
2930
banner: `此版本要求浏览器没有createClass, createFactory, PropTypes, isValidElement,
3031
unmountComponentAtNode,unstable_renderSubtreeIntoContainer

build/rollup.ssr.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import babel from "rollup-plugin-babel";
2+
import cleanup from "rollup-plugin-cleanup";
23
//import builtins from "rollup-plugin-node-builtins";
34

45
export default {
@@ -17,7 +18,8 @@ export default {
1718
}
1819
]
1920
]
20-
})
21+
}),
22+
cleanup()
2123
],
2224
moduleName: "ReactDOMServer",
2325
useStrict: false

0 commit comments

Comments
 (0)