1 | (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId])
|
10 | return installedModules[moduleId].exports;
|
11 |
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | exports: {},
|
15 | id: moduleId,
|
16 | loaded: false
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.loaded = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.p = "";
|
38 |
|
39 |
|
40 | return __webpack_require__(0);
|
41 | })
|
42 |
|
43 | ([
|
44 |
|
45 | function(module, exports, __webpack_require__) {
|
46 |
|
47 | 'use strict';
|
48 |
|
49 | var _react = __webpack_require__(1);
|
50 |
|
51 | var _react2 = _interopRequireDefault(_react);
|
52 |
|
53 | var _reactDom = __webpack_require__(157);
|
54 |
|
55 | var _Page = __webpack_require__(158);
|
56 |
|
57 | var _Page2 = _interopRequireDefault(_Page);
|
58 |
|
59 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
60 |
|
61 | var root = document.createElement('div');
|
62 | document.body.appendChild(root);
|
63 |
|
64 | (0, _reactDom.render)(_react2.default.createElement(_Page2.default, null), root);
|
65 |
|
66 | },
|
67 |
|
68 | function(module, exports, __webpack_require__) {
|
69 |
|
70 | 'use strict';
|
71 |
|
72 | module.exports = __webpack_require__(2);
|
73 |
|
74 |
|
75 | },
|
76 |
|
77 | function(module, exports, __webpack_require__) {
|
78 |
|
79 | |
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | 'use strict';
|
91 |
|
92 | var ReactDOM = __webpack_require__(3);
|
93 | var ReactDOMServer = __webpack_require__(147);
|
94 | var ReactIsomorphic = __webpack_require__(151);
|
95 |
|
96 | var assign = __webpack_require__(38);
|
97 | var deprecated = __webpack_require__(156);
|
98 |
|
99 |
|
100 | var React = {};
|
101 |
|
102 | assign(React, ReactIsomorphic);
|
103 |
|
104 | assign(React, {
|
105 |
|
106 | findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
|
107 | render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
|
108 | unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
|
109 |
|
110 |
|
111 | renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
|
112 | renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
|
113 | });
|
114 |
|
115 | React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
|
116 | React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
|
117 |
|
118 | module.exports = React;
|
119 |
|
120 | },
|
121 |
|
122 | function(module, exports, __webpack_require__) {
|
123 |
|
124 | |
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | 'use strict';
|
138 |
|
139 | var ReactCurrentOwner = __webpack_require__(4);
|
140 | var ReactDOMTextComponent = __webpack_require__(5);
|
141 | var ReactDefaultInjection = __webpack_require__(70);
|
142 | var ReactInstanceHandles = __webpack_require__(44);
|
143 | var ReactMount = __webpack_require__(27);
|
144 | var ReactPerf = __webpack_require__(17);
|
145 | var ReactReconciler = __webpack_require__(49);
|
146 | var ReactUpdates = __webpack_require__(53);
|
147 | var ReactVersion = __webpack_require__(145);
|
148 |
|
149 | var findDOMNode = __webpack_require__(90);
|
150 | var renderSubtreeIntoContainer = __webpack_require__(146);
|
151 | var warning = __webpack_require__(24);
|
152 |
|
153 | ReactDefaultInjection.inject();
|
154 |
|
155 | var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
156 |
|
157 | var React = {
|
158 | findDOMNode: findDOMNode,
|
159 | render: render,
|
160 | unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
161 | version: ReactVersion,
|
162 |
|
163 |
|
164 | unstable_batchedUpdates: ReactUpdates.batchedUpdates,
|
165 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
|
166 | };
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
172 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
173 | CurrentOwner: ReactCurrentOwner,
|
174 | InstanceHandles: ReactInstanceHandles,
|
175 | Mount: ReactMount,
|
176 | Reconciler: ReactReconciler,
|
177 | TextComponent: ReactDOMTextComponent
|
178 | });
|
179 | }
|
180 |
|
181 | if (true) {
|
182 | var ExecutionEnvironment = __webpack_require__(8);
|
183 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
|
184 |
|
185 |
|
186 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
187 |
|
188 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
|
189 | console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
|
190 | }
|
191 | }
|
192 |
|
193 |
|
194 |
|
195 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
196 |
|
197 | true ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
|
198 |
|
199 | var expectedFeatures = [
|
200 |
|
201 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
|
202 |
|
203 |
|
204 | Object.create, Object.freeze];
|
205 |
|
206 | for (var i = 0; i < expectedFeatures.length; i++) {
|
207 | if (!expectedFeatures[i]) {
|
208 | console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
|
209 | break;
|
210 | }
|
211 | }
|
212 | }
|
213 | }
|
214 |
|
215 | module.exports = React;
|
216 |
|
217 | },
|
218 |
|
219 | function(module, exports) {
|
220 |
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 | 'use strict';
|
233 |
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 | var ReactCurrentOwner = {
|
241 |
|
242 | |
243 |
|
244 |
|
245 |
|
246 | current: null
|
247 |
|
248 | };
|
249 |
|
250 | module.exports = ReactCurrentOwner;
|
251 |
|
252 | },
|
253 |
|
254 | function(module, exports, __webpack_require__) {
|
255 |
|
256 | |
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | 'use strict';
|
269 |
|
270 | var DOMChildrenOperations = __webpack_require__(6);
|
271 | var DOMPropertyOperations = __webpack_require__(21);
|
272 | var ReactComponentBrowserEnvironment = __webpack_require__(25);
|
273 | var ReactMount = __webpack_require__(27);
|
274 |
|
275 | var assign = __webpack_require__(38);
|
276 | var escapeTextContentForBrowser = __webpack_require__(20);
|
277 | var setTextContent = __webpack_require__(19);
|
278 | var validateDOMNesting = __webpack_require__(69);
|
279 |
|
280 | |
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | var ReactDOMTextComponent = function (props) {
|
296 |
|
297 | };
|
298 |
|
299 | assign(ReactDOMTextComponent.prototype, {
|
300 |
|
301 | |
302 |
|
303 |
|
304 |
|
305 | construct: function (text) {
|
306 |
|
307 | this._currentElement = text;
|
308 | this._stringText = '' + text;
|
309 |
|
310 |
|
311 | this._rootNodeID = null;
|
312 | this._mountIndex = 0;
|
313 | },
|
314 |
|
315 | |
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | mountComponent: function (rootID, transaction, context) {
|
325 | if (true) {
|
326 | if (context[validateDOMNesting.ancestorInfoContextKey]) {
|
327 | validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
|
328 | }
|
329 | }
|
330 |
|
331 | this._rootNodeID = rootID;
|
332 | if (transaction.useCreateElement) {
|
333 | var ownerDocument = context[ReactMount.ownerDocumentContextKey];
|
334 | var el = ownerDocument.createElement('span');
|
335 | DOMPropertyOperations.setAttributeForID(el, rootID);
|
336 |
|
337 | ReactMount.getID(el);
|
338 | setTextContent(el, this._stringText);
|
339 | return el;
|
340 | } else {
|
341 | var escapedText = escapeTextContentForBrowser(this._stringText);
|
342 |
|
343 | if (transaction.renderToStaticMarkup) {
|
344 |
|
345 |
|
346 |
|
347 | return escapedText;
|
348 | }
|
349 |
|
350 | return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
|
351 | }
|
352 | },
|
353 |
|
354 | |
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 | receiveComponent: function (nextText, transaction) {
|
362 | if (nextText !== this._currentElement) {
|
363 | this._currentElement = nextText;
|
364 | var nextStringText = '' + nextText;
|
365 | if (nextStringText !== this._stringText) {
|
366 |
|
367 |
|
368 |
|
369 | this._stringText = nextStringText;
|
370 | var node = ReactMount.getNode(this._rootNodeID);
|
371 | DOMChildrenOperations.updateTextContent(node, nextStringText);
|
372 | }
|
373 | }
|
374 | },
|
375 |
|
376 | unmountComponent: function () {
|
377 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
378 | }
|
379 |
|
380 | });
|
381 |
|
382 | module.exports = ReactDOMTextComponent;
|
383 |
|
384 | },
|
385 |
|
386 | function(module, exports, __webpack_require__) {
|
387 |
|
388 | |
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 | 'use strict';
|
401 |
|
402 | var Danger = __webpack_require__(7);
|
403 | var ReactMultiChildUpdateTypes = __webpack_require__(15);
|
404 | var ReactPerf = __webpack_require__(17);
|
405 |
|
406 | var setInnerHTML = __webpack_require__(18);
|
407 | var setTextContent = __webpack_require__(19);
|
408 | var invariant = __webpack_require__(12);
|
409 |
|
410 | |
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | function insertChildAt(parentNode, childNode, index) {
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 | var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
|
427 |
|
428 | parentNode.insertBefore(childNode, beforeChild);
|
429 | }
|
430 |
|
431 | |
432 |
|
433 |
|
434 | var DOMChildrenOperations = {
|
435 |
|
436 | dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
|
437 |
|
438 | updateTextContent: setTextContent,
|
439 |
|
440 | |
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 | processUpdates: function (updates, markupList) {
|
449 | var update;
|
450 |
|
451 | var initialChildren = null;
|
452 |
|
453 | var updatedChildren = null;
|
454 |
|
455 | for (var i = 0; i < updates.length; i++) {
|
456 | update = updates[i];
|
457 | if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
|
458 | var updatedIndex = update.fromIndex;
|
459 | var updatedChild = update.parentNode.childNodes[updatedIndex];
|
460 | var parentID = update.parentID;
|
461 |
|
462 | !updatedChild ? true ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
|
463 |
|
464 | initialChildren = initialChildren || {};
|
465 | initialChildren[parentID] = initialChildren[parentID] || [];
|
466 | initialChildren[parentID][updatedIndex] = updatedChild;
|
467 |
|
468 | updatedChildren = updatedChildren || [];
|
469 | updatedChildren.push(updatedChild);
|
470 | }
|
471 | }
|
472 |
|
473 | var renderedMarkup;
|
474 |
|
475 | if (markupList.length && typeof markupList[0] === 'string') {
|
476 | renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
|
477 | } else {
|
478 | renderedMarkup = markupList;
|
479 | }
|
480 |
|
481 |
|
482 | if (updatedChildren) {
|
483 | for (var j = 0; j < updatedChildren.length; j++) {
|
484 | updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
|
485 | }
|
486 | }
|
487 |
|
488 | for (var k = 0; k < updates.length; k++) {
|
489 | update = updates[k];
|
490 | switch (update.type) {
|
491 | case ReactMultiChildUpdateTypes.INSERT_MARKUP:
|
492 | insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
|
493 | break;
|
494 | case ReactMultiChildUpdateTypes.MOVE_EXISTING:
|
495 | insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
|
496 | break;
|
497 | case ReactMultiChildUpdateTypes.SET_MARKUP:
|
498 | setInnerHTML(update.parentNode, update.content);
|
499 | break;
|
500 | case ReactMultiChildUpdateTypes.TEXT_CONTENT:
|
501 | setTextContent(update.parentNode, update.content);
|
502 | break;
|
503 | case ReactMultiChildUpdateTypes.REMOVE_NODE:
|
504 |
|
505 | break;
|
506 | }
|
507 | }
|
508 | }
|
509 |
|
510 | };
|
511 |
|
512 | ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
|
513 | updateTextContent: 'updateTextContent'
|
514 | });
|
515 |
|
516 | module.exports = DOMChildrenOperations;
|
517 |
|
518 | },
|
519 |
|
520 | function(module, exports, __webpack_require__) {
|
521 |
|
522 | |
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | 'use strict';
|
535 |
|
536 | var ExecutionEnvironment = __webpack_require__(8);
|
537 |
|
538 | var createNodesFromMarkup = __webpack_require__(9);
|
539 | var emptyFunction = __webpack_require__(14);
|
540 | var getMarkupWrap = __webpack_require__(13);
|
541 | var invariant = __webpack_require__(12);
|
542 |
|
543 | var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
|
544 | var RESULT_INDEX_ATTR = 'data-danger-index';
|
545 |
|
546 | |
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 | function getNodeName(markup) {
|
558 | return markup.substring(1, markup.indexOf(' '));
|
559 | }
|
560 |
|
561 | var Danger = {
|
562 |
|
563 | |
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | dangerouslyRenderMarkup: function (markupList) {
|
573 | !ExecutionEnvironment.canUseDOM ? true ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
|
574 | var nodeName;
|
575 | var markupByNodeName = {};
|
576 |
|
577 | for (var i = 0; i < markupList.length; i++) {
|
578 | !markupList[i] ? true ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
|
579 | nodeName = getNodeName(markupList[i]);
|
580 | nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
|
581 | markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
|
582 | markupByNodeName[nodeName][i] = markupList[i];
|
583 | }
|
584 | var resultList = [];
|
585 | var resultListAssignmentCount = 0;
|
586 | for (nodeName in markupByNodeName) {
|
587 | if (!markupByNodeName.hasOwnProperty(nodeName)) {
|
588 | continue;
|
589 | }
|
590 | var markupListByNodeName = markupByNodeName[nodeName];
|
591 |
|
592 |
|
593 |
|
594 |
|
595 | var resultIndex;
|
596 | for (resultIndex in markupListByNodeName) {
|
597 | if (markupListByNodeName.hasOwnProperty(resultIndex)) {
|
598 | var markup = markupListByNodeName[resultIndex];
|
599 |
|
600 |
|
601 |
|
602 |
|
603 | markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
|
604 |
|
605 | '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
|
606 | }
|
607 | }
|
608 |
|
609 |
|
610 | var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction
|
611 | );
|
612 |
|
613 | for (var j = 0; j < renderNodes.length; ++j) {
|
614 | var renderNode = renderNodes[j];
|
615 | if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
|
616 |
|
617 | resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
|
618 | renderNode.removeAttribute(RESULT_INDEX_ATTR);
|
619 |
|
620 | !!resultList.hasOwnProperty(resultIndex) ? true ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
|
621 |
|
622 | resultList[resultIndex] = renderNode;
|
623 |
|
624 |
|
625 |
|
626 | resultListAssignmentCount += 1;
|
627 | } else if (true) {
|
628 | console.error('Danger: Discarding unexpected node:', renderNode);
|
629 | }
|
630 | }
|
631 | }
|
632 |
|
633 |
|
634 |
|
635 | !(resultListAssignmentCount === resultList.length) ? true ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
|
636 |
|
637 | !(resultList.length === markupList.length) ? true ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
|
638 |
|
639 | return resultList;
|
640 | },
|
641 |
|
642 | |
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
|
651 | !ExecutionEnvironment.canUseDOM ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
|
652 | !markup ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
|
653 | !(oldChild.tagName.toLowerCase() !== 'html') ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
|
654 |
|
655 | var newChild;
|
656 | if (typeof markup === 'string') {
|
657 | newChild = createNodesFromMarkup(markup, emptyFunction)[0];
|
658 | } else {
|
659 | newChild = markup;
|
660 | }
|
661 | oldChild.parentNode.replaceChild(newChild, oldChild);
|
662 | }
|
663 |
|
664 | };
|
665 |
|
666 | module.exports = Danger;
|
667 |
|
668 | },
|
669 |
|
670 | function(module, exports) {
|
671 |
|
672 | |
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | 'use strict';
|
684 |
|
685 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
686 |
|
687 | |
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 | var ExecutionEnvironment = {
|
694 |
|
695 | canUseDOM: canUseDOM,
|
696 |
|
697 | canUseWorkers: typeof Worker !== 'undefined',
|
698 |
|
699 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
|
700 |
|
701 | canUseViewport: canUseDOM && !!window.screen,
|
702 |
|
703 | isInWorker: !canUseDOM
|
704 |
|
705 | };
|
706 |
|
707 | module.exports = ExecutionEnvironment;
|
708 |
|
709 | },
|
710 |
|
711 | function(module, exports, __webpack_require__) {
|
712 |
|
713 | |
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 | 'use strict';
|
728 |
|
729 | var ExecutionEnvironment = __webpack_require__(8);
|
730 |
|
731 | var createArrayFromMixed = __webpack_require__(10);
|
732 | var getMarkupWrap = __webpack_require__(13);
|
733 | var invariant = __webpack_require__(12);
|
734 |
|
735 | |
736 |
|
737 |
|
738 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
739 |
|
740 | |
741 |
|
742 |
|
743 | var nodeNamePattern = /^\s*<(\w+)/;
|
744 |
|
745 | |
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 | function getNodeName(markup) {
|
752 | var nodeNameMatch = markup.match(nodeNamePattern);
|
753 | return nodeNameMatch && nodeNameMatch[1].toLowerCase();
|
754 | }
|
755 |
|
756 | |
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 | function createNodesFromMarkup(markup, handleScript) {
|
767 | var node = dummyNode;
|
768 | !!!dummyNode ? true ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
|
769 | var nodeName = getNodeName(markup);
|
770 |
|
771 | var wrap = nodeName && getMarkupWrap(nodeName);
|
772 | if (wrap) {
|
773 | node.innerHTML = wrap[1] + markup + wrap[2];
|
774 |
|
775 | var wrapDepth = wrap[0];
|
776 | while (wrapDepth--) {
|
777 | node = node.lastChild;
|
778 | }
|
779 | } else {
|
780 | node.innerHTML = markup;
|
781 | }
|
782 |
|
783 | var scripts = node.getElementsByTagName('script');
|
784 | if (scripts.length) {
|
785 | !handleScript ? true ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
|
786 | createArrayFromMixed(scripts).forEach(handleScript);
|
787 | }
|
788 |
|
789 | var nodes = createArrayFromMixed(node.childNodes);
|
790 | while (node.lastChild) {
|
791 | node.removeChild(node.lastChild);
|
792 | }
|
793 | return nodes;
|
794 | }
|
795 |
|
796 | module.exports = createNodesFromMarkup;
|
797 |
|
798 | },
|
799 |
|
800 | function(module, exports, __webpack_require__) {
|
801 |
|
802 | |
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 | 'use strict';
|
815 |
|
816 | var toArray = __webpack_require__(11);
|
817 |
|
818 | |
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 | function hasArrayNature(obj) {
|
834 | return(
|
835 |
|
836 | !!obj && (
|
837 |
|
838 | typeof obj == 'object' || typeof obj == 'function') &&
|
839 |
|
840 | 'length' in obj &&
|
841 |
|
842 | !('setInterval' in obj) &&
|
843 |
|
844 |
|
845 | typeof obj.nodeType != 'number' && (
|
846 |
|
847 | Array.isArray(obj) ||
|
848 |
|
849 | 'callee' in obj ||
|
850 |
|
851 | 'item' in obj)
|
852 | );
|
853 | }
|
854 |
|
855 | |
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 | function createArrayFromMixed(obj) {
|
877 | if (!hasArrayNature(obj)) {
|
878 | return [obj];
|
879 | } else if (Array.isArray(obj)) {
|
880 | return obj.slice();
|
881 | } else {
|
882 | return toArray(obj);
|
883 | }
|
884 | }
|
885 |
|
886 | module.exports = createArrayFromMixed;
|
887 |
|
888 | },
|
889 |
|
890 | function(module, exports, __webpack_require__) {
|
891 |
|
892 | |
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 | 'use strict';
|
905 |
|
906 | var invariant = __webpack_require__(12);
|
907 |
|
908 | |
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 | function toArray(obj) {
|
918 | var length = obj.length;
|
919 |
|
920 |
|
921 |
|
922 | !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? true ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
|
923 |
|
924 | !(typeof length === 'number') ? true ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
|
925 |
|
926 | !(length === 0 || length - 1 in obj) ? true ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | if (obj.hasOwnProperty) {
|
932 | try {
|
933 | return Array.prototype.slice.call(obj);
|
934 | } catch (e) {
|
935 |
|
936 | }
|
937 | }
|
938 |
|
939 |
|
940 |
|
941 | var ret = Array(length);
|
942 | for (var ii = 0; ii < length; ii++) {
|
943 | ret[ii] = obj[ii];
|
944 | }
|
945 | return ret;
|
946 | }
|
947 |
|
948 | module.exports = toArray;
|
949 |
|
950 | },
|
951 |
|
952 | function(module, exports, __webpack_require__) {
|
953 |
|
954 | |
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 | 'use strict';
|
966 |
|
967 | |
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 | function invariant(condition, format, a, b, c, d, e, f) {
|
979 | if (true) {
|
980 | if (format === undefined) {
|
981 | throw new Error('invariant requires an error message argument');
|
982 | }
|
983 | }
|
984 |
|
985 | if (!condition) {
|
986 | var error;
|
987 | if (format === undefined) {
|
988 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
989 | } else {
|
990 | var args = [a, b, c, d, e, f];
|
991 | var argIndex = 0;
|
992 | error = new Error(format.replace(/%s/g, function () {
|
993 | return args[argIndex++];
|
994 | }));
|
995 | error.name = 'Invariant Violation';
|
996 | }
|
997 |
|
998 | error.framesToPop = 1;
|
999 | throw error;
|
1000 | }
|
1001 | }
|
1002 |
|
1003 | module.exports = invariant;
|
1004 |
|
1005 | },
|
1006 |
|
1007 | function(module, exports, __webpack_require__) {
|
1008 |
|
1009 | |
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 | 'use strict';
|
1023 |
|
1024 | var ExecutionEnvironment = __webpack_require__(8);
|
1025 |
|
1026 | var invariant = __webpack_require__(12);
|
1027 |
|
1028 | |
1029 |
|
1030 |
|
1031 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
1032 |
|
1033 | |
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 | var shouldWrap = {};
|
1041 |
|
1042 | var selectWrap = [1, '<select multiple="true">', '</select>'];
|
1043 | var tableWrap = [1, '<table>', '</table>'];
|
1044 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
|
1045 |
|
1046 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
|
1047 |
|
1048 | var markupWrap = {
|
1049 | '*': [1, '?<div>', '</div>'],
|
1050 |
|
1051 | 'area': [1, '<map>', '</map>'],
|
1052 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
|
1053 | 'legend': [1, '<fieldset>', '</fieldset>'],
|
1054 | 'param': [1, '<object>', '</object>'],
|
1055 | 'tr': [2, '<table><tbody>', '</tbody></table>'],
|
1056 |
|
1057 | 'optgroup': selectWrap,
|
1058 | 'option': selectWrap,
|
1059 |
|
1060 | 'caption': tableWrap,
|
1061 | 'colgroup': tableWrap,
|
1062 | 'tbody': tableWrap,
|
1063 | 'tfoot': tableWrap,
|
1064 | 'thead': tableWrap,
|
1065 |
|
1066 | 'td': trWrap,
|
1067 | 'th': trWrap
|
1068 | };
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
|
1074 | svgElements.forEach(function (nodeName) {
|
1075 | markupWrap[nodeName] = svgWrap;
|
1076 | shouldWrap[nodeName] = true;
|
1077 | });
|
1078 |
|
1079 | |
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | function getMarkupWrap(nodeName) {
|
1088 | !!!dummyNode ? true ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
|
1089 | if (!markupWrap.hasOwnProperty(nodeName)) {
|
1090 | nodeName = '*';
|
1091 | }
|
1092 | if (!shouldWrap.hasOwnProperty(nodeName)) {
|
1093 | if (nodeName === '*') {
|
1094 | dummyNode.innerHTML = '<link />';
|
1095 | } else {
|
1096 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
|
1097 | }
|
1098 | shouldWrap[nodeName] = !dummyNode.firstChild;
|
1099 | }
|
1100 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
|
1101 | }
|
1102 |
|
1103 | module.exports = getMarkupWrap;
|
1104 |
|
1105 | },
|
1106 |
|
1107 | function(module, exports) {
|
1108 |
|
1109 | |
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 | "use strict";
|
1121 |
|
1122 | function makeEmptyFunction(arg) {
|
1123 | return function () {
|
1124 | return arg;
|
1125 | };
|
1126 | }
|
1127 |
|
1128 | |
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 | function emptyFunction() {}
|
1134 |
|
1135 | emptyFunction.thatReturns = makeEmptyFunction;
|
1136 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
1137 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
1138 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
1139 | emptyFunction.thatReturnsThis = function () {
|
1140 | return this;
|
1141 | };
|
1142 | emptyFunction.thatReturnsArgument = function (arg) {
|
1143 | return arg;
|
1144 | };
|
1145 |
|
1146 | module.exports = emptyFunction;
|
1147 |
|
1148 | },
|
1149 |
|
1150 | function(module, exports, __webpack_require__) {
|
1151 |
|
1152 | |
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 | 'use strict';
|
1164 |
|
1165 | var keyMirror = __webpack_require__(16);
|
1166 |
|
1167 | |
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | var ReactMultiChildUpdateTypes = keyMirror({
|
1176 | INSERT_MARKUP: null,
|
1177 | MOVE_EXISTING: null,
|
1178 | REMOVE_NODE: null,
|
1179 | SET_MARKUP: null,
|
1180 | TEXT_CONTENT: null
|
1181 | });
|
1182 |
|
1183 | module.exports = ReactMultiChildUpdateTypes;
|
1184 |
|
1185 | },
|
1186 |
|
1187 | function(module, exports, __webpack_require__) {
|
1188 |
|
1189 | |
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 | 'use strict';
|
1202 |
|
1203 | var invariant = __webpack_require__(12);
|
1204 |
|
1205 | |
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 | var keyMirror = function (obj) {
|
1224 | var ret = {};
|
1225 | var key;
|
1226 | !(obj instanceof Object && !Array.isArray(obj)) ? true ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
|
1227 | for (key in obj) {
|
1228 | if (!obj.hasOwnProperty(key)) {
|
1229 | continue;
|
1230 | }
|
1231 | ret[key] = key;
|
1232 | }
|
1233 | return ret;
|
1234 | };
|
1235 |
|
1236 | module.exports = keyMirror;
|
1237 |
|
1238 | },
|
1239 |
|
1240 | function(module, exports, __webpack_require__) {
|
1241 |
|
1242 | |
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 | 'use strict';
|
1255 |
|
1256 | |
1257 |
|
1258 |
|
1259 |
|
1260 | var ReactPerf = {
|
1261 | |
1262 |
|
1263 |
|
1264 |
|
1265 | enableMeasure: false,
|
1266 |
|
1267 | |
1268 |
|
1269 |
|
1270 |
|
1271 | storedMeasure: _noMeasure,
|
1272 |
|
1273 | |
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 | measureMethods: function (object, objectName, methodNames) {
|
1279 | if (true) {
|
1280 | for (var key in methodNames) {
|
1281 | if (!methodNames.hasOwnProperty(key)) {
|
1282 | continue;
|
1283 | }
|
1284 | object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
|
1285 | }
|
1286 | }
|
1287 | },
|
1288 |
|
1289 | |
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 | measure: function (objName, fnName, func) {
|
1298 | if (true) {
|
1299 | var measuredFunc = null;
|
1300 | var wrapper = function () {
|
1301 | if (ReactPerf.enableMeasure) {
|
1302 | if (!measuredFunc) {
|
1303 | measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
|
1304 | }
|
1305 | return measuredFunc.apply(this, arguments);
|
1306 | }
|
1307 | return func.apply(this, arguments);
|
1308 | };
|
1309 | wrapper.displayName = objName + '_' + fnName;
|
1310 | return wrapper;
|
1311 | }
|
1312 | return func;
|
1313 | },
|
1314 |
|
1315 | injection: {
|
1316 | |
1317 |
|
1318 |
|
1319 | injectMeasure: function (measure) {
|
1320 | ReactPerf.storedMeasure = measure;
|
1321 | }
|
1322 | }
|
1323 | };
|
1324 |
|
1325 | |
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 | function _noMeasure(objName, fnName, func) {
|
1334 | return func;
|
1335 | }
|
1336 |
|
1337 | module.exports = ReactPerf;
|
1338 |
|
1339 | },
|
1340 |
|
1341 | function(module, exports, __webpack_require__) {
|
1342 |
|
1343 | |
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | 'use strict';
|
1357 |
|
1358 | var ExecutionEnvironment = __webpack_require__(8);
|
1359 |
|
1360 | var WHITESPACE_TEST = /^[ \r\n\t\f]/;
|
1361 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
|
1362 |
|
1363 | |
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 | var setInnerHTML = function (node, html) {
|
1372 | node.innerHTML = html;
|
1373 | };
|
1374 |
|
1375 |
|
1376 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
1377 | setInnerHTML = function (node, html) {
|
1378 | MSApp.execUnsafeLocalFunction(function () {
|
1379 | node.innerHTML = html;
|
1380 | });
|
1381 | };
|
1382 | }
|
1383 |
|
1384 | if (ExecutionEnvironment.canUseDOM) {
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 | var testElement = document.createElement('div');
|
1392 | testElement.innerHTML = ' ';
|
1393 | if (testElement.innerHTML === '') {
|
1394 | setInnerHTML = function (node, html) {
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 | if (node.parentNode) {
|
1401 | node.parentNode.replaceChild(node, node);
|
1402 | }
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 | node.innerHTML = String.fromCharCode(0xFEFF) + html;
|
1416 |
|
1417 |
|
1418 |
|
1419 | var textNode = node.firstChild;
|
1420 | if (textNode.data.length === 1) {
|
1421 | node.removeChild(textNode);
|
1422 | } else {
|
1423 | textNode.deleteData(0, 1);
|
1424 | }
|
1425 | } else {
|
1426 | node.innerHTML = html;
|
1427 | }
|
1428 | };
|
1429 | }
|
1430 | }
|
1431 |
|
1432 | module.exports = setInnerHTML;
|
1433 |
|
1434 | },
|
1435 |
|
1436 | function(module, exports, __webpack_require__) {
|
1437 |
|
1438 | |
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 | 'use strict';
|
1450 |
|
1451 | var ExecutionEnvironment = __webpack_require__(8);
|
1452 | var escapeTextContentForBrowser = __webpack_require__(20);
|
1453 | var setInnerHTML = __webpack_require__(18);
|
1454 |
|
1455 | |
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 | var setTextContent = function (node, text) {
|
1466 | node.textContent = text;
|
1467 | };
|
1468 |
|
1469 | if (ExecutionEnvironment.canUseDOM) {
|
1470 | if (!('textContent' in document.documentElement)) {
|
1471 | setTextContent = function (node, text) {
|
1472 | setInnerHTML(node, escapeTextContentForBrowser(text));
|
1473 | };
|
1474 | }
|
1475 | }
|
1476 |
|
1477 | module.exports = setTextContent;
|
1478 |
|
1479 | },
|
1480 |
|
1481 | function(module, exports) {
|
1482 |
|
1483 | |
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 | 'use strict';
|
1495 |
|
1496 | var ESCAPE_LOOKUP = {
|
1497 | '&': '&',
|
1498 | '>': '>',
|
1499 | '<': '<',
|
1500 | '"': '"',
|
1501 | '\'': '''
|
1502 | };
|
1503 |
|
1504 | var ESCAPE_REGEX = /[&><"']/g;
|
1505 |
|
1506 | function escaper(match) {
|
1507 | return ESCAPE_LOOKUP[match];
|
1508 | }
|
1509 |
|
1510 | |
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 | function escapeTextContentForBrowser(text) {
|
1517 | return ('' + text).replace(ESCAPE_REGEX, escaper);
|
1518 | }
|
1519 |
|
1520 | module.exports = escapeTextContentForBrowser;
|
1521 |
|
1522 | },
|
1523 |
|
1524 | function(module, exports, __webpack_require__) {
|
1525 |
|
1526 | |
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 | 'use strict';
|
1539 |
|
1540 | var DOMProperty = __webpack_require__(22);
|
1541 | var ReactPerf = __webpack_require__(17);
|
1542 |
|
1543 | var quoteAttributeValueForBrowser = __webpack_require__(23);
|
1544 | var warning = __webpack_require__(24);
|
1545 |
|
1546 |
|
1547 | var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
|
1548 | var illegalAttributeNameCache = {};
|
1549 | var validatedAttributeNameCache = {};
|
1550 |
|
1551 | function isAttributeNameSafe(attributeName) {
|
1552 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
|
1553 | return true;
|
1554 | }
|
1555 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
|
1556 | return false;
|
1557 | }
|
1558 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
1559 | validatedAttributeNameCache[attributeName] = true;
|
1560 | return true;
|
1561 | }
|
1562 | illegalAttributeNameCache[attributeName] = true;
|
1563 | true ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
|
1564 | return false;
|
1565 | }
|
1566 |
|
1567 | function shouldIgnoreValue(propertyInfo, value) {
|
1568 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
|
1569 | }
|
1570 |
|
1571 | if (true) {
|
1572 | var reactProps = {
|
1573 | children: true,
|
1574 | dangerouslySetInnerHTML: true,
|
1575 | key: true,
|
1576 | ref: true
|
1577 | };
|
1578 | var warnedProperties = {};
|
1579 |
|
1580 | var warnUnknownProperty = function (name) {
|
1581 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
|
1582 | return;
|
1583 | }
|
1584 |
|
1585 | warnedProperties[name] = true;
|
1586 | var lowerCasedName = name.toLowerCase();
|
1587 |
|
1588 |
|
1589 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
|
1590 |
|
1591 |
|
1592 |
|
1593 | true ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
|
1594 | };
|
1595 | }
|
1596 |
|
1597 | |
1598 |
|
1599 |
|
1600 | var DOMPropertyOperations = {
|
1601 |
|
1602 | |
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 | createMarkupForID: function (id) {
|
1609 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
|
1610 | },
|
1611 |
|
1612 | setAttributeForID: function (node, id) {
|
1613 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
|
1614 | },
|
1615 |
|
1616 | |
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 | createMarkupForProperty: function (name, value) {
|
1624 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1625 | if (propertyInfo) {
|
1626 | if (shouldIgnoreValue(propertyInfo, value)) {
|
1627 | return '';
|
1628 | }
|
1629 | var attributeName = propertyInfo.attributeName;
|
1630 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
|
1631 | return attributeName + '=""';
|
1632 | }
|
1633 | return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
1634 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1635 | if (value == null) {
|
1636 | return '';
|
1637 | }
|
1638 | return name + '=' + quoteAttributeValueForBrowser(value);
|
1639 | } else if (true) {
|
1640 | warnUnknownProperty(name);
|
1641 | }
|
1642 | return null;
|
1643 | },
|
1644 |
|
1645 | |
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 | createMarkupForCustomAttribute: function (name, value) {
|
1653 | if (!isAttributeNameSafe(name) || value == null) {
|
1654 | return '';
|
1655 | }
|
1656 | return name + '=' + quoteAttributeValueForBrowser(value);
|
1657 | },
|
1658 |
|
1659 | |
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 | setValueForProperty: function (node, name, value) {
|
1667 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1668 | if (propertyInfo) {
|
1669 | var mutationMethod = propertyInfo.mutationMethod;
|
1670 | if (mutationMethod) {
|
1671 | mutationMethod(node, value);
|
1672 | } else if (shouldIgnoreValue(propertyInfo, value)) {
|
1673 | this.deleteValueForProperty(node, name);
|
1674 | } else if (propertyInfo.mustUseAttribute) {
|
1675 | var attributeName = propertyInfo.attributeName;
|
1676 | var namespace = propertyInfo.attributeNamespace;
|
1677 |
|
1678 |
|
1679 | if (namespace) {
|
1680 | node.setAttributeNS(namespace, attributeName, '' + value);
|
1681 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
|
1682 | node.setAttribute(attributeName, '');
|
1683 | } else {
|
1684 | node.setAttribute(attributeName, '' + value);
|
1685 | }
|
1686 | } else {
|
1687 | var propName = propertyInfo.propertyName;
|
1688 |
|
1689 |
|
1690 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
|
1691 |
|
1692 |
|
1693 | node[propName] = value;
|
1694 | }
|
1695 | }
|
1696 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1697 | DOMPropertyOperations.setValueForAttribute(node, name, value);
|
1698 | } else if (true) {
|
1699 | warnUnknownProperty(name);
|
1700 | }
|
1701 | },
|
1702 |
|
1703 | setValueForAttribute: function (node, name, value) {
|
1704 | if (!isAttributeNameSafe(name)) {
|
1705 | return;
|
1706 | }
|
1707 | if (value == null) {
|
1708 | node.removeAttribute(name);
|
1709 | } else {
|
1710 | node.setAttribute(name, '' + value);
|
1711 | }
|
1712 | },
|
1713 |
|
1714 | |
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 | deleteValueForProperty: function (node, name) {
|
1721 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1722 | if (propertyInfo) {
|
1723 | var mutationMethod = propertyInfo.mutationMethod;
|
1724 | if (mutationMethod) {
|
1725 | mutationMethod(node, undefined);
|
1726 | } else if (propertyInfo.mustUseAttribute) {
|
1727 | node.removeAttribute(propertyInfo.attributeName);
|
1728 | } else {
|
1729 | var propName = propertyInfo.propertyName;
|
1730 | var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
|
1731 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
|
1732 | node[propName] = defaultValue;
|
1733 | }
|
1734 | }
|
1735 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1736 | node.removeAttribute(name);
|
1737 | } else if (true) {
|
1738 | warnUnknownProperty(name);
|
1739 | }
|
1740 | }
|
1741 |
|
1742 | };
|
1743 |
|
1744 | ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
|
1745 | setValueForProperty: 'setValueForProperty',
|
1746 | setValueForAttribute: 'setValueForAttribute',
|
1747 | deleteValueForProperty: 'deleteValueForProperty'
|
1748 | });
|
1749 |
|
1750 | module.exports = DOMPropertyOperations;
|
1751 |
|
1752 | },
|
1753 |
|
1754 | function(module, exports, __webpack_require__) {
|
1755 |
|
1756 | |
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 | 'use strict';
|
1769 |
|
1770 | var invariant = __webpack_require__(12);
|
1771 |
|
1772 | function checkMask(value, bitmask) {
|
1773 | return (value & bitmask) === bitmask;
|
1774 | }
|
1775 |
|
1776 | var DOMPropertyInjection = {
|
1777 | |
1778 |
|
1779 |
|
1780 |
|
1781 | MUST_USE_ATTRIBUTE: 0x1,
|
1782 | MUST_USE_PROPERTY: 0x2,
|
1783 | HAS_SIDE_EFFECTS: 0x4,
|
1784 | HAS_BOOLEAN_VALUE: 0x8,
|
1785 | HAS_NUMERIC_VALUE: 0x10,
|
1786 | HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
|
1787 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
|
1788 |
|
1789 | |
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 | injectDOMPropertyConfig: function (domPropertyConfig) {
|
1818 | var Injection = DOMPropertyInjection;
|
1819 | var Properties = domPropertyConfig.Properties || {};
|
1820 | var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
|
1821 | var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
|
1822 | var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
|
1823 | var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
|
1824 |
|
1825 | if (domPropertyConfig.isCustomAttribute) {
|
1826 | DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
|
1827 | }
|
1828 |
|
1829 | for (var propName in Properties) {
|
1830 | !!DOMProperty.properties.hasOwnProperty(propName) ? true ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
|
1831 |
|
1832 | var lowerCased = propName.toLowerCase();
|
1833 | var propConfig = Properties[propName];
|
1834 |
|
1835 | var propertyInfo = {
|
1836 | attributeName: lowerCased,
|
1837 | attributeNamespace: null,
|
1838 | propertyName: propName,
|
1839 | mutationMethod: null,
|
1840 |
|
1841 | mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
|
1842 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
|
1843 | hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
|
1844 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
|
1845 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
|
1846 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
|
1847 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
|
1848 | };
|
1849 |
|
1850 | !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? true ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
|
1851 | !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? true ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
|
1852 | !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? true ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
|
1853 |
|
1854 | if (true) {
|
1855 | DOMProperty.getPossibleStandardName[lowerCased] = propName;
|
1856 | }
|
1857 |
|
1858 | if (DOMAttributeNames.hasOwnProperty(propName)) {
|
1859 | var attributeName = DOMAttributeNames[propName];
|
1860 | propertyInfo.attributeName = attributeName;
|
1861 | if (true) {
|
1862 | DOMProperty.getPossibleStandardName[attributeName] = propName;
|
1863 | }
|
1864 | }
|
1865 |
|
1866 | if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
|
1867 | propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
|
1868 | }
|
1869 |
|
1870 | if (DOMPropertyNames.hasOwnProperty(propName)) {
|
1871 | propertyInfo.propertyName = DOMPropertyNames[propName];
|
1872 | }
|
1873 |
|
1874 | if (DOMMutationMethods.hasOwnProperty(propName)) {
|
1875 | propertyInfo.mutationMethod = DOMMutationMethods[propName];
|
1876 | }
|
1877 |
|
1878 | DOMProperty.properties[propName] = propertyInfo;
|
1879 | }
|
1880 | }
|
1881 | };
|
1882 | var defaultValueCache = {};
|
1883 |
|
1884 | |
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 | var DOMProperty = {
|
1898 |
|
1899 | ID_ATTRIBUTE_NAME: 'data-reactid',
|
1900 |
|
1901 | |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 | properties: {},
|
1938 |
|
1939 | |
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 | getPossibleStandardName: true ? {} : null,
|
1945 |
|
1946 | |
1947 |
|
1948 |
|
1949 | _isCustomAttributeFunctions: [],
|
1950 |
|
1951 | |
1952 |
|
1953 |
|
1954 |
|
1955 | isCustomAttribute: function (attributeName) {
|
1956 | for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
|
1957 | var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
|
1958 | if (isCustomAttributeFn(attributeName)) {
|
1959 | return true;
|
1960 | }
|
1961 | }
|
1962 | return false;
|
1963 | },
|
1964 |
|
1965 | |
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 | getDefaultValueForProperty: function (nodeName, prop) {
|
1974 | var nodeDefaults = defaultValueCache[nodeName];
|
1975 | var testElement;
|
1976 | if (!nodeDefaults) {
|
1977 | defaultValueCache[nodeName] = nodeDefaults = {};
|
1978 | }
|
1979 | if (!(prop in nodeDefaults)) {
|
1980 | testElement = document.createElement(nodeName);
|
1981 | nodeDefaults[prop] = testElement[prop];
|
1982 | }
|
1983 | return nodeDefaults[prop];
|
1984 | },
|
1985 |
|
1986 | injection: DOMPropertyInjection
|
1987 | };
|
1988 |
|
1989 | module.exports = DOMProperty;
|
1990 |
|
1991 | },
|
1992 |
|
1993 | function(module, exports, __webpack_require__) {
|
1994 |
|
1995 | |
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 | 'use strict';
|
2007 |
|
2008 | var escapeTextContentForBrowser = __webpack_require__(20);
|
2009 |
|
2010 | |
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 | function quoteAttributeValueForBrowser(value) {
|
2017 | return '"' + escapeTextContentForBrowser(value) + '"';
|
2018 | }
|
2019 |
|
2020 | module.exports = quoteAttributeValueForBrowser;
|
2021 |
|
2022 | },
|
2023 |
|
2024 | function(module, exports, __webpack_require__) {
|
2025 |
|
2026 | |
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 | 'use strict';
|
2038 |
|
2039 | var emptyFunction = __webpack_require__(14);
|
2040 |
|
2041 | |
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 | var warning = emptyFunction;
|
2049 |
|
2050 | if (true) {
|
2051 | warning = function (condition, format) {
|
2052 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
2053 | args[_key - 2] = arguments[_key];
|
2054 | }
|
2055 |
|
2056 | if (format === undefined) {
|
2057 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
2058 | }
|
2059 |
|
2060 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
2061 | return;
|
2062 | }
|
2063 |
|
2064 | if (!condition) {
|
2065 | var argIndex = 0;
|
2066 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
2067 | return args[argIndex++];
|
2068 | });
|
2069 | if (typeof console !== 'undefined') {
|
2070 | console.error(message);
|
2071 | }
|
2072 | try {
|
2073 |
|
2074 |
|
2075 |
|
2076 | throw new Error(message);
|
2077 | } catch (x) {}
|
2078 | }
|
2079 | };
|
2080 | }
|
2081 |
|
2082 | module.exports = warning;
|
2083 |
|
2084 | },
|
2085 |
|
2086 | function(module, exports, __webpack_require__) {
|
2087 |
|
2088 | |
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 | 'use strict';
|
2100 |
|
2101 | var ReactDOMIDOperations = __webpack_require__(26);
|
2102 | var ReactMount = __webpack_require__(27);
|
2103 |
|
2104 | |
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 | var ReactComponentBrowserEnvironment = {
|
2110 |
|
2111 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
|
2112 |
|
2113 | replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
|
2114 |
|
2115 | |
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 | unmountIDFromEnvironment: function (rootNodeID) {
|
2123 | ReactMount.purgeID(rootNodeID);
|
2124 | }
|
2125 |
|
2126 | };
|
2127 |
|
2128 | module.exports = ReactComponentBrowserEnvironment;
|
2129 |
|
2130 | },
|
2131 |
|
2132 | function(module, exports, __webpack_require__) {
|
2133 |
|
2134 | |
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 | 'use strict';
|
2147 |
|
2148 | var DOMChildrenOperations = __webpack_require__(6);
|
2149 | var DOMPropertyOperations = __webpack_require__(21);
|
2150 | var ReactMount = __webpack_require__(27);
|
2151 | var ReactPerf = __webpack_require__(17);
|
2152 |
|
2153 | var invariant = __webpack_require__(12);
|
2154 |
|
2155 | |
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 | var INVALID_PROPERTY_ERRORS = {
|
2162 | dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
|
2163 | style: '`style` must be set using `updateStylesByID()`.'
|
2164 | };
|
2165 |
|
2166 | |
2167 |
|
2168 |
|
2169 | var ReactDOMIDOperations = {
|
2170 |
|
2171 | |
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 | updatePropertyByID: function (id, name, value) {
|
2181 | var node = ReactMount.getNode(id);
|
2182 | !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? true ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 | if (value != null) {
|
2188 | DOMPropertyOperations.setValueForProperty(node, name, value);
|
2189 | } else {
|
2190 | DOMPropertyOperations.deleteValueForProperty(node, name);
|
2191 | }
|
2192 | },
|
2193 |
|
2194 | |
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 | dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
|
2203 | var node = ReactMount.getNode(id);
|
2204 | DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
|
2205 | },
|
2206 |
|
2207 | |
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | dangerouslyProcessChildrenUpdates: function (updates, markup) {
|
2215 | for (var i = 0; i < updates.length; i++) {
|
2216 | updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
|
2217 | }
|
2218 | DOMChildrenOperations.processUpdates(updates, markup);
|
2219 | }
|
2220 | };
|
2221 |
|
2222 | ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
|
2223 | dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
|
2224 | dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
|
2225 | });
|
2226 |
|
2227 | module.exports = ReactDOMIDOperations;
|
2228 |
|
2229 | },
|
2230 |
|
2231 | function(module, exports, __webpack_require__) {
|
2232 |
|
2233 | |
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 | 'use strict';
|
2245 |
|
2246 | var DOMProperty = __webpack_require__(22);
|
2247 | var ReactBrowserEventEmitter = __webpack_require__(28);
|
2248 | var ReactCurrentOwner = __webpack_require__(4);
|
2249 | var ReactDOMFeatureFlags = __webpack_require__(40);
|
2250 | var ReactElement = __webpack_require__(41);
|
2251 | var ReactEmptyComponentRegistry = __webpack_require__(43);
|
2252 | var ReactInstanceHandles = __webpack_require__(44);
|
2253 | var ReactInstanceMap = __webpack_require__(46);
|
2254 | var ReactMarkupChecksum = __webpack_require__(47);
|
2255 | var ReactPerf = __webpack_require__(17);
|
2256 | var ReactReconciler = __webpack_require__(49);
|
2257 | var ReactUpdateQueue = __webpack_require__(52);
|
2258 | var ReactUpdates = __webpack_require__(53);
|
2259 |
|
2260 | var assign = __webpack_require__(38);
|
2261 | var emptyObject = __webpack_require__(57);
|
2262 | var containsNode = __webpack_require__(58);
|
2263 | var instantiateReactComponent = __webpack_require__(61);
|
2264 | var invariant = __webpack_require__(12);
|
2265 | var setInnerHTML = __webpack_require__(18);
|
2266 | var shouldUpdateReactComponent = __webpack_require__(66);
|
2267 | var validateDOMNesting = __webpack_require__(69);
|
2268 | var warning = __webpack_require__(24);
|
2269 |
|
2270 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
|
2271 | var nodeCache = {};
|
2272 |
|
2273 | var ELEMENT_NODE_TYPE = 1;
|
2274 | var DOC_NODE_TYPE = 9;
|
2275 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
2276 |
|
2277 | var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
|
2278 |
|
2279 |
|
2280 | var instancesByReactRootID = {};
|
2281 |
|
2282 |
|
2283 | var containersByReactRootID = {};
|
2284 |
|
2285 | if (true) {
|
2286 |
|
2287 | var rootElementsByReactRootID = {};
|
2288 | }
|
2289 |
|
2290 |
|
2291 | var findComponentRootReusableArray = [];
|
2292 |
|
2293 | |
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 | function firstDifferenceIndex(string1, string2) {
|
2300 | var minLen = Math.min(string1.length, string2.length);
|
2301 | for (var i = 0; i < minLen; i++) {
|
2302 | if (string1.charAt(i) !== string2.charAt(i)) {
|
2303 | return i;
|
2304 | }
|
2305 | }
|
2306 | return string1.length === string2.length ? -1 : minLen;
|
2307 | }
|
2308 |
|
2309 | |
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 | function getReactRootElementInContainer(container) {
|
2315 | if (!container) {
|
2316 | return null;
|
2317 | }
|
2318 |
|
2319 | if (container.nodeType === DOC_NODE_TYPE) {
|
2320 | return container.documentElement;
|
2321 | } else {
|
2322 | return container.firstChild;
|
2323 | }
|
2324 | }
|
2325 |
|
2326 | |
2327 |
|
2328 |
|
2329 |
|
2330 | function getReactRootID(container) {
|
2331 | var rootElement = getReactRootElementInContainer(container);
|
2332 | return rootElement && ReactMount.getID(rootElement);
|
2333 | }
|
2334 |
|
2335 | |
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 | function getID(node) {
|
2346 | var id = internalGetID(node);
|
2347 | if (id) {
|
2348 | if (nodeCache.hasOwnProperty(id)) {
|
2349 | var cached = nodeCache[id];
|
2350 | if (cached !== node) {
|
2351 | !!isValid(cached, id) ? true ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
|
2352 |
|
2353 | nodeCache[id] = node;
|
2354 | }
|
2355 | } else {
|
2356 | nodeCache[id] = node;
|
2357 | }
|
2358 | }
|
2359 |
|
2360 | return id;
|
2361 | }
|
2362 |
|
2363 | function internalGetID(node) {
|
2364 |
|
2365 |
|
2366 |
|
2367 | return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
|
2368 | }
|
2369 |
|
2370 | |
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 | function setID(node, id) {
|
2377 | var oldID = internalGetID(node);
|
2378 | if (oldID !== id) {
|
2379 | delete nodeCache[oldID];
|
2380 | }
|
2381 | node.setAttribute(ATTR_NAME, id);
|
2382 | nodeCache[id] = node;
|
2383 | }
|
2384 |
|
2385 | |
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 | function getNode(id) {
|
2393 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
|
2394 | nodeCache[id] = ReactMount.findReactNodeByID(id);
|
2395 | }
|
2396 | return nodeCache[id];
|
2397 | }
|
2398 |
|
2399 | |
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 | function getNodeFromInstance(instance) {
|
2407 | var id = ReactInstanceMap.get(instance)._rootNodeID;
|
2408 | if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
|
2409 | return null;
|
2410 | }
|
2411 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
|
2412 | nodeCache[id] = ReactMount.findReactNodeByID(id);
|
2413 | }
|
2414 | return nodeCache[id];
|
2415 | }
|
2416 |
|
2417 | |
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 | function isValid(node, id) {
|
2428 | if (node) {
|
2429 | !(internalGetID(node) === id) ? true ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
|
2430 |
|
2431 | var container = ReactMount.findReactContainerForID(id);
|
2432 | if (container && containsNode(container, node)) {
|
2433 | return true;
|
2434 | }
|
2435 | }
|
2436 |
|
2437 | return false;
|
2438 | }
|
2439 |
|
2440 | |
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 | function purgeID(id) {
|
2446 | delete nodeCache[id];
|
2447 | }
|
2448 |
|
2449 | var deepestNodeSoFar = null;
|
2450 | function findDeepestCachedAncestorImpl(ancestorID) {
|
2451 | var ancestor = nodeCache[ancestorID];
|
2452 | if (ancestor && isValid(ancestor, ancestorID)) {
|
2453 | deepestNodeSoFar = ancestor;
|
2454 | } else {
|
2455 |
|
2456 |
|
2457 | return false;
|
2458 | }
|
2459 | }
|
2460 |
|
2461 | |
2462 |
|
2463 |
|
2464 | function findDeepestCachedAncestor(targetID) {
|
2465 | deepestNodeSoFar = null;
|
2466 | ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
|
2467 |
|
2468 | var foundNode = deepestNodeSoFar;
|
2469 | deepestNodeSoFar = null;
|
2470 | return foundNode;
|
2471 | }
|
2472 |
|
2473 | |
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 | function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
|
2483 | if (ReactDOMFeatureFlags.useCreateElement) {
|
2484 | context = assign({}, context);
|
2485 | if (container.nodeType === DOC_NODE_TYPE) {
|
2486 | context[ownerDocumentContextKey] = container;
|
2487 | } else {
|
2488 | context[ownerDocumentContextKey] = container.ownerDocument;
|
2489 | }
|
2490 | }
|
2491 | if (true) {
|
2492 | if (context === emptyObject) {
|
2493 | context = {};
|
2494 | }
|
2495 | var tag = container.nodeName.toLowerCase();
|
2496 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
|
2497 | }
|
2498 | var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
|
2499 | componentInstance._renderedComponent._topLevelWrapper = componentInstance;
|
2500 | ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
|
2501 | }
|
2502 |
|
2503 | |
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 | function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
|
2512 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
|
2513 | shouldReuseMarkup);
|
2514 | transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
|
2515 | ReactUpdates.ReactReconcileTransaction.release(transaction);
|
2516 | }
|
2517 |
|
2518 | |
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 | function unmountComponentFromNode(instance, container) {
|
2528 | ReactReconciler.unmountComponent(instance);
|
2529 |
|
2530 | if (container.nodeType === DOC_NODE_TYPE) {
|
2531 | container = container.documentElement;
|
2532 | }
|
2533 |
|
2534 |
|
2535 | while (container.lastChild) {
|
2536 | container.removeChild(container.lastChild);
|
2537 | }
|
2538 | }
|
2539 |
|
2540 | |
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 | function hasNonRootReactChild(node) {
|
2551 | var reactRootID = getReactRootID(node);
|
2552 | return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
|
2553 | }
|
2554 |
|
2555 | |
2556 |
|
2557 |
|
2558 |
|
2559 | function findFirstReactDOMImpl(node) {
|
2560 |
|
2561 |
|
2562 | for (; node && node.parentNode !== node; node = node.parentNode) {
|
2563 | if (node.nodeType !== 1) {
|
2564 |
|
2565 | continue;
|
2566 | }
|
2567 | var nodeID = internalGetID(node);
|
2568 | if (!nodeID) {
|
2569 | continue;
|
2570 | }
|
2571 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 | var current = node;
|
2578 | var lastID;
|
2579 | do {
|
2580 | lastID = internalGetID(current);
|
2581 | current = current.parentNode;
|
2582 | if (current == null) {
|
2583 |
|
2584 |
|
2585 | return null;
|
2586 | }
|
2587 | } while (lastID !== reactRootID);
|
2588 |
|
2589 | if (current === containersByReactRootID[reactRootID]) {
|
2590 | return node;
|
2591 | }
|
2592 | }
|
2593 | return null;
|
2594 | }
|
2595 |
|
2596 | |
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 | var TopLevelWrapper = function () {};
|
2602 | TopLevelWrapper.prototype.isReactComponent = {};
|
2603 | if (true) {
|
2604 | TopLevelWrapper.displayName = 'TopLevelWrapper';
|
2605 | }
|
2606 | TopLevelWrapper.prototype.render = function () {
|
2607 |
|
2608 | return this.props;
|
2609 | };
|
2610 |
|
2611 | |
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 | var ReactMount = {
|
2630 |
|
2631 | TopLevelWrapper: TopLevelWrapper,
|
2632 |
|
2633 |
|
2634 | _instancesByReactRootID: instancesByReactRootID,
|
2635 |
|
2636 | |
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 | scrollMonitor: function (container, renderCallback) {
|
2645 | renderCallback();
|
2646 | },
|
2647 |
|
2648 | |
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 | _updateRootComponent: function (prevComponent, nextElement, container, callback) {
|
2656 | ReactMount.scrollMonitor(container, function () {
|
2657 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
|
2658 | if (callback) {
|
2659 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
|
2660 | }
|
2661 | });
|
2662 |
|
2663 | if (true) {
|
2664 |
|
2665 | rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
|
2666 | }
|
2667 |
|
2668 | return prevComponent;
|
2669 | },
|
2670 |
|
2671 | |
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 | _registerComponent: function (nextComponent, container) {
|
2679 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
2680 |
|
2681 | ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
2682 |
|
2683 | var reactRootID = ReactMount.registerContainer(container);
|
2684 | instancesByReactRootID[reactRootID] = nextComponent;
|
2685 | return reactRootID;
|
2686 | },
|
2687 |
|
2688 | |
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
|
2696 |
|
2697 |
|
2698 |
|
2699 | true ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
2700 |
|
2701 | var componentInstance = instantiateReactComponent(nextElement, null);
|
2702 | var reactRootID = ReactMount._registerComponent(componentInstance, container);
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
|
2709 |
|
2710 | if (true) {
|
2711 |
|
2712 | rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
|
2713 | }
|
2714 |
|
2715 | return componentInstance;
|
2716 | },
|
2717 |
|
2718 | |
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
2732 | !(parentComponent != null && parentComponent._reactInternalInstance != null) ? true ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
|
2733 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
|
2734 | },
|
2735 |
|
2736 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
2737 | !ReactElement.isValidElement(nextElement) ? true ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
|
2738 |
|
2739 | nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
|
2740 |
|
2741 | true ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
|
2742 |
|
2743 | var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
|
2744 |
|
2745 | var prevComponent = instancesByReactRootID[getReactRootID(container)];
|
2746 |
|
2747 | if (prevComponent) {
|
2748 | var prevWrappedElement = prevComponent._currentElement;
|
2749 | var prevElement = prevWrappedElement.props;
|
2750 | if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
2751 | var publicInst = prevComponent._renderedComponent.getPublicInstance();
|
2752 | var updatedCallback = callback && function () {
|
2753 | callback.call(publicInst);
|
2754 | };
|
2755 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
|
2756 | return publicInst;
|
2757 | } else {
|
2758 | ReactMount.unmountComponentAtNode(container);
|
2759 | }
|
2760 | }
|
2761 |
|
2762 | var reactRootElement = getReactRootElementInContainer(container);
|
2763 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
|
2764 | var containerHasNonRootReactChild = hasNonRootReactChild(container);
|
2765 |
|
2766 | if (true) {
|
2767 | true ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
|
2768 |
|
2769 | if (!containerHasReactMarkup || reactRootElement.nextSibling) {
|
2770 | var rootElementSibling = reactRootElement;
|
2771 | while (rootElementSibling) {
|
2772 | if (internalGetID(rootElementSibling)) {
|
2773 | true ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
|
2774 | break;
|
2775 | }
|
2776 | rootElementSibling = rootElementSibling.nextSibling;
|
2777 | }
|
2778 | }
|
2779 | }
|
2780 |
|
2781 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
|
2782 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
|
2783 | if (callback) {
|
2784 | callback.call(component);
|
2785 | }
|
2786 | return component;
|
2787 | },
|
2788 |
|
2789 | |
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 | render: function (nextElement, container, callback) {
|
2802 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
|
2803 | },
|
2804 |
|
2805 | |
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 | registerContainer: function (container) {
|
2814 | var reactRootID = getReactRootID(container);
|
2815 | if (reactRootID) {
|
2816 |
|
2817 | reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
|
2818 | }
|
2819 | if (!reactRootID) {
|
2820 |
|
2821 | reactRootID = ReactInstanceHandles.createReactRootID();
|
2822 | }
|
2823 | containersByReactRootID[reactRootID] = container;
|
2824 | return reactRootID;
|
2825 | },
|
2826 |
|
2827 | |
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 | unmountComponentAtNode: function (container) {
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 | true ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
2840 |
|
2841 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
2842 |
|
2843 | var reactRootID = getReactRootID(container);
|
2844 | var component = instancesByReactRootID[reactRootID];
|
2845 | if (!component) {
|
2846 |
|
2847 |
|
2848 | var containerHasNonRootReactChild = hasNonRootReactChild(container);
|
2849 |
|
2850 |
|
2851 | var containerID = internalGetID(container);
|
2852 | var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
|
2853 |
|
2854 | if (true) {
|
2855 | true ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
|
2856 | }
|
2857 |
|
2858 | return false;
|
2859 | }
|
2860 | ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
|
2861 | delete instancesByReactRootID[reactRootID];
|
2862 | delete containersByReactRootID[reactRootID];
|
2863 | if (true) {
|
2864 | delete rootElementsByReactRootID[reactRootID];
|
2865 | }
|
2866 | return true;
|
2867 | },
|
2868 |
|
2869 | |
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 | findReactContainerForID: function (id) {
|
2877 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
|
2878 | var container = containersByReactRootID[reactRootID];
|
2879 |
|
2880 | if (true) {
|
2881 | var rootElement = rootElementsByReactRootID[reactRootID];
|
2882 | if (rootElement && rootElement.parentNode !== container) {
|
2883 | true ? warning(
|
2884 |
|
2885 |
|
2886 | internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
|
2887 | var containerChild = container.firstChild;
|
2888 | if (containerChild && reactRootID === internalGetID(containerChild)) {
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 | rootElementsByReactRootID[reactRootID] = containerChild;
|
2894 | } else {
|
2895 | true ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
|
2896 | }
|
2897 | }
|
2898 | }
|
2899 |
|
2900 | return container;
|
2901 | },
|
2902 |
|
2903 | |
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 | findReactNodeByID: function (id) {
|
2910 | var reactRoot = ReactMount.findReactContainerForID(id);
|
2911 | return ReactMount.findComponentRoot(reactRoot, id);
|
2912 | },
|
2913 |
|
2914 | |
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 | getFirstReactDOM: function (node) {
|
2923 | return findFirstReactDOMImpl(node);
|
2924 | },
|
2925 |
|
2926 | |
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 | findComponentRoot: function (ancestorNode, targetID) {
|
2937 | var firstChildren = findComponentRootReusableArray;
|
2938 | var childIndex = 0;
|
2939 |
|
2940 | var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
|
2941 |
|
2942 | if (true) {
|
2943 |
|
2944 | true ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
|
2945 | }
|
2946 |
|
2947 | firstChildren[0] = deepestAncestor.firstChild;
|
2948 | firstChildren.length = 1;
|
2949 |
|
2950 | while (childIndex < firstChildren.length) {
|
2951 | var child = firstChildren[childIndex++];
|
2952 | var targetChild;
|
2953 |
|
2954 | while (child) {
|
2955 | var childID = ReactMount.getID(child);
|
2956 | if (childID) {
|
2957 |
|
2958 |
|
2959 |
|
2960 |
|
2961 |
|
2962 | if (targetID === childID) {
|
2963 | targetChild = child;
|
2964 | } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 | firstChildren.length = childIndex = 0;
|
2970 | firstChildren.push(child.firstChild);
|
2971 | }
|
2972 | } else {
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 | firstChildren.push(child.firstChild);
|
2979 | }
|
2980 |
|
2981 | child = child.nextSibling;
|
2982 | }
|
2983 |
|
2984 | if (targetChild) {
|
2985 |
|
2986 |
|
2987 |
|
2988 | firstChildren.length = 0;
|
2989 |
|
2990 | return targetChild;
|
2991 | }
|
2992 | }
|
2993 |
|
2994 | firstChildren.length = 0;
|
2995 |
|
2996 | true ? true ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
|
2997 | },
|
2998 |
|
2999 | _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
|
3000 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
|
3001 |
|
3002 | if (shouldReuseMarkup) {
|
3003 | var rootElement = getReactRootElementInContainer(container);
|
3004 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
|
3005 | return;
|
3006 | } else {
|
3007 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
3008 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
3009 |
|
3010 | var rootMarkup = rootElement.outerHTML;
|
3011 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
|
3012 |
|
3013 | var normalizedMarkup = markup;
|
3014 | if (true) {
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 | var normalizer;
|
3020 | if (container.nodeType === ELEMENT_NODE_TYPE) {
|
3021 | normalizer = document.createElement('div');
|
3022 | normalizer.innerHTML = markup;
|
3023 | normalizedMarkup = normalizer.innerHTML;
|
3024 | } else {
|
3025 | normalizer = document.createElement('iframe');
|
3026 | document.body.appendChild(normalizer);
|
3027 | normalizer.contentDocument.write(markup);
|
3028 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
|
3029 | document.body.removeChild(normalizer);
|
3030 | }
|
3031 | }
|
3032 |
|
3033 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
|
3034 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
|
3035 |
|
3036 | !(container.nodeType !== DOC_NODE_TYPE) ? true ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
|
3037 |
|
3038 | if (true) {
|
3039 | true ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
|
3040 | }
|
3041 | }
|
3042 | }
|
3043 |
|
3044 | !(container.nodeType !== DOC_NODE_TYPE) ? true ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
|
3045 |
|
3046 | if (transaction.useCreateElement) {
|
3047 | while (container.lastChild) {
|
3048 | container.removeChild(container.lastChild);
|
3049 | }
|
3050 | container.appendChild(markup);
|
3051 | } else {
|
3052 | setInnerHTML(container, markup);
|
3053 | }
|
3054 | },
|
3055 |
|
3056 | ownerDocumentContextKey: ownerDocumentContextKey,
|
3057 |
|
3058 | |
3059 |
|
3060 |
|
3061 |
|
3062 | getReactRootID: getReactRootID,
|
3063 |
|
3064 | getID: getID,
|
3065 |
|
3066 | setID: setID,
|
3067 |
|
3068 | getNode: getNode,
|
3069 |
|
3070 | getNodeFromInstance: getNodeFromInstance,
|
3071 |
|
3072 | isValid: isValid,
|
3073 |
|
3074 | purgeID: purgeID
|
3075 | };
|
3076 |
|
3077 | ReactPerf.measureMethods(ReactMount, 'ReactMount', {
|
3078 | _renderNewRootComponent: '_renderNewRootComponent',
|
3079 | _mountImageIntoNode: '_mountImageIntoNode'
|
3080 | });
|
3081 |
|
3082 | module.exports = ReactMount;
|
3083 |
|
3084 | },
|
3085 |
|
3086 | function(module, exports, __webpack_require__) {
|
3087 |
|
3088 | |
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 | 'use strict';
|
3101 |
|
3102 | var EventConstants = __webpack_require__(29);
|
3103 | var EventPluginHub = __webpack_require__(30);
|
3104 | var EventPluginRegistry = __webpack_require__(31);
|
3105 | var ReactEventEmitterMixin = __webpack_require__(36);
|
3106 | var ReactPerf = __webpack_require__(17);
|
3107 | var ViewportMetrics = __webpack_require__(37);
|
3108 |
|
3109 | var assign = __webpack_require__(38);
|
3110 | var isEventSupported = __webpack_require__(39);
|
3111 |
|
3112 | |
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 | var alreadyListeningTo = {};
|
3168 | var isMonitoringScrollValue = false;
|
3169 | var reactTopListenersCounter = 0;
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 | var topEventMapping = {
|
3175 | topAbort: 'abort',
|
3176 | topBlur: 'blur',
|
3177 | topCanPlay: 'canplay',
|
3178 | topCanPlayThrough: 'canplaythrough',
|
3179 | topChange: 'change',
|
3180 | topClick: 'click',
|
3181 | topCompositionEnd: 'compositionend',
|
3182 | topCompositionStart: 'compositionstart',
|
3183 | topCompositionUpdate: 'compositionupdate',
|
3184 | topContextMenu: 'contextmenu',
|
3185 | topCopy: 'copy',
|
3186 | topCut: 'cut',
|
3187 | topDoubleClick: 'dblclick',
|
3188 | topDrag: 'drag',
|
3189 | topDragEnd: 'dragend',
|
3190 | topDragEnter: 'dragenter',
|
3191 | topDragExit: 'dragexit',
|
3192 | topDragLeave: 'dragleave',
|
3193 | topDragOver: 'dragover',
|
3194 | topDragStart: 'dragstart',
|
3195 | topDrop: 'drop',
|
3196 | topDurationChange: 'durationchange',
|
3197 | topEmptied: 'emptied',
|
3198 | topEncrypted: 'encrypted',
|
3199 | topEnded: 'ended',
|
3200 | topError: 'error',
|
3201 | topFocus: 'focus',
|
3202 | topInput: 'input',
|
3203 | topKeyDown: 'keydown',
|
3204 | topKeyPress: 'keypress',
|
3205 | topKeyUp: 'keyup',
|
3206 | topLoadedData: 'loadeddata',
|
3207 | topLoadedMetadata: 'loadedmetadata',
|
3208 | topLoadStart: 'loadstart',
|
3209 | topMouseDown: 'mousedown',
|
3210 | topMouseMove: 'mousemove',
|
3211 | topMouseOut: 'mouseout',
|
3212 | topMouseOver: 'mouseover',
|
3213 | topMouseUp: 'mouseup',
|
3214 | topPaste: 'paste',
|
3215 | topPause: 'pause',
|
3216 | topPlay: 'play',
|
3217 | topPlaying: 'playing',
|
3218 | topProgress: 'progress',
|
3219 | topRateChange: 'ratechange',
|
3220 | topScroll: 'scroll',
|
3221 | topSeeked: 'seeked',
|
3222 | topSeeking: 'seeking',
|
3223 | topSelectionChange: 'selectionchange',
|
3224 | topStalled: 'stalled',
|
3225 | topSuspend: 'suspend',
|
3226 | topTextInput: 'textInput',
|
3227 | topTimeUpdate: 'timeupdate',
|
3228 | topTouchCancel: 'touchcancel',
|
3229 | topTouchEnd: 'touchend',
|
3230 | topTouchMove: 'touchmove',
|
3231 | topTouchStart: 'touchstart',
|
3232 | topVolumeChange: 'volumechange',
|
3233 | topWaiting: 'waiting',
|
3234 | topWheel: 'wheel'
|
3235 | };
|
3236 |
|
3237 | |
3238 |
|
3239 |
|
3240 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
|
3241 |
|
3242 | function getListeningForDocument(mountAt) {
|
3243 |
|
3244 |
|
3245 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
|
3246 | mountAt[topListenersIDKey] = reactTopListenersCounter++;
|
3247 | alreadyListeningTo[mountAt[topListenersIDKey]] = {};
|
3248 | }
|
3249 | return alreadyListeningTo[mountAt[topListenersIDKey]];
|
3250 | }
|
3251 |
|
3252 | |
3253 |
|
3254 |
|
3255 |
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 | var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
3263 |
|
3264 | |
3265 |
|
3266 |
|
3267 | ReactEventListener: null,
|
3268 |
|
3269 | injection: {
|
3270 | |
3271 |
|
3272 |
|
3273 | injectReactEventListener: function (ReactEventListener) {
|
3274 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
|
3275 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
|
3276 | }
|
3277 | },
|
3278 |
|
3279 | |
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 | setEnabled: function (enabled) {
|
3285 | if (ReactBrowserEventEmitter.ReactEventListener) {
|
3286 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
|
3287 | }
|
3288 | },
|
3289 |
|
3290 | |
3291 |
|
3292 |
|
3293 | isEnabled: function () {
|
3294 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
|
3295 | },
|
3296 |
|
3297 | |
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 | listenTo: function (registrationName, contentDocumentHandle) {
|
3319 | var mountAt = contentDocumentHandle;
|
3320 | var isListening = getListeningForDocument(mountAt);
|
3321 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
|
3322 |
|
3323 | var topLevelTypes = EventConstants.topLevelTypes;
|
3324 | for (var i = 0; i < dependencies.length; i++) {
|
3325 | var dependency = dependencies[i];
|
3326 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
|
3327 | if (dependency === topLevelTypes.topWheel) {
|
3328 | if (isEventSupported('wheel')) {
|
3329 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
|
3330 | } else if (isEventSupported('mousewheel')) {
|
3331 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
|
3332 | } else {
|
3333 |
|
3334 |
|
3335 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
|
3336 | }
|
3337 | } else if (dependency === topLevelTypes.topScroll) {
|
3338 |
|
3339 | if (isEventSupported('scroll', true)) {
|
3340 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
|
3341 | } else {
|
3342 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
|
3343 | }
|
3344 | } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
|
3345 |
|
3346 | if (isEventSupported('focus', true)) {
|
3347 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
|
3348 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
|
3349 | } else if (isEventSupported('focusin')) {
|
3350 |
|
3351 |
|
3352 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
|
3353 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
|
3354 | }
|
3355 |
|
3356 |
|
3357 | isListening[topLevelTypes.topBlur] = true;
|
3358 | isListening[topLevelTypes.topFocus] = true;
|
3359 | } else if (topEventMapping.hasOwnProperty(dependency)) {
|
3360 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
|
3361 | }
|
3362 |
|
3363 | isListening[dependency] = true;
|
3364 | }
|
3365 | }
|
3366 | },
|
3367 |
|
3368 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
|
3369 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
|
3370 | },
|
3371 |
|
3372 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
|
3373 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
|
3374 | },
|
3375 |
|
3376 | |
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 | ensureScrollValueMonitoring: function () {
|
3385 | if (!isMonitoringScrollValue) {
|
3386 | var refresh = ViewportMetrics.refreshScrollValues;
|
3387 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
|
3388 | isMonitoringScrollValue = true;
|
3389 | }
|
3390 | },
|
3391 |
|
3392 | eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
|
3393 |
|
3394 | registrationNameModules: EventPluginHub.registrationNameModules,
|
3395 |
|
3396 | putListener: EventPluginHub.putListener,
|
3397 |
|
3398 | getListener: EventPluginHub.getListener,
|
3399 |
|
3400 | deleteListener: EventPluginHub.deleteListener,
|
3401 |
|
3402 | deleteAllListeners: EventPluginHub.deleteAllListeners
|
3403 |
|
3404 | });
|
3405 |
|
3406 | ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
|
3407 | putListener: 'putListener',
|
3408 | deleteListener: 'deleteListener'
|
3409 | });
|
3410 |
|
3411 | module.exports = ReactBrowserEventEmitter;
|
3412 |
|
3413 | },
|
3414 |
|
3415 | function(module, exports, __webpack_require__) {
|
3416 |
|
3417 | |
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 | 'use strict';
|
3429 |
|
3430 | var keyMirror = __webpack_require__(16);
|
3431 |
|
3432 | var PropagationPhases = keyMirror({ bubbled: null, captured: null });
|
3433 |
|
3434 | |
3435 |
|
3436 |
|
3437 | var topLevelTypes = keyMirror({
|
3438 | topAbort: null,
|
3439 | topBlur: null,
|
3440 | topCanPlay: null,
|
3441 | topCanPlayThrough: null,
|
3442 | topChange: null,
|
3443 | topClick: null,
|
3444 | topCompositionEnd: null,
|
3445 | topCompositionStart: null,
|
3446 | topCompositionUpdate: null,
|
3447 | topContextMenu: null,
|
3448 | topCopy: null,
|
3449 | topCut: null,
|
3450 | topDoubleClick: null,
|
3451 | topDrag: null,
|
3452 | topDragEnd: null,
|
3453 | topDragEnter: null,
|
3454 | topDragExit: null,
|
3455 | topDragLeave: null,
|
3456 | topDragOver: null,
|
3457 | topDragStart: null,
|
3458 | topDrop: null,
|
3459 | topDurationChange: null,
|
3460 | topEmptied: null,
|
3461 | topEncrypted: null,
|
3462 | topEnded: null,
|
3463 | topError: null,
|
3464 | topFocus: null,
|
3465 | topInput: null,
|
3466 | topKeyDown: null,
|
3467 | topKeyPress: null,
|
3468 | topKeyUp: null,
|
3469 | topLoad: null,
|
3470 | topLoadedData: null,
|
3471 | topLoadedMetadata: null,
|
3472 | topLoadStart: null,
|
3473 | topMouseDown: null,
|
3474 | topMouseMove: null,
|
3475 | topMouseOut: null,
|
3476 | topMouseOver: null,
|
3477 | topMouseUp: null,
|
3478 | topPaste: null,
|
3479 | topPause: null,
|
3480 | topPlay: null,
|
3481 | topPlaying: null,
|
3482 | topProgress: null,
|
3483 | topRateChange: null,
|
3484 | topReset: null,
|
3485 | topScroll: null,
|
3486 | topSeeked: null,
|
3487 | topSeeking: null,
|
3488 | topSelectionChange: null,
|
3489 | topStalled: null,
|
3490 | topSubmit: null,
|
3491 | topSuspend: null,
|
3492 | topTextInput: null,
|
3493 | topTimeUpdate: null,
|
3494 | topTouchCancel: null,
|
3495 | topTouchEnd: null,
|
3496 | topTouchMove: null,
|
3497 | topTouchStart: null,
|
3498 | topVolumeChange: null,
|
3499 | topWaiting: null,
|
3500 | topWheel: null
|
3501 | });
|
3502 |
|
3503 | var EventConstants = {
|
3504 | topLevelTypes: topLevelTypes,
|
3505 | PropagationPhases: PropagationPhases
|
3506 | };
|
3507 |
|
3508 | module.exports = EventConstants;
|
3509 |
|
3510 | },
|
3511 |
|
3512 | function(module, exports, __webpack_require__) {
|
3513 |
|
3514 | |
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 | 'use strict';
|
3526 |
|
3527 | var EventPluginRegistry = __webpack_require__(31);
|
3528 | var EventPluginUtils = __webpack_require__(32);
|
3529 | var ReactErrorUtils = __webpack_require__(33);
|
3530 |
|
3531 | var accumulateInto = __webpack_require__(34);
|
3532 | var forEachAccumulated = __webpack_require__(35);
|
3533 | var invariant = __webpack_require__(12);
|
3534 | var warning = __webpack_require__(24);
|
3535 |
|
3536 | |
3537 |
|
3538 |
|
3539 | var listenerBank = {};
|
3540 |
|
3541 | |
3542 |
|
3543 |
|
3544 |
|
3545 | var eventQueue = null;
|
3546 |
|
3547 | |
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 | var executeDispatchesAndRelease = function (event, simulated) {
|
3555 | if (event) {
|
3556 | EventPluginUtils.executeDispatchesInOrder(event, simulated);
|
3557 |
|
3558 | if (!event.isPersistent()) {
|
3559 | event.constructor.release(event);
|
3560 | }
|
3561 | }
|
3562 | };
|
3563 | var executeDispatchesAndReleaseSimulated = function (e) {
|
3564 | return executeDispatchesAndRelease(e, true);
|
3565 | };
|
3566 | var executeDispatchesAndReleaseTopLevel = function (e) {
|
3567 | return executeDispatchesAndRelease(e, false);
|
3568 | };
|
3569 |
|
3570 | |
3571 |
|
3572 |
|
3573 |
|
3574 | var InstanceHandle = null;
|
3575 |
|
3576 | function validateInstanceHandle() {
|
3577 | var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
|
3578 | true ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
|
3579 | }
|
3580 |
|
3581 | |
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 | var EventPluginHub = {
|
3604 |
|
3605 | |
3606 |
|
3607 |
|
3608 | injection: {
|
3609 |
|
3610 | |
3611 |
|
3612 |
|
3613 |
|
3614 | injectMount: EventPluginUtils.injection.injectMount,
|
3615 |
|
3616 | |
3617 |
|
3618 |
|
3619 |
|
3620 | injectInstanceHandle: function (InjectedInstanceHandle) {
|
3621 | InstanceHandle = InjectedInstanceHandle;
|
3622 | if (true) {
|
3623 | validateInstanceHandle();
|
3624 | }
|
3625 | },
|
3626 |
|
3627 | getInstanceHandle: function () {
|
3628 | if (true) {
|
3629 | validateInstanceHandle();
|
3630 | }
|
3631 | return InstanceHandle;
|
3632 | },
|
3633 |
|
3634 | |
3635 |
|
3636 |
|
3637 |
|
3638 | injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
|
3639 |
|
3640 | |
3641 |
|
3642 |
|
3643 | injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
|
3644 |
|
3645 | },
|
3646 |
|
3647 | eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
|
3648 |
|
3649 | registrationNameModules: EventPluginRegistry.registrationNameModules,
|
3650 |
|
3651 | |
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 | putListener: function (id, registrationName, listener) {
|
3659 | !(typeof listener === 'function') ? true ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
|
3660 |
|
3661 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
|
3662 | bankForRegistrationName[id] = listener;
|
3663 |
|
3664 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3665 | if (PluginModule && PluginModule.didPutListener) {
|
3666 | PluginModule.didPutListener(id, registrationName, listener);
|
3667 | }
|
3668 | },
|
3669 |
|
3670 | |
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 | getListener: function (id, registrationName) {
|
3676 | var bankForRegistrationName = listenerBank[registrationName];
|
3677 | return bankForRegistrationName && bankForRegistrationName[id];
|
3678 | },
|
3679 |
|
3680 | |
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 | deleteListener: function (id, registrationName) {
|
3687 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3688 | if (PluginModule && PluginModule.willDeleteListener) {
|
3689 | PluginModule.willDeleteListener(id, registrationName);
|
3690 | }
|
3691 |
|
3692 | var bankForRegistrationName = listenerBank[registrationName];
|
3693 |
|
3694 | if (bankForRegistrationName) {
|
3695 | delete bankForRegistrationName[id];
|
3696 | }
|
3697 | },
|
3698 |
|
3699 | |
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 | deleteAllListeners: function (id) {
|
3705 | for (var registrationName in listenerBank) {
|
3706 | if (!listenerBank[registrationName][id]) {
|
3707 | continue;
|
3708 | }
|
3709 |
|
3710 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3711 | if (PluginModule && PluginModule.willDeleteListener) {
|
3712 | PluginModule.willDeleteListener(id, registrationName);
|
3713 | }
|
3714 |
|
3715 | delete listenerBank[registrationName][id];
|
3716 | }
|
3717 | },
|
3718 |
|
3719 | |
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 |
|
3729 |
|
3730 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
3731 | var events;
|
3732 | var plugins = EventPluginRegistry.plugins;
|
3733 | for (var i = 0; i < plugins.length; i++) {
|
3734 |
|
3735 | var possiblePlugin = plugins[i];
|
3736 | if (possiblePlugin) {
|
3737 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
|
3738 | if (extractedEvents) {
|
3739 | events = accumulateInto(events, extractedEvents);
|
3740 | }
|
3741 | }
|
3742 | }
|
3743 | return events;
|
3744 | },
|
3745 |
|
3746 | |
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 | enqueueEvents: function (events) {
|
3754 | if (events) {
|
3755 | eventQueue = accumulateInto(eventQueue, events);
|
3756 | }
|
3757 | },
|
3758 |
|
3759 | |
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 | processEventQueue: function (simulated) {
|
3765 |
|
3766 |
|
3767 | var processingEventQueue = eventQueue;
|
3768 | eventQueue = null;
|
3769 | if (simulated) {
|
3770 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
|
3771 | } else {
|
3772 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
|
3773 | }
|
3774 | !!eventQueue ? true ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
|
3775 |
|
3776 | ReactErrorUtils.rethrowCaughtError();
|
3777 | },
|
3778 |
|
3779 | |
3780 |
|
3781 |
|
3782 | __purge: function () {
|
3783 | listenerBank = {};
|
3784 | },
|
3785 |
|
3786 | __getListenerBank: function () {
|
3787 | return listenerBank;
|
3788 | }
|
3789 |
|
3790 | };
|
3791 |
|
3792 | module.exports = EventPluginHub;
|
3793 |
|
3794 | },
|
3795 |
|
3796 | function(module, exports, __webpack_require__) {
|
3797 |
|
3798 | |
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 |
|
3805 |
|
3806 |
|
3807 |
|
3808 |
|
3809 |
|
3810 | 'use strict';
|
3811 |
|
3812 | var invariant = __webpack_require__(12);
|
3813 |
|
3814 | |
3815 |
|
3816 |
|
3817 | var EventPluginOrder = null;
|
3818 |
|
3819 | |
3820 |
|
3821 |
|
3822 | var namesToPlugins = {};
|
3823 |
|
3824 | |
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 | function recomputePluginOrdering() {
|
3830 | if (!EventPluginOrder) {
|
3831 |
|
3832 | return;
|
3833 | }
|
3834 | for (var pluginName in namesToPlugins) {
|
3835 | var PluginModule = namesToPlugins[pluginName];
|
3836 | var pluginIndex = EventPluginOrder.indexOf(pluginName);
|
3837 | !(pluginIndex > -1) ? true ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
|
3838 | if (EventPluginRegistry.plugins[pluginIndex]) {
|
3839 | continue;
|
3840 | }
|
3841 | !PluginModule.extractEvents ? true ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
|
3842 | EventPluginRegistry.plugins[pluginIndex] = PluginModule;
|
3843 | var publishedEvents = PluginModule.eventTypes;
|
3844 | for (var eventName in publishedEvents) {
|
3845 | !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? true ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
|
3846 | }
|
3847 | }
|
3848 | }
|
3849 |
|
3850 | |
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
3859 | !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? true ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
|
3860 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
|
3861 |
|
3862 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
3863 | if (phasedRegistrationNames) {
|
3864 | for (var phaseName in phasedRegistrationNames) {
|
3865 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
|
3866 | var phasedRegistrationName = phasedRegistrationNames[phaseName];
|
3867 | publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
|
3868 | }
|
3869 | }
|
3870 | return true;
|
3871 | } else if (dispatchConfig.registrationName) {
|
3872 | publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
|
3873 | return true;
|
3874 | }
|
3875 | return false;
|
3876 | }
|
3877 |
|
3878 | |
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 | function publishRegistrationName(registrationName, PluginModule, eventName) {
|
3887 | !!EventPluginRegistry.registrationNameModules[registrationName] ? true ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
|
3888 | EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
|
3889 | EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
|
3890 | }
|
3891 |
|
3892 | |
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 | var EventPluginRegistry = {
|
3898 |
|
3899 | |
3900 |
|
3901 |
|
3902 | plugins: [],
|
3903 |
|
3904 | |
3905 |
|
3906 |
|
3907 | eventNameDispatchConfigs: {},
|
3908 |
|
3909 | |
3910 |
|
3911 |
|
3912 | registrationNameModules: {},
|
3913 |
|
3914 | |
3915 |
|
3916 |
|
3917 | registrationNameDependencies: {},
|
3918 |
|
3919 | |
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 | injectEventPluginOrder: function (InjectedEventPluginOrder) {
|
3929 | !!EventPluginOrder ? true ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
|
3930 |
|
3931 | EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
|
3932 | recomputePluginOrdering();
|
3933 | },
|
3934 |
|
3935 | |
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 | injectEventPluginsByName: function (injectedNamesToPlugins) {
|
3946 | var isOrderingDirty = false;
|
3947 | for (var pluginName in injectedNamesToPlugins) {
|
3948 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
|
3949 | continue;
|
3950 | }
|
3951 | var PluginModule = injectedNamesToPlugins[pluginName];
|
3952 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
|
3953 | !!namesToPlugins[pluginName] ? true ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
|
3954 | namesToPlugins[pluginName] = PluginModule;
|
3955 | isOrderingDirty = true;
|
3956 | }
|
3957 | }
|
3958 | if (isOrderingDirty) {
|
3959 | recomputePluginOrdering();
|
3960 | }
|
3961 | },
|
3962 |
|
3963 | |
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 | getPluginModuleForEvent: function (event) {
|
3971 | var dispatchConfig = event.dispatchConfig;
|
3972 | if (dispatchConfig.registrationName) {
|
3973 | return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
|
3974 | }
|
3975 | for (var phase in dispatchConfig.phasedRegistrationNames) {
|
3976 | if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
|
3977 | continue;
|
3978 | }
|
3979 | var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
|
3980 | if (PluginModule) {
|
3981 | return PluginModule;
|
3982 | }
|
3983 | }
|
3984 | return null;
|
3985 | },
|
3986 |
|
3987 | |
3988 |
|
3989 |
|
3990 |
|
3991 | _resetEventPlugins: function () {
|
3992 | EventPluginOrder = null;
|
3993 | for (var pluginName in namesToPlugins) {
|
3994 | if (namesToPlugins.hasOwnProperty(pluginName)) {
|
3995 | delete namesToPlugins[pluginName];
|
3996 | }
|
3997 | }
|
3998 | EventPluginRegistry.plugins.length = 0;
|
3999 |
|
4000 | var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
|
4001 | for (var eventName in eventNameDispatchConfigs) {
|
4002 | if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
|
4003 | delete eventNameDispatchConfigs[eventName];
|
4004 | }
|
4005 | }
|
4006 |
|
4007 | var registrationNameModules = EventPluginRegistry.registrationNameModules;
|
4008 | for (var registrationName in registrationNameModules) {
|
4009 | if (registrationNameModules.hasOwnProperty(registrationName)) {
|
4010 | delete registrationNameModules[registrationName];
|
4011 | }
|
4012 | }
|
4013 | }
|
4014 |
|
4015 | };
|
4016 |
|
4017 | module.exports = EventPluginRegistry;
|
4018 |
|
4019 | },
|
4020 |
|
4021 | function(module, exports, __webpack_require__) {
|
4022 |
|
4023 | |
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 | 'use strict';
|
4035 |
|
4036 | var EventConstants = __webpack_require__(29);
|
4037 | var ReactErrorUtils = __webpack_require__(33);
|
4038 |
|
4039 | var invariant = __webpack_require__(12);
|
4040 | var warning = __webpack_require__(24);
|
4041 |
|
4042 | |
4043 |
|
4044 |
|
4045 |
|
4046 | |
4047 |
|
4048 |
|
4049 |
|
4050 | var injection = {
|
4051 | Mount: null,
|
4052 | injectMount: function (InjectedMount) {
|
4053 | injection.Mount = InjectedMount;
|
4054 | if (true) {
|
4055 | true ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
|
4056 | }
|
4057 | }
|
4058 | };
|
4059 |
|
4060 | var topLevelTypes = EventConstants.topLevelTypes;
|
4061 |
|
4062 | function isEndish(topLevelType) {
|
4063 | return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
|
4064 | }
|
4065 |
|
4066 | function isMoveish(topLevelType) {
|
4067 | return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
|
4068 | }
|
4069 | function isStartish(topLevelType) {
|
4070 | return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
|
4071 | }
|
4072 |
|
4073 | var validateEventDispatches;
|
4074 | if (true) {
|
4075 | validateEventDispatches = function (event) {
|
4076 | var dispatchListeners = event._dispatchListeners;
|
4077 | var dispatchIDs = event._dispatchIDs;
|
4078 |
|
4079 | var listenersIsArr = Array.isArray(dispatchListeners);
|
4080 | var idsIsArr = Array.isArray(dispatchIDs);
|
4081 | var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
|
4082 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
4083 |
|
4084 | true ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
|
4085 | };
|
4086 | }
|
4087 |
|
4088 | |
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 | function executeDispatch(event, simulated, listener, domID) {
|
4096 | var type = event.type || 'unknown-event';
|
4097 | event.currentTarget = injection.Mount.getNode(domID);
|
4098 | if (simulated) {
|
4099 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
|
4100 | } else {
|
4101 | ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
|
4102 | }
|
4103 | event.currentTarget = null;
|
4104 | }
|
4105 |
|
4106 | |
4107 |
|
4108 |
|
4109 | function executeDispatchesInOrder(event, simulated) {
|
4110 | var dispatchListeners = event._dispatchListeners;
|
4111 | var dispatchIDs = event._dispatchIDs;
|
4112 | if (true) {
|
4113 | validateEventDispatches(event);
|
4114 | }
|
4115 | if (Array.isArray(dispatchListeners)) {
|
4116 | for (var i = 0; i < dispatchListeners.length; i++) {
|
4117 | if (event.isPropagationStopped()) {
|
4118 | break;
|
4119 | }
|
4120 |
|
4121 | executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
|
4122 | }
|
4123 | } else if (dispatchListeners) {
|
4124 | executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
|
4125 | }
|
4126 | event._dispatchListeners = null;
|
4127 | event._dispatchIDs = null;
|
4128 | }
|
4129 |
|
4130 | |
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 | function executeDispatchesInOrderStopAtTrueImpl(event) {
|
4138 | var dispatchListeners = event._dispatchListeners;
|
4139 | var dispatchIDs = event._dispatchIDs;
|
4140 | if (true) {
|
4141 | validateEventDispatches(event);
|
4142 | }
|
4143 | if (Array.isArray(dispatchListeners)) {
|
4144 | for (var i = 0; i < dispatchListeners.length; i++) {
|
4145 | if (event.isPropagationStopped()) {
|
4146 | break;
|
4147 | }
|
4148 |
|
4149 | if (dispatchListeners[i](event, dispatchIDs[i])) {
|
4150 | return dispatchIDs[i];
|
4151 | }
|
4152 | }
|
4153 | } else if (dispatchListeners) {
|
4154 | if (dispatchListeners(event, dispatchIDs)) {
|
4155 | return dispatchIDs;
|
4156 | }
|
4157 | }
|
4158 | return null;
|
4159 | }
|
4160 |
|
4161 | |
4162 |
|
4163 |
|
4164 | function executeDispatchesInOrderStopAtTrue(event) {
|
4165 | var ret = executeDispatchesInOrderStopAtTrueImpl(event);
|
4166 | event._dispatchIDs = null;
|
4167 | event._dispatchListeners = null;
|
4168 | return ret;
|
4169 | }
|
4170 |
|
4171 | |
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 | function executeDirectDispatch(event) {
|
4181 | if (true) {
|
4182 | validateEventDispatches(event);
|
4183 | }
|
4184 | var dispatchListener = event._dispatchListeners;
|
4185 | var dispatchID = event._dispatchIDs;
|
4186 | !!Array.isArray(dispatchListener) ? true ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
|
4187 | var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
|
4188 | event._dispatchListeners = null;
|
4189 | event._dispatchIDs = null;
|
4190 | return res;
|
4191 | }
|
4192 |
|
4193 | |
4194 |
|
4195 |
|
4196 |
|
4197 | function hasDispatches(event) {
|
4198 | return !!event._dispatchListeners;
|
4199 | }
|
4200 |
|
4201 | |
4202 |
|
4203 |
|
4204 | var EventPluginUtils = {
|
4205 | isEndish: isEndish,
|
4206 | isMoveish: isMoveish,
|
4207 | isStartish: isStartish,
|
4208 |
|
4209 | executeDirectDispatch: executeDirectDispatch,
|
4210 | executeDispatchesInOrder: executeDispatchesInOrder,
|
4211 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
|
4212 | hasDispatches: hasDispatches,
|
4213 |
|
4214 | getNode: function (id) {
|
4215 | return injection.Mount.getNode(id);
|
4216 | },
|
4217 | getID: function (node) {
|
4218 | return injection.Mount.getID(node);
|
4219 | },
|
4220 |
|
4221 | injection: injection
|
4222 | };
|
4223 |
|
4224 | module.exports = EventPluginUtils;
|
4225 |
|
4226 | },
|
4227 |
|
4228 | function(module, exports, __webpack_require__) {
|
4229 |
|
4230 | |
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 | 'use strict';
|
4243 |
|
4244 | var caughtError = null;
|
4245 |
|
4246 | |
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 | function invokeGuardedCallback(name, func, a, b) {
|
4255 | try {
|
4256 | return func(a, b);
|
4257 | } catch (x) {
|
4258 | if (caughtError === null) {
|
4259 | caughtError = x;
|
4260 | }
|
4261 | return undefined;
|
4262 | }
|
4263 | }
|
4264 |
|
4265 | var ReactErrorUtils = {
|
4266 | invokeGuardedCallback: invokeGuardedCallback,
|
4267 |
|
4268 | |
4269 |
|
4270 |
|
4271 |
|
4272 | invokeGuardedCallbackWithCatch: invokeGuardedCallback,
|
4273 |
|
4274 | |
4275 |
|
4276 |
|
4277 |
|
4278 | rethrowCaughtError: function () {
|
4279 | if (caughtError) {
|
4280 | var error = caughtError;
|
4281 | caughtError = null;
|
4282 | throw error;
|
4283 | }
|
4284 | }
|
4285 | };
|
4286 |
|
4287 | if (true) {
|
4288 | |
4289 |
|
4290 |
|
4291 |
|
4292 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
4293 | var fakeNode = document.createElement('react');
|
4294 | ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
|
4295 | var boundFunc = func.bind(null, a, b);
|
4296 | var evtType = 'react-' + name;
|
4297 | fakeNode.addEventListener(evtType, boundFunc, false);
|
4298 | var evt = document.createEvent('Event');
|
4299 | evt.initEvent(evtType, false, false);
|
4300 | fakeNode.dispatchEvent(evt);
|
4301 | fakeNode.removeEventListener(evtType, boundFunc, false);
|
4302 | };
|
4303 | }
|
4304 | }
|
4305 |
|
4306 | module.exports = ReactErrorUtils;
|
4307 |
|
4308 | },
|
4309 |
|
4310 | function(module, exports, __webpack_require__) {
|
4311 |
|
4312 | |
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 | 'use strict';
|
4324 |
|
4325 | var invariant = __webpack_require__(12);
|
4326 |
|
4327 | |
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 | function accumulateInto(current, next) {
|
4342 | !(next != null) ? true ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
|
4343 | if (current == null) {
|
4344 | return next;
|
4345 | }
|
4346 |
|
4347 |
|
4348 |
|
4349 | var currentIsArray = Array.isArray(current);
|
4350 | var nextIsArray = Array.isArray(next);
|
4351 |
|
4352 | if (currentIsArray && nextIsArray) {
|
4353 | current.push.apply(current, next);
|
4354 | return current;
|
4355 | }
|
4356 |
|
4357 | if (currentIsArray) {
|
4358 | current.push(next);
|
4359 | return current;
|
4360 | }
|
4361 |
|
4362 | if (nextIsArray) {
|
4363 |
|
4364 | return [current].concat(next);
|
4365 | }
|
4366 |
|
4367 | return [current, next];
|
4368 | }
|
4369 |
|
4370 | module.exports = accumulateInto;
|
4371 |
|
4372 | },
|
4373 |
|
4374 | function(module, exports) {
|
4375 |
|
4376 | |
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 | 'use strict';
|
4388 |
|
4389 | |
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 | var forEachAccumulated = function (arr, cb, scope) {
|
4397 | if (Array.isArray(arr)) {
|
4398 | arr.forEach(cb, scope);
|
4399 | } else if (arr) {
|
4400 | cb.call(scope, arr);
|
4401 | }
|
4402 | };
|
4403 |
|
4404 | module.exports = forEachAccumulated;
|
4405 |
|
4406 | },
|
4407 |
|
4408 | function(module, exports, __webpack_require__) {
|
4409 |
|
4410 | |
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 | 'use strict';
|
4422 |
|
4423 | var EventPluginHub = __webpack_require__(30);
|
4424 |
|
4425 | function runEventQueueInBatch(events) {
|
4426 | EventPluginHub.enqueueEvents(events);
|
4427 | EventPluginHub.processEventQueue(false);
|
4428 | }
|
4429 |
|
4430 | var ReactEventEmitterMixin = {
|
4431 |
|
4432 | |
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 |
|
4441 | handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
4442 | var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
|
4443 | runEventQueueInBatch(events);
|
4444 | }
|
4445 | };
|
4446 |
|
4447 | module.exports = ReactEventEmitterMixin;
|
4448 |
|
4449 | },
|
4450 |
|
4451 | function(module, exports) {
|
4452 |
|
4453 | |
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 | 'use strict';
|
4465 |
|
4466 | var ViewportMetrics = {
|
4467 |
|
4468 | currentScrollLeft: 0,
|
4469 |
|
4470 | currentScrollTop: 0,
|
4471 |
|
4472 | refreshScrollValues: function (scrollPosition) {
|
4473 | ViewportMetrics.currentScrollLeft = scrollPosition.x;
|
4474 | ViewportMetrics.currentScrollTop = scrollPosition.y;
|
4475 | }
|
4476 |
|
4477 | };
|
4478 |
|
4479 | module.exports = ViewportMetrics;
|
4480 |
|
4481 | },
|
4482 |
|
4483 | function(module, exports) {
|
4484 |
|
4485 | |
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 |
|
4497 |
|
4498 | 'use strict';
|
4499 |
|
4500 | function assign(target, sources) {
|
4501 | if (target == null) {
|
4502 | throw new TypeError('Object.assign target cannot be null or undefined');
|
4503 | }
|
4504 |
|
4505 | var to = Object(target);
|
4506 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
4507 |
|
4508 | for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
|
4509 | var nextSource = arguments[nextIndex];
|
4510 | if (nextSource == null) {
|
4511 | continue;
|
4512 | }
|
4513 |
|
4514 | var from = Object(nextSource);
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 | for (var key in from) {
|
4522 | if (hasOwnProperty.call(from, key)) {
|
4523 | to[key] = from[key];
|
4524 | }
|
4525 | }
|
4526 | }
|
4527 |
|
4528 | return to;
|
4529 | }
|
4530 |
|
4531 | module.exports = assign;
|
4532 |
|
4533 | },
|
4534 |
|
4535 | function(module, exports, __webpack_require__) {
|
4536 |
|
4537 | |
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 | 'use strict';
|
4549 |
|
4550 | var ExecutionEnvironment = __webpack_require__(8);
|
4551 |
|
4552 | var useHasFeature;
|
4553 | if (ExecutionEnvironment.canUseDOM) {
|
4554 | useHasFeature = document.implementation && document.implementation.hasFeature &&
|
4555 |
|
4556 |
|
4557 | document.implementation.hasFeature('', '') !== true;
|
4558 | }
|
4559 |
|
4560 | |
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 | function isEventSupported(eventNameSuffix, capture) {
|
4575 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
|
4576 | return false;
|
4577 | }
|
4578 |
|
4579 | var eventName = 'on' + eventNameSuffix;
|
4580 | var isSupported = (eventName in document);
|
4581 |
|
4582 | if (!isSupported) {
|
4583 | var element = document.createElement('div');
|
4584 | element.setAttribute(eventName, 'return;');
|
4585 | isSupported = typeof element[eventName] === 'function';
|
4586 | }
|
4587 |
|
4588 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
|
4589 |
|
4590 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
|
4591 | }
|
4592 |
|
4593 | return isSupported;
|
4594 | }
|
4595 |
|
4596 | module.exports = isEventSupported;
|
4597 |
|
4598 | },
|
4599 |
|
4600 | function(module, exports) {
|
4601 |
|
4602 | |
4603 |
|
4604 |
|
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 | 'use strict';
|
4614 |
|
4615 | var ReactDOMFeatureFlags = {
|
4616 | useCreateElement: false
|
4617 | };
|
4618 |
|
4619 | module.exports = ReactDOMFeatureFlags;
|
4620 |
|
4621 | },
|
4622 |
|
4623 | function(module, exports, __webpack_require__) {
|
4624 |
|
4625 | |
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 | 'use strict';
|
4637 |
|
4638 | var ReactCurrentOwner = __webpack_require__(4);
|
4639 |
|
4640 | var assign = __webpack_require__(38);
|
4641 | var canDefineProperty = __webpack_require__(42);
|
4642 |
|
4643 |
|
4644 |
|
4645 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
4646 |
|
4647 | var RESERVED_PROPS = {
|
4648 | key: true,
|
4649 | ref: true,
|
4650 | __self: true,
|
4651 | __source: true
|
4652 | };
|
4653 |
|
4654 | |
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
4673 | var element = {
|
4674 |
|
4675 | $$typeof: REACT_ELEMENT_TYPE,
|
4676 |
|
4677 |
|
4678 | type: type,
|
4679 | key: key,
|
4680 | ref: ref,
|
4681 | props: props,
|
4682 |
|
4683 |
|
4684 | _owner: owner
|
4685 | };
|
4686 |
|
4687 | if (true) {
|
4688 |
|
4689 |
|
4690 |
|
4691 |
|
4692 | element._store = {};
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 | if (canDefineProperty) {
|
4699 | Object.defineProperty(element._store, 'validated', {
|
4700 | configurable: false,
|
4701 | enumerable: false,
|
4702 | writable: true,
|
4703 | value: false
|
4704 | });
|
4705 |
|
4706 | Object.defineProperty(element, '_self', {
|
4707 | configurable: false,
|
4708 | enumerable: false,
|
4709 | writable: false,
|
4710 | value: self
|
4711 | });
|
4712 |
|
4713 |
|
4714 | Object.defineProperty(element, '_source', {
|
4715 | configurable: false,
|
4716 | enumerable: false,
|
4717 | writable: false,
|
4718 | value: source
|
4719 | });
|
4720 | } else {
|
4721 | element._store.validated = false;
|
4722 | element._self = self;
|
4723 | element._source = source;
|
4724 | }
|
4725 | Object.freeze(element.props);
|
4726 | Object.freeze(element);
|
4727 | }
|
4728 |
|
4729 | return element;
|
4730 | };
|
4731 |
|
4732 | ReactElement.createElement = function (type, config, children) {
|
4733 | var propName;
|
4734 |
|
4735 |
|
4736 | var props = {};
|
4737 |
|
4738 | var key = null;
|
4739 | var ref = null;
|
4740 | var self = null;
|
4741 | var source = null;
|
4742 |
|
4743 | if (config != null) {
|
4744 | ref = config.ref === undefined ? null : config.ref;
|
4745 | key = config.key === undefined ? null : '' + config.key;
|
4746 | self = config.__self === undefined ? null : config.__self;
|
4747 | source = config.__source === undefined ? null : config.__source;
|
4748 |
|
4749 | for (propName in config) {
|
4750 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
4751 | props[propName] = config[propName];
|
4752 | }
|
4753 | }
|
4754 | }
|
4755 |
|
4756 |
|
4757 |
|
4758 | var childrenLength = arguments.length - 2;
|
4759 | if (childrenLength === 1) {
|
4760 | props.children = children;
|
4761 | } else if (childrenLength > 1) {
|
4762 | var childArray = Array(childrenLength);
|
4763 | for (var i = 0; i < childrenLength; i++) {
|
4764 | childArray[i] = arguments[i + 2];
|
4765 | }
|
4766 | props.children = childArray;
|
4767 | }
|
4768 |
|
4769 |
|
4770 | if (type && type.defaultProps) {
|
4771 | var defaultProps = type.defaultProps;
|
4772 | for (propName in defaultProps) {
|
4773 | if (typeof props[propName] === 'undefined') {
|
4774 | props[propName] = defaultProps[propName];
|
4775 | }
|
4776 | }
|
4777 | }
|
4778 |
|
4779 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
4780 | };
|
4781 |
|
4782 | ReactElement.createFactory = function (type) {
|
4783 | var factory = ReactElement.createElement.bind(null, type);
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 | factory.type = type;
|
4790 | return factory;
|
4791 | };
|
4792 |
|
4793 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
4794 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
4795 |
|
4796 | return newElement;
|
4797 | };
|
4798 |
|
4799 | ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
|
4800 | var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
|
4801 |
|
4802 | if (true) {
|
4803 |
|
4804 | newElement._store.validated = oldElement._store.validated;
|
4805 | }
|
4806 |
|
4807 | return newElement;
|
4808 | };
|
4809 |
|
4810 | ReactElement.cloneElement = function (element, config, children) {
|
4811 | var propName;
|
4812 |
|
4813 |
|
4814 | var props = assign({}, element.props);
|
4815 |
|
4816 |
|
4817 | var key = element.key;
|
4818 | var ref = element.ref;
|
4819 |
|
4820 | var self = element._self;
|
4821 |
|
4822 |
|
4823 |
|
4824 | var source = element._source;
|
4825 |
|
4826 |
|
4827 | var owner = element._owner;
|
4828 |
|
4829 | if (config != null) {
|
4830 | if (config.ref !== undefined) {
|
4831 |
|
4832 | ref = config.ref;
|
4833 | owner = ReactCurrentOwner.current;
|
4834 | }
|
4835 | if (config.key !== undefined) {
|
4836 | key = '' + config.key;
|
4837 | }
|
4838 |
|
4839 | for (propName in config) {
|
4840 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
4841 | props[propName] = config[propName];
|
4842 | }
|
4843 | }
|
4844 | }
|
4845 |
|
4846 |
|
4847 |
|
4848 | var childrenLength = arguments.length - 2;
|
4849 | if (childrenLength === 1) {
|
4850 | props.children = children;
|
4851 | } else if (childrenLength > 1) {
|
4852 | var childArray = Array(childrenLength);
|
4853 | for (var i = 0; i < childrenLength; i++) {
|
4854 | childArray[i] = arguments[i + 2];
|
4855 | }
|
4856 | props.children = childArray;
|
4857 | }
|
4858 |
|
4859 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
4860 | };
|
4861 |
|
4862 | |
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 | ReactElement.isValidElement = function (object) {
|
4868 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
4869 | };
|
4870 |
|
4871 | module.exports = ReactElement;
|
4872 |
|
4873 | },
|
4874 |
|
4875 | function(module, exports, __webpack_require__) {
|
4876 |
|
4877 | |
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 | 'use strict';
|
4889 |
|
4890 | var canDefineProperty = false;
|
4891 | if (true) {
|
4892 | try {
|
4893 | Object.defineProperty({}, 'x', { get: function () {} });
|
4894 | canDefineProperty = true;
|
4895 | } catch (x) {
|
4896 |
|
4897 | }
|
4898 | }
|
4899 |
|
4900 | module.exports = canDefineProperty;
|
4901 |
|
4902 | },
|
4903 |
|
4904 | function(module, exports) {
|
4905 |
|
4906 | |
4907 |
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 | 'use strict';
|
4918 |
|
4919 |
|
4920 |
|
4921 | var nullComponentIDsRegistry = {};
|
4922 |
|
4923 | |
4924 |
|
4925 |
|
4926 |
|
4927 | function isNullComponentID(id) {
|
4928 | return !!nullComponentIDsRegistry[id];
|
4929 | }
|
4930 |
|
4931 | |
4932 |
|
4933 |
|
4934 |
|
4935 | function registerNullComponentID(id) {
|
4936 | nullComponentIDsRegistry[id] = true;
|
4937 | }
|
4938 |
|
4939 | |
4940 |
|
4941 |
|
4942 |
|
4943 | function deregisterNullComponentID(id) {
|
4944 | delete nullComponentIDsRegistry[id];
|
4945 | }
|
4946 |
|
4947 | var ReactEmptyComponentRegistry = {
|
4948 | isNullComponentID: isNullComponentID,
|
4949 | registerNullComponentID: registerNullComponentID,
|
4950 | deregisterNullComponentID: deregisterNullComponentID
|
4951 | };
|
4952 |
|
4953 | module.exports = ReactEmptyComponentRegistry;
|
4954 |
|
4955 | },
|
4956 |
|
4957 | function(module, exports, __webpack_require__) {
|
4958 |
|
4959 | |
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 | 'use strict';
|
4972 |
|
4973 | var ReactRootIndex = __webpack_require__(45);
|
4974 |
|
4975 | var invariant = __webpack_require__(12);
|
4976 |
|
4977 | var SEPARATOR = '.';
|
4978 | var SEPARATOR_LENGTH = SEPARATOR.length;
|
4979 |
|
4980 | |
4981 |
|
4982 |
|
4983 | var MAX_TREE_DEPTH = 10000;
|
4984 |
|
4985 | |
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 | function getReactRootIDString(index) {
|
4993 | return SEPARATOR + index.toString(36);
|
4994 | }
|
4995 |
|
4996 | |
4997 |
|
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 |
|
5003 |
|
5004 | function isBoundary(id, index) {
|
5005 | return id.charAt(index) === SEPARATOR || index === id.length;
|
5006 | }
|
5007 |
|
5008 | |
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 | function isValidID(id) {
|
5016 | return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
|
5017 | }
|
5018 |
|
5019 | |
5020 |
|
5021 |
|
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 | function isAncestorIDOf(ancestorID, descendantID) {
|
5028 | return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
|
5029 | }
|
5030 |
|
5031 | |
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 | function getParentID(id) {
|
5039 | return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
|
5040 | }
|
5041 |
|
5042 | |
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 | function getNextDescendantID(ancestorID, destinationID) {
|
5052 | !(isValidID(ancestorID) && isValidID(destinationID)) ? true ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
|
5053 | !isAncestorIDOf(ancestorID, destinationID) ? true ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
|
5054 | if (ancestorID === destinationID) {
|
5055 | return ancestorID;
|
5056 | }
|
5057 |
|
5058 |
|
5059 | var start = ancestorID.length + SEPARATOR_LENGTH;
|
5060 | var i;
|
5061 | for (i = start; i < destinationID.length; i++) {
|
5062 | if (isBoundary(destinationID, i)) {
|
5063 | break;
|
5064 | }
|
5065 | }
|
5066 | return destinationID.substr(0, i);
|
5067 | }
|
5068 |
|
5069 | |
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 | function getFirstCommonAncestorID(oneID, twoID) {
|
5081 | var minLength = Math.min(oneID.length, twoID.length);
|
5082 | if (minLength === 0) {
|
5083 | return '';
|
5084 | }
|
5085 | var lastCommonMarkerIndex = 0;
|
5086 |
|
5087 | for (var i = 0; i <= minLength; i++) {
|
5088 | if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
|
5089 | lastCommonMarkerIndex = i;
|
5090 | } else if (oneID.charAt(i) !== twoID.charAt(i)) {
|
5091 | break;
|
5092 | }
|
5093 | }
|
5094 | var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
5095 | !isValidID(longestCommonID) ? true ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
|
5096 | return longestCommonID;
|
5097 | }
|
5098 |
|
5099 | |
5100 |
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 |
|
5111 |
|
5112 | function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
5113 | start = start || '';
|
5114 | stop = stop || '';
|
5115 | !(start !== stop) ? true ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
|
5116 | var traverseUp = isAncestorIDOf(stop, start);
|
5117 | !(traverseUp || isAncestorIDOf(start, stop)) ? true ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
|
5118 |
|
5119 | var depth = 0;
|
5120 | var traverse = traverseUp ? getParentID : getNextDescendantID;
|
5121 | for (var id = start;; id = traverse(id, stop)) {
|
5122 | var ret;
|
5123 | if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
|
5124 | ret = cb(id, traverseUp, arg);
|
5125 | }
|
5126 | if (ret === false || id === stop) {
|
5127 |
|
5128 | break;
|
5129 | }
|
5130 | !(depth++ < MAX_TREE_DEPTH) ? true ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
|
5131 | }
|
5132 | }
|
5133 |
|
5134 | /**
|
5135 | * Manages the IDs assigned to DOM representations of React components. This
|
5136 | * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
|
5137 | * order to simulate events).
|
5138 | *
|
5139 | * @internal
|
5140 | */
|
5141 | var ReactInstanceHandles = {
|
5142 |
|
5143 | /**
|
5144 | * Constructs a React root ID
|
5145 | * @return {string} A React root ID.
|
5146 | */
|
5147 | createReactRootID: function () {
|
5148 | return getReactRootIDString(ReactRootIndex.createReactRootIndex());
|
5149 | },
|
5150 |
|
5151 | /**
|
5152 | * Constructs a React ID by joining a root ID with a name.
|
5153 | *
|
5154 | * @param {string} rootID Root ID of a parent component.
|
5155 | * @param {string} name A component's name (as flattened children).
|
5156 | * @return {string} A React ID.
|
5157 | * @internal
|
5158 | */
|
5159 | createReactID: function (rootID, name) {
|
5160 | return rootID + name;
|
5161 | },
|
5162 |
|
5163 | /**
|
5164 | * Gets the DOM ID of the React component that is the root of the tree that
|
5165 | * contains the React component with the supplied DOM ID.
|
5166 | *
|
5167 | * @param {string} id DOM ID of a React component.
|
5168 | * @return {?string} DOM ID of the React component that is the root.
|
5169 | * @internal
|
5170 | */
|
5171 | getReactRootIDFromNodeID: function (id) {
|
5172 | if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
|
5173 | var index = id.indexOf(SEPARATOR, 1);
|
5174 | return index > -1 ? id.substr(0, index) : id;
|
5175 | }
|
5176 | return null;
|
5177 | },
|
5178 |
|
5179 | /**
|
5180 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
|
5181 | * should would receive a `mouseEnter` or `mouseLeave` event.
|
5182 | *
|
5183 | * NOTE: Does not invoke the callback on the nearest common ancestor because
|
5184 | * nothing "entered" or "left" that element.
|
5185 | *
|
5186 | * @param {string} leaveID ID being left.
|
5187 | * @param {string} enterID ID being entered.
|
5188 | * @param {function} cb Callback to invoke on each entered/left ID.
|
5189 | * @param {*} upArg Argument to invoke the callback with on left IDs.
|
5190 | * @param {*} downArg Argument to invoke the callback with on entered IDs.
|
5191 | * @internal
|
5192 | */
|
5193 | traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
|
5194 | var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
|
5195 | if (ancestorID !== leaveID) {
|
5196 | traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
|
5197 | }
|
5198 | if (ancestorID !== enterID) {
|
5199 | traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
|
5200 | }
|
5201 | },
|
5202 |
|
5203 | /**
|
5204 | * Simulates the traversal of a two-phase, capture/bubble event dispatch.
|
5205 | *
|
5206 | * NOTE: This traversal happens on IDs without touching the DOM.
|
5207 | *
|
5208 | * @param {string} targetID ID of the target node.
|
5209 | * @param {function} cb Callback to invoke.
|
5210 | * @param {*} arg Argument to invoke the callback with.
|
5211 | * @internal
|
5212 | */
|
5213 | traverseTwoPhase: function (targetID, cb, arg) {
|
5214 | if (targetID) {
|
5215 | traverseParentPath('', targetID, cb, arg, true, false);
|
5216 | traverseParentPath(targetID, '', cb, arg, false, true);
|
5217 | }
|
5218 | },
|
5219 |
|
5220 | /**
|
5221 | * Same as `traverseTwoPhase` but skips the `targetID`.
|
5222 | */
|
5223 | traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
|
5224 | if (targetID) {
|
5225 | traverseParentPath('', targetID, cb, arg, true, true);
|
5226 | traverseParentPath(targetID, '', cb, arg, true, true);
|
5227 | }
|
5228 | },
|
5229 |
|
5230 | /**
|
5231 | * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
|
5232 | * example, passing `.0.$row-0.1` would result in `cb` getting called
|
5233 | * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
|
5234 | *
|
5235 | * NOTE: This traversal happens on IDs without touching the DOM.
|
5236 | *
|
5237 | * @param {string} targetID ID of the target node.
|
5238 | * @param {function} cb Callback to invoke.
|
5239 | * @param {*} arg Argument to invoke the callback with.
|
5240 | * @internal
|
5241 | */
|
5242 | traverseAncestors: function (targetID, cb, arg) {
|
5243 | traverseParentPath('', targetID, cb, arg, true, false);
|
5244 | },
|
5245 |
|
5246 | getFirstCommonAncestorID: getFirstCommonAncestorID,
|
5247 |
|
5248 | /**
|
5249 | * Exposed for unit testing.
|
5250 | * @private
|
5251 | */
|
5252 | _getNextDescendantID: getNextDescendantID,
|
5253 |
|
5254 | isAncestorIDOf: isAncestorIDOf,
|
5255 |
|
5256 | SEPARATOR: SEPARATOR
|
5257 |
|
5258 | };
|
5259 |
|
5260 | module.exports = ReactInstanceHandles;
|
5261 |
|
5262 | /***/ },
|
5263 | /* 45 */
|
5264 | /***/ function(module, exports) {
|
5265 |
|
5266 | /**
|
5267 | * Copyright 2013-2015, Facebook, Inc.
|
5268 | * All rights reserved.
|
5269 | *
|
5270 | * This source code is licensed under the BSD-style license found in the
|
5271 | * LICENSE file in the root directory of this source tree. An additional grant
|
5272 | * of patent rights can be found in the PATENTS file in the same directory.
|
5273 | *
|
5274 | * @providesModule ReactRootIndex
|
5275 | * @typechecks
|
5276 | */
|
5277 |
|
5278 | 'use strict';
|
5279 |
|
5280 | var ReactRootIndexInjection = {
|
5281 | /**
|
5282 | * @param {function} _createReactRootIndex
|
5283 | */
|
5284 | injectCreateReactRootIndex: function (_createReactRootIndex) {
|
5285 | ReactRootIndex.createReactRootIndex = _createReactRootIndex;
|
5286 | }
|
5287 | };
|
5288 |
|
5289 | var ReactRootIndex = {
|
5290 | createReactRootIndex: null,
|
5291 | injection: ReactRootIndexInjection
|
5292 | };
|
5293 |
|
5294 | module.exports = ReactRootIndex;
|
5295 |
|
5296 | /***/ },
|
5297 | /* 46 */
|
5298 | /***/ function(module, exports) {
|
5299 |
|
5300 | /**
|
5301 | * Copyright 2013-2015, Facebook, Inc.
|
5302 | * All rights reserved.
|
5303 | *
|
5304 | * This source code is licensed under the BSD-style license found in the
|
5305 | * LICENSE file in the root directory of this source tree. An additional grant
|
5306 | * of patent rights can be found in the PATENTS file in the same directory.
|
5307 | *
|
5308 | * @providesModule ReactInstanceMap
|
5309 | */
|
5310 |
|
5311 | 'use strict';
|
5312 |
|
5313 | /**
|
5314 | * `ReactInstanceMap` maintains a mapping from a public facing stateful
|
5315 | * instance (key) and the internal representation (value). This allows public
|
5316 | * methods to accept the user facing instance as an argument and map them back
|
5317 | * to internal methods.
|
5318 | */
|
5319 |
|
5320 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
|
5321 | var ReactInstanceMap = {
|
5322 |
|
5323 | /**
|
5324 | * This API should be called `delete` but we'd have to make sure to always
|
5325 | * transform these to strings for IE support. When this transform is fully
|
5326 | * supported we can rename it.
|
5327 | */
|
5328 | remove: function (key) {
|
5329 | key._reactInternalInstance = undefined;
|
5330 | },
|
5331 |
|
5332 | get: function (key) {
|
5333 | return key._reactInternalInstance;
|
5334 | },
|
5335 |
|
5336 | has: function (key) {
|
5337 | return key._reactInternalInstance !== undefined;
|
5338 | },
|
5339 |
|
5340 | set: function (key, value) {
|
5341 | key._reactInternalInstance = value;
|
5342 | }
|
5343 |
|
5344 | };
|
5345 |
|
5346 | module.exports = ReactInstanceMap;
|
5347 |
|
5348 | /***/ },
|
5349 | /* 47 */
|
5350 | /***/ function(module, exports, __webpack_require__) {
|
5351 |
|
5352 | /**
|
5353 | * Copyright 2013-2015, Facebook, Inc.
|
5354 | * All rights reserved.
|
5355 | *
|
5356 | * This source code is licensed under the BSD-style license found in the
|
5357 | * LICENSE file in the root directory of this source tree. An additional grant
|
5358 | * of patent rights can be found in the PATENTS file in the same directory.
|
5359 | *
|
5360 | * @providesModule ReactMarkupChecksum
|
5361 | */
|
5362 |
|
5363 | 'use strict';
|
5364 |
|
5365 | var adler32 = __webpack_require__(48);
|
5366 |
|
5367 | var TAG_END = /\/?>/;
|
5368 |
|
5369 | var ReactMarkupChecksum = {
|
5370 | CHECKSUM_ATTR_NAME: 'data-react-checksum',
|
5371 |
|
5372 | /**
|
5373 | * @param {string} markup Markup string
|
5374 | * @return {string} Markup string with checksum attribute attached
|
5375 | */
|
5376 | addChecksumToMarkup: function (markup) {
|
5377 | var checksum = adler32(markup);
|
5378 |
|
5379 | // Add checksum (handle both parent tags and self-closing tags)
|
5380 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
|
5381 | },
|
5382 |
|
5383 | /**
|
5384 | * @param {string} markup to use
|
5385 | * @param {DOMElement} element root React element
|
5386 | * @returns {boolean} whether or not the markup is the same
|
5387 | */
|
5388 | canReuseMarkup: function (markup, element) {
|
5389 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
5390 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
|
5391 | var markupChecksum = adler32(markup);
|
5392 | return markupChecksum === existingChecksum;
|
5393 | }
|
5394 | };
|
5395 |
|
5396 | module.exports = ReactMarkupChecksum;
|
5397 |
|
5398 | /***/ },
|
5399 | /* 48 */
|
5400 | /***/ function(module, exports) {
|
5401 |
|
5402 | /**
|
5403 | * Copyright 2013-2015, Facebook, Inc.
|
5404 | * All rights reserved.
|
5405 | *
|
5406 | * This source code is licensed under the BSD-style license found in the
|
5407 | * LICENSE file in the root directory of this source tree. An additional grant
|
5408 | * of patent rights can be found in the PATENTS file in the same directory.
|
5409 | *
|
5410 | * @providesModule adler32
|
5411 | */
|
5412 |
|
5413 | 'use strict';
|
5414 |
|
5415 | var MOD = 65521;
|
5416 |
|
5417 | // adler32 is not cryptographically strong, and is only used to sanity check that
|
5418 | // markup generated on the server matches the markup generated on the client.
|
5419 | // This implementation (a modified version of the SheetJS version) has been optimized
|
5420 | // for our use case, at the expense of conforming to the adler32 specification
|
5421 | // for non-ascii inputs.
|
5422 | function adler32(data) {
|
5423 | var a = 1;
|
5424 | var b = 0;
|
5425 | var i = 0;
|
5426 | var l = data.length;
|
5427 | var m = l & ~0x3;
|
5428 | while (i < m) {
|
5429 | for (; i < Math.min(i + 4096, m); i += 4) {
|
5430 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
|
5431 | }
|
5432 | a %= MOD;
|
5433 | b %= MOD;
|
5434 | }
|
5435 | for (; i < l; i++) {
|
5436 | b += a += data.charCodeAt(i);
|
5437 | }
|
5438 | a %= MOD;
|
5439 | b %= MOD;
|
5440 | return a | b << 16;
|
5441 | }
|
5442 |
|
5443 | module.exports = adler32;
|
5444 |
|
5445 | /***/ },
|
5446 | /* 49 */
|
5447 | /***/ function(module, exports, __webpack_require__) {
|
5448 |
|
5449 | /**
|
5450 | * Copyright 2013-2015, Facebook, Inc.
|
5451 | * All rights reserved.
|
5452 | *
|
5453 | * This source code is licensed under the BSD-style license found in the
|
5454 | * LICENSE file in the root directory of this source tree. An additional grant
|
5455 | * of patent rights can be found in the PATENTS file in the same directory.
|
5456 | *
|
5457 | * @providesModule ReactReconciler
|
5458 | */
|
5459 |
|
5460 | 'use strict';
|
5461 |
|
5462 | var ReactRef = __webpack_require__(50);
|
5463 |
|
5464 | /**
|
5465 | * Helper to call ReactRef.attachRefs with this composite component, split out
|
5466 | * to avoid allocations in the transaction mount-ready queue.
|
5467 | */
|
5468 | function attachRefs() {
|
5469 | ReactRef.attachRefs(this, this._currentElement);
|
5470 | }
|
5471 |
|
5472 | var ReactReconciler = {
|
5473 |
|
5474 | /**
|
5475 | * Initializes the component, renders markup, and registers event listeners.
|
5476 | *
|
5477 | * @param {ReactComponent} internalInstance
|
5478 | * @param {string} rootID DOM ID of the root node.
|
5479 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
5480 | * @return {?string} Rendered markup to be inserted into the DOM.
|
5481 | * @final
|
5482 | * @internal
|
5483 | */
|
5484 | mountComponent: function (internalInstance, rootID, transaction, context) {
|
5485 | var markup = internalInstance.mountComponent(rootID, transaction, context);
|
5486 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
5487 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
5488 | }
|
5489 | return markup;
|
5490 | },
|
5491 |
|
5492 | /**
|
5493 | * Releases any resources allocated by `mountComponent`.
|
5494 | *
|
5495 | * @final
|
5496 | * @internal
|
5497 | */
|
5498 | unmountComponent: function (internalInstance) {
|
5499 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
|
5500 | internalInstance.unmountComponent();
|
5501 | },
|
5502 |
|
5503 | /**
|
5504 | * Update a component using a new element.
|
5505 | *
|
5506 | * @param {ReactComponent} internalInstance
|
5507 | * @param {ReactElement} nextElement
|
5508 | * @param {ReactReconcileTransaction} transaction
|
5509 | * @param {object} context
|
5510 | * @internal
|
5511 | */
|
5512 | receiveComponent: function (internalInstance, nextElement, transaction, context) {
|
5513 | var prevElement = internalInstance._currentElement;
|
5514 |
|
5515 | if (nextElement === prevElement && context === internalInstance._context) {
|
5516 | // Since elements are immutable after the owner is rendered,
|
5517 | // we can do a cheap identity compare here to determine if this is a
|
5518 | // superfluous reconcile. It's possible for state to be mutable but such
|
5519 | // change should trigger an update of the owner which would recreate
|
5520 | // the element. We explicitly check for the existence of an owner since
|
5521 | // it's possible for an element created outside a composite to be
|
5522 | // deeply mutated and reused.
|
5523 |
|
5524 | // TODO: Bailing out early is just a perf optimization right?
|
5525 | // TODO: Removing the return statement should affect correctness?
|
5526 | return;
|
5527 | }
|
5528 |
|
5529 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
|
5530 |
|
5531 | if (refsChanged) {
|
5532 | ReactRef.detachRefs(internalInstance, prevElement);
|
5533 | }
|
5534 |
|
5535 | internalInstance.receiveComponent(nextElement, transaction, context);
|
5536 |
|
5537 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
5538 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
5539 | }
|
5540 | },
|
5541 |
|
5542 | /**
|
5543 | * Flush any dirty changes in a component.
|
5544 | *
|
5545 | * @param {ReactComponent} internalInstance
|
5546 | * @param {ReactReconcileTransaction} transaction
|
5547 | * @internal
|
5548 | */
|
5549 | performUpdateIfNecessary: function (internalInstance, transaction) {
|
5550 | internalInstance.performUpdateIfNecessary(transaction);
|
5551 | }
|
5552 |
|
5553 | };
|
5554 |
|
5555 | module.exports = ReactReconciler;
|
5556 |
|
5557 | /***/ },
|
5558 | /* 50 */
|
5559 | /***/ function(module, exports, __webpack_require__) {
|
5560 |
|
5561 | /**
|
5562 | * Copyright 2013-2015, Facebook, Inc.
|
5563 | * All rights reserved.
|
5564 | *
|
5565 | * This source code is licensed under the BSD-style license found in the
|
5566 | * LICENSE file in the root directory of this source tree. An additional grant
|
5567 | * of patent rights can be found in the PATENTS file in the same directory.
|
5568 | *
|
5569 | * @providesModule ReactRef
|
5570 | */
|
5571 |
|
5572 | 'use strict';
|
5573 |
|
5574 | var ReactOwner = __webpack_require__(51);
|
5575 |
|
5576 | var ReactRef = {};
|
5577 |
|
5578 | function attachRef(ref, component, owner) {
|
5579 | if (typeof ref === 'function') {
|
5580 | ref(component.getPublicInstance());
|
5581 | } else {
|
5582 | // Legacy ref
|
5583 | ReactOwner.addComponentAsRefTo(component, ref, owner);
|
5584 | }
|
5585 | }
|
5586 |
|
5587 | function detachRef(ref, component, owner) {
|
5588 | if (typeof ref === 'function') {
|
5589 | ref(null);
|
5590 | } else {
|
5591 | // Legacy ref
|
5592 | ReactOwner.removeComponentAsRefFrom(component, ref, owner);
|
5593 | }
|
5594 | }
|
5595 |
|
5596 | ReactRef.attachRefs = function (instance, element) {
|
5597 | if (element === null || element === false) {
|
5598 | return;
|
5599 | }
|
5600 | var ref = element.ref;
|
5601 | if (ref != null) {
|
5602 | attachRef(ref, instance, element._owner);
|
5603 | }
|
5604 | };
|
5605 |
|
5606 | ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
|
5607 | // If either the owner or a `ref` has changed, make sure the newest owner
|
5608 | // has stored a reference to `this`, and the previous owner (if different)
|
5609 | // has forgotten the reference to `this`. We use the element instead
|
5610 | // of the public this.props because the post processing cannot determine
|
5611 | // a ref. The ref conceptually lives on the element.
|
5612 |
|
5613 | // TODO: Should this even be possible? The owner cannot change because
|
5614 | // it's forbidden by shouldUpdateReactComponent. The ref can change
|
5615 | // if you swap the keys of but not the refs. Reconsider where this check
|
5616 | // is made. It probably belongs where the key checking and
|
5617 | // instantiateReactComponent is done.
|
5618 |
|
5619 | var prevEmpty = prevElement === null || prevElement === false;
|
5620 | var nextEmpty = nextElement === null || nextElement === false;
|
5621 |
|
5622 | return(
|
5623 | // This has a few false positives w/r/t empty components.
|
5624 | prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
|
5625 | );
|
5626 | };
|
5627 |
|
5628 | ReactRef.detachRefs = function (instance, element) {
|
5629 | if (element === null || element === false) {
|
5630 | return;
|
5631 | }
|
5632 | var ref = element.ref;
|
5633 | if (ref != null) {
|
5634 | detachRef(ref, instance, element._owner);
|
5635 | }
|
5636 | };
|
5637 |
|
5638 | module.exports = ReactRef;
|
5639 |
|
5640 | /***/ },
|
5641 | /* 51 */
|
5642 | /***/ function(module, exports, __webpack_require__) {
|
5643 |
|
5644 | /**
|
5645 | * Copyright 2013-2015, Facebook, Inc.
|
5646 | * All rights reserved.
|
5647 | *
|
5648 | * This source code is licensed under the BSD-style license found in the
|
5649 | * LICENSE file in the root directory of this source tree. An additional grant
|
5650 | * of patent rights can be found in the PATENTS file in the same directory.
|
5651 | *
|
5652 | * @providesModule ReactOwner
|
5653 | */
|
5654 |
|
5655 | 'use strict';
|
5656 |
|
5657 | var invariant = __webpack_require__(12);
|
5658 |
|
5659 | /**
|
5660 | * ReactOwners are capable of storing references to owned components.
|
5661 | *
|
5662 | * All components are capable of //being// referenced by owner components, but
|
5663 | * only ReactOwner components are capable of //referencing// owned components.
|
5664 | * The named reference is known as a "ref".
|
5665 | *
|
5666 | * Refs are available when mounted and updated during reconciliation.
|
5667 | *
|
5668 | * var MyComponent = React.createClass({
|
5669 | * render: function() {
|
5670 | * return (
|
5671 | * <div onClick={this.handleClick}>
|
5672 | * <CustomComponent ref="custom" />
|
5673 | * </div>
|
5674 | * );
|
5675 | * },
|
5676 | * handleClick: function() {
|
5677 | * this.refs.custom.handleClick();
|
5678 | * },
|
5679 | * componentDidMount: function() {
|
5680 | * this.refs.custom.initialize();
|
5681 | * }
|
5682 | * });
|
5683 | *
|
5684 | * Refs should rarely be used. When refs are used, they should only be done to
|
5685 | * control data that is not handled by React's data flow.
|
5686 | *
|
5687 | * @class ReactOwner
|
5688 | */
|
5689 | var ReactOwner = {
|
5690 |
|
5691 | /**
|
5692 | * @param {?object} object
|
5693 | * @return {boolean} True if `object` is a valid owner.
|
5694 | * @final
|
5695 | */
|
5696 | isValidOwner: function (object) {
|
5697 | return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
|
5698 | },
|
5699 |
|
5700 | /**
|
5701 | * Adds a component by ref to an owner component.
|
5702 | *
|
5703 | * @param {ReactComponent} component Component to reference.
|
5704 | * @param {string} ref Name by which to refer to the component.
|
5705 | * @param {ReactOwner} owner Component on which to record the ref.
|
5706 | * @final
|
5707 | * @internal
|
5708 | */
|
5709 | addComponentAsRefTo: function (component, ref, owner) {
|
5710 | !ReactOwner.isValidOwner(owner) ? true ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
5711 | owner.attachRef(ref, component);
|
5712 | },
|
5713 |
|
5714 | /**
|
5715 | * Removes a component by ref from an owner component.
|
5716 | *
|
5717 | * @param {ReactComponent} component Component to dereference.
|
5718 | * @param {string} ref Name of the ref to remove.
|
5719 | * @param {ReactOwner} owner Component on which the ref is recorded.
|
5720 | * @final
|
5721 | * @internal
|
5722 | */
|
5723 | removeComponentAsRefFrom: function (component, ref, owner) {
|
5724 | !ReactOwner.isValidOwner(owner) ? true ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
5725 | // Check that `component` is still the current ref because we do not want to
|
5726 | // detach the ref if another component stole it.
|
5727 | if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
|
5728 | owner.detachRef(ref);
|
5729 | }
|
5730 | }
|
5731 |
|
5732 | };
|
5733 |
|
5734 | module.exports = ReactOwner;
|
5735 |
|
5736 | /***/ },
|
5737 | /* 52 */
|
5738 | /***/ function(module, exports, __webpack_require__) {
|
5739 |
|
5740 | /**
|
5741 | * Copyright 2015, Facebook, Inc.
|
5742 | * All rights reserved.
|
5743 | *
|
5744 | * This source code is licensed under the BSD-style license found in the
|
5745 | * LICENSE file in the root directory of this source tree. An additional grant
|
5746 | * of patent rights can be found in the PATENTS file in the same directory.
|
5747 | *
|
5748 | * @providesModule ReactUpdateQueue
|
5749 | */
|
5750 |
|
5751 | 'use strict';
|
5752 |
|
5753 | var ReactCurrentOwner = __webpack_require__(4);
|
5754 | var ReactElement = __webpack_require__(41);
|
5755 | var ReactInstanceMap = __webpack_require__(46);
|
5756 | var ReactUpdates = __webpack_require__(53);
|
5757 |
|
5758 | var assign = __webpack_require__(38);
|
5759 | var invariant = __webpack_require__(12);
|
5760 | var warning = __webpack_require__(24);
|
5761 |
|
5762 | function enqueueUpdate(internalInstance) {
|
5763 | ReactUpdates.enqueueUpdate(internalInstance);
|
5764 | }
|
5765 |
|
5766 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
5767 | var internalInstance = ReactInstanceMap.get(publicInstance);
|
5768 | if (!internalInstance) {
|
5769 | if (true) {
|
5770 | // Only warn when we have a callerName. Otherwise we should be silent.
|
5771 | // We're probably calling from enqueueCallback. We don't want to warn
|
5772 | // there because we already warned for the corresponding lifecycle method.
|
5773 | true ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
|
5774 | }
|
5775 | return null;
|
5776 | }
|
5777 |
|
5778 | if (true) {
|
5779 | true ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
|
5780 | }
|
5781 |
|
5782 | return internalInstance;
|
5783 | }
|
5784 |
|
5785 | /**
|
5786 | * ReactUpdateQueue allows for state updates to be scheduled into a later
|
5787 | * reconciliation step.
|
5788 | */
|
5789 | var ReactUpdateQueue = {
|
5790 |
|
5791 | /**
|
5792 | * Checks whether or not this composite component is mounted.
|
5793 | * @param {ReactClass} publicInstance The instance we want to test.
|
5794 | * @return {boolean} True if mounted, false otherwise.
|
5795 | * @protected
|
5796 | * @final
|
5797 | */
|
5798 | isMounted: function (publicInstance) {
|
5799 | if (true) {
|
5800 | var owner = ReactCurrentOwner.current;
|
5801 | if (owner !== null) {
|
5802 | true ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
|
5803 | owner._warnedAboutRefsInRender = true;
|
5804 | }
|
5805 | }
|
5806 | var internalInstance = ReactInstanceMap.get(publicInstance);
|
5807 | if (internalInstance) {
|
5808 | // During componentWillMount and render this will still be null but after
|
5809 | // that will always render to something. At least for now. So we can use
|
5810 | // this hack.
|
5811 | return !!internalInstance._renderedComponent;
|
5812 | } else {
|
5813 | return false;
|
5814 | }
|
5815 | },
|
5816 |
|
5817 | /**
|
5818 | * Enqueue a callback that will be executed after all the pending updates
|
5819 | * have processed.
|
5820 | *
|
5821 | * @param {ReactClass} publicInstance The instance to use as `this` context.
|
5822 | * @param {?function} callback Called after state is updated.
|
5823 | * @internal
|
5824 | */
|
5825 | enqueueCallback: function (publicInstance, callback) {
|
5826 | !(typeof callback === 'function') ? true ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
5827 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
|
5828 |
|
5829 | // Previously we would throw an error if we didn't have an internal
|
5830 | // instance. Since we want to make it a no-op instead, we mirror the same
|
5831 | // behavior we have in other enqueue* methods.
|
5832 | // We also need to ignore callbacks in componentWillMount. See
|
5833 | // enqueueUpdates.
|
5834 | if (!internalInstance) {
|
5835 | return null;
|
5836 | }
|
5837 |
|
5838 | if (internalInstance._pendingCallbacks) {
|
5839 | internalInstance._pendingCallbacks.push(callback);
|
5840 | } else {
|
5841 | internalInstance._pendingCallbacks = [callback];
|
5842 | }
|
5843 | // TODO: The callback here is ignored when setState is called from
|
5844 | // componentWillMount. Either fix it or disallow doing so completely in
|
5845 | // favor of getInitialState. Alternatively, we can disallow
|
5846 | // componentWillMount during server-side rendering.
|
5847 | enqueueUpdate(internalInstance);
|
5848 | },
|
5849 |
|
5850 | enqueueCallbackInternal: function (internalInstance, callback) {
|
5851 | !(typeof callback === 'function') ? true ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
5852 | if (internalInstance._pendingCallbacks) {
|
5853 | internalInstance._pendingCallbacks.push(callback);
|
5854 | } else {
|
5855 | internalInstance._pendingCallbacks = [callback];
|
5856 | }
|
5857 | enqueueUpdate(internalInstance);
|
5858 | },
|
5859 |
|
5860 | /**
|
5861 | * Forces an update. This should only be invoked when it is known with
|
5862 | * certainty that we are **not** in a DOM transaction.
|
5863 | *
|
5864 | * You may want to call this when you know that some deeper aspect of the
|
5865 | * component's state has changed but `setState` was not called.
|
5866 | *
|
5867 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
5868 | * `componentWillUpdate` and `componentDidUpdate`.
|
5869 | *
|
5870 | * @param {ReactClass} publicInstance The instance that should rerender.
|
5871 | * @internal
|
5872 | */
|
5873 | enqueueForceUpdate: function (publicInstance) {
|
5874 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
|
5875 |
|
5876 | if (!internalInstance) {
|
5877 | return;
|
5878 | }
|
5879 |
|
5880 | internalInstance._pendingForceUpdate = true;
|
5881 |
|
5882 | enqueueUpdate(internalInstance);
|
5883 | },
|
5884 |
|
5885 | /**
|
5886 | * Replaces all of the state. Always use this or `setState` to mutate state.
|
5887 | * You should treat `this.state` as immutable.
|
5888 | *
|
5889 | * There is no guarantee that `this.state` will be immediately updated, so
|
5890 | * accessing `this.state` after calling this method may return the old value.
|
5891 | *
|
5892 | * @param {ReactClass} publicInstance The instance that should rerender.
|
5893 | * @param {object} completeState Next state.
|
5894 | * @internal
|
5895 | */
|
5896 | enqueueReplaceState: function (publicInstance, completeState) {
|
5897 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
|
5898 |
|
5899 | if (!internalInstance) {
|
5900 | return;
|
5901 | }
|
5902 |
|
5903 | internalInstance._pendingStateQueue = [completeState];
|
5904 | internalInstance._pendingReplaceState = true;
|
5905 |
|
5906 | enqueueUpdate(internalInstance);
|
5907 | },
|
5908 |
|
5909 | /**
|
5910 | * Sets a subset of the state. This only exists because _pendingState is
|
5911 | * internal. This provides a merging strategy that is not available to deep
|
5912 | * properties which is confusing. TODO: Expose pendingState or don't use it
|
5913 | * during the merge.
|
5914 | *
|
5915 | * @param {ReactClass} publicInstance The instance that should rerender.
|
5916 | * @param {object} partialState Next partial state to be merged with state.
|
5917 | * @internal
|
5918 | */
|
5919 | enqueueSetState: function (publicInstance, partialState) {
|
5920 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
|
5921 |
|
5922 | if (!internalInstance) {
|
5923 | return;
|
5924 | }
|
5925 |
|
5926 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
|
5927 | queue.push(partialState);
|
5928 |
|
5929 | enqueueUpdate(internalInstance);
|
5930 | },
|
5931 |
|
5932 | /**
|
5933 | * Sets a subset of the props.
|
5934 | *
|
5935 | * @param {ReactClass} publicInstance The instance that should rerender.
|
5936 | * @param {object} partialProps Subset of the next props.
|
5937 | * @internal
|
5938 | */
|
5939 | enqueueSetProps: function (publicInstance, partialProps) {
|
5940 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
|
5941 | if (!internalInstance) {
|
5942 | return;
|
5943 | }
|
5944 | ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
|
5945 | },
|
5946 |
|
5947 | enqueueSetPropsInternal: function (internalInstance, partialProps) {
|
5948 | var topLevelWrapper = internalInstance._topLevelWrapper;
|
5949 | !topLevelWrapper ? true ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
5950 |
|
5951 | // Merge with the pending element if it exists, otherwise with existing
|
5952 | // element props.
|
5953 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
5954 | var element = wrapElement.props;
|
5955 | var props = assign({}, element.props, partialProps);
|
5956 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
5957 |
|
5958 | enqueueUpdate(topLevelWrapper);
|
5959 | },
|
5960 |
|
5961 | /**
|
5962 | * Replaces all of the props.
|
5963 | *
|
5964 | * @param {ReactClass} publicInstance The instance that should rerender.
|
5965 | * @param {object} props New props.
|
5966 | * @internal
|
5967 | */
|
5968 | enqueueReplaceProps: function (publicInstance, props) {
|
5969 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
|
5970 | if (!internalInstance) {
|
5971 | return;
|
5972 | }
|
5973 | ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
|
5974 | },
|
5975 |
|
5976 | enqueueReplacePropsInternal: function (internalInstance, props) {
|
5977 | var topLevelWrapper = internalInstance._topLevelWrapper;
|
5978 | !topLevelWrapper ? true ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
5979 |
|
5980 | // Merge with the pending element if it exists, otherwise with existing
|
5981 | // element props.
|
5982 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
5983 | var element = wrapElement.props;
|
5984 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
5985 |
|
5986 | enqueueUpdate(topLevelWrapper);
|
5987 | },
|
5988 |
|
5989 | enqueueElementInternal: function (internalInstance, newElement) {
|
5990 | internalInstance._pendingElement = newElement;
|
5991 | enqueueUpdate(internalInstance);
|
5992 | }
|
5993 |
|
5994 | };
|
5995 |
|
5996 | module.exports = ReactUpdateQueue;
|
5997 |
|
5998 | /***/ },
|
5999 | /* 53 */
|
6000 | /***/ function(module, exports, __webpack_require__) {
|
6001 |
|
6002 | /**
|
6003 | * Copyright 2013-2015, Facebook, Inc.
|
6004 | * All rights reserved.
|
6005 | *
|
6006 | * This source code is licensed under the BSD-style license found in the
|
6007 | * LICENSE file in the root directory of this source tree. An additional grant
|
6008 | * of patent rights can be found in the PATENTS file in the same directory.
|
6009 | *
|
6010 | * @providesModule ReactUpdates
|
6011 | */
|
6012 |
|
6013 | 'use strict';
|
6014 |
|
6015 | var CallbackQueue = __webpack_require__(54);
|
6016 | var PooledClass = __webpack_require__(55);
|
6017 | var ReactPerf = __webpack_require__(17);
|
6018 | var ReactReconciler = __webpack_require__(49);
|
6019 | var Transaction = __webpack_require__(56);
|
6020 |
|
6021 | var assign = __webpack_require__(38);
|
6022 | var invariant = __webpack_require__(12);
|
6023 |
|
6024 | var dirtyComponents = [];
|
6025 | var asapCallbackQueue = CallbackQueue.getPooled();
|
6026 | var asapEnqueued = false;
|
6027 |
|
6028 | var batchingStrategy = null;
|
6029 |
|
6030 | function ensureInjected() {
|
6031 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? true ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
|
6032 | }
|
6033 |
|
6034 | var NESTED_UPDATES = {
|
6035 | initialize: function () {
|
6036 | this.dirtyComponentsLength = dirtyComponents.length;
|
6037 | },
|
6038 | close: function () {
|
6039 | if (this.dirtyComponentsLength !== dirtyComponents.length) {
|
6040 | // Additional updates were enqueued by componentDidUpdate handlers or
|
6041 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
|
6042 | // these new updates so that if A's componentDidUpdate calls setState on
|
6043 | // B, B will update before the callback A's updater provided when calling
|
6044 | // setState.
|
6045 | dirtyComponents.splice(0, this.dirtyComponentsLength);
|
6046 | flushBatchedUpdates();
|
6047 | } else {
|
6048 | dirtyComponents.length = 0;
|
6049 | }
|
6050 | }
|
6051 | };
|
6052 |
|
6053 | var UPDATE_QUEUEING = {
|
6054 | initialize: function () {
|
6055 | this.callbackQueue.reset();
|
6056 | },
|
6057 | close: function () {
|
6058 | this.callbackQueue.notifyAll();
|
6059 | }
|
6060 | };
|
6061 |
|
6062 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
|
6063 |
|
6064 | function ReactUpdatesFlushTransaction() {
|
6065 | this.reinitializeTransaction();
|
6066 | this.dirtyComponentsLength = null;
|
6067 | this.callbackQueue = CallbackQueue.getPooled();
|
6068 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
|
6069 | }
|
6070 |
|
6071 | assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
|
6072 | getTransactionWrappers: function () {
|
6073 | return TRANSACTION_WRAPPERS;
|
6074 | },
|
6075 |
|
6076 | destructor: function () {
|
6077 | this.dirtyComponentsLength = null;
|
6078 | CallbackQueue.release(this.callbackQueue);
|
6079 | this.callbackQueue = null;
|
6080 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
|
6081 | this.reconcileTransaction = null;
|
6082 | },
|
6083 |
|
6084 | perform: function (method, scope, a) {
|
6085 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
6086 | // with this transaction's wrappers around it.
|
6087 | return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
|
6088 | }
|
6089 | });
|
6090 |
|
6091 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
6092 |
|
6093 | function batchedUpdates(callback, a, b, c, d, e) {
|
6094 | ensureInjected();
|
6095 | batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
6096 | }
|
6097 |
|
6098 | /**
|
6099 | * Array comparator for ReactComponents by mount ordering.
|
6100 | *
|
6101 | * @param {ReactComponent} c1 first component you're comparing
|
6102 | * @param {ReactComponent} c2 second component you're comparing
|
6103 | * @return {number} Return value usable by Array.prototype.sort().
|
6104 | */
|
6105 | function mountOrderComparator(c1, c2) {
|
6106 | return c1._mountOrder - c2._mountOrder;
|
6107 | }
|
6108 |
|
6109 | function runBatchedUpdates(transaction) {
|
6110 | var len = transaction.dirtyComponentsLength;
|
6111 | !(len === dirtyComponents.length) ? true ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
|
6112 |
|
6113 | // Since reconciling a component higher in the owner hierarchy usually (not
|
6114 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
6115 | // them before their children by sorting the array.
|
6116 | dirtyComponents.sort(mountOrderComparator);
|
6117 |
|
6118 | for (var i = 0; i < len; i++) {
|
6119 | // If a component is unmounted before pending changes apply, it will still
|
6120 | // be here, but we assume that it has cleared its _pendingCallbacks and
|
6121 | // that performUpdateIfNecessary is a noop.
|
6122 | var component = dirtyComponents[i];
|
6123 |
|
6124 | // If performUpdateIfNecessary happens to enqueue any new updates, we
|
6125 | // shouldn't execute the callbacks until the next render happens, so
|
6126 | // stash the callbacks first
|
6127 | var callbacks = component._pendingCallbacks;
|
6128 | component._pendingCallbacks = null;
|
6129 |
|
6130 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
6131 |
|
6132 | if (callbacks) {
|
6133 | for (var j = 0; j < callbacks.length; j++) {
|
6134 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
|
6135 | }
|
6136 | }
|
6137 | }
|
6138 | }
|
6139 |
|
6140 | var flushBatchedUpdates = function () {
|
6141 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
6142 | // array and perform any updates enqueued by mount-ready handlers (i.e.,
|
6143 | // componentDidUpdate) but we need to check here too in order to catch
|
6144 | // updates enqueued by setState callbacks and asap calls.
|
6145 | while (dirtyComponents.length || asapEnqueued) {
|
6146 | if (dirtyComponents.length) {
|
6147 | var transaction = ReactUpdatesFlushTransaction.getPooled();
|
6148 | transaction.perform(runBatchedUpdates, null, transaction);
|
6149 | ReactUpdatesFlushTransaction.release(transaction);
|
6150 | }
|
6151 |
|
6152 | if (asapEnqueued) {
|
6153 | asapEnqueued = false;
|
6154 | var queue = asapCallbackQueue;
|
6155 | asapCallbackQueue = CallbackQueue.getPooled();
|
6156 | queue.notifyAll();
|
6157 | CallbackQueue.release(queue);
|
6158 | }
|
6159 | }
|
6160 | };
|
6161 | flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
|
6162 |
|
6163 | /**
|
6164 | * Mark a component as needing a rerender, adding an optional callback to a
|
6165 | * list of functions which will be executed once the rerender occurs.
|
6166 | */
|
6167 | function enqueueUpdate(component) {
|
6168 | ensureInjected();
|
6169 |
|
6170 | // Various parts of our code (such as ReactCompositeComponent's
|
6171 | // _renderValidatedComponent) assume that calls to render aren't nested;
|
6172 | // verify that that's the case. (This is called by each top-level update
|
6173 | // function, like setProps, setState, forceUpdate, etc.; creation and
|
6174 | // destruction of top-level components is guarded in ReactMount.)
|
6175 |
|
6176 | if (!batchingStrategy.isBatchingUpdates) {
|
6177 | batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
6178 | return;
|
6179 | }
|
6180 |
|
6181 | dirtyComponents.push(component);
|
6182 | }
|
6183 |
|
6184 | /**
|
6185 | * Enqueue a callback to be run at the end of the current batching cycle. Throws
|
6186 | * if no updates are currently being performed.
|
6187 | */
|
6188 | function asap(callback, context) {
|
6189 | !batchingStrategy.isBatchingUpdates ? true ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
|
6190 | asapCallbackQueue.enqueue(callback, context);
|
6191 | asapEnqueued = true;
|
6192 | }
|
6193 |
|
6194 | var ReactUpdatesInjection = {
|
6195 | injectReconcileTransaction: function (ReconcileTransaction) {
|
6196 | !ReconcileTransaction ? true ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
|
6197 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
6198 | },
|
6199 |
|
6200 | injectBatchingStrategy: function (_batchingStrategy) {
|
6201 | !_batchingStrategy ? true ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
|
6202 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? true ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
|
6203 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? true ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
|
6204 | batchingStrategy = _batchingStrategy;
|
6205 | }
|
6206 | };
|
6207 |
|
6208 | var ReactUpdates = {
|
6209 | /**
|
6210 | * React references `ReactReconcileTransaction` using this property in order
|
6211 | * to allow dependency injection.
|
6212 | *
|
6213 | * @internal
|
6214 | */
|
6215 | ReactReconcileTransaction: null,
|
6216 |
|
6217 | batchedUpdates: batchedUpdates,
|
6218 | enqueueUpdate: enqueueUpdate,
|
6219 | flushBatchedUpdates: flushBatchedUpdates,
|
6220 | injection: ReactUpdatesInjection,
|
6221 | asap: asap
|
6222 | };
|
6223 |
|
6224 | module.exports = ReactUpdates;
|
6225 |
|
6226 | /***/ },
|
6227 | /* 54 */
|
6228 | /***/ function(module, exports, __webpack_require__) {
|
6229 |
|
6230 | /**
|
6231 | * Copyright 2013-2015, Facebook, Inc.
|
6232 | * All rights reserved.
|
6233 | *
|
6234 | * This source code is licensed under the BSD-style license found in the
|
6235 | * LICENSE file in the root directory of this source tree. An additional grant
|
6236 | * of patent rights can be found in the PATENTS file in the same directory.
|
6237 | *
|
6238 | * @providesModule CallbackQueue
|
6239 | */
|
6240 |
|
6241 | 'use strict';
|
6242 |
|
6243 | var PooledClass = __webpack_require__(55);
|
6244 |
|
6245 | var assign = __webpack_require__(38);
|
6246 | var invariant = __webpack_require__(12);
|
6247 |
|
6248 | /**
|
6249 | * A specialized pseudo-event module to help keep track of components waiting to
|
6250 | * be notified when their DOM representations are available for use.
|
6251 | *
|
6252 | * This implements `PooledClass`, so you should never need to instantiate this.
|
6253 | * Instead, use `CallbackQueue.getPooled()`.
|
6254 | *
|
6255 | * @class ReactMountReady
|
6256 | * @implements PooledClass
|
6257 | * @internal
|
6258 | */
|
6259 | function CallbackQueue() {
|
6260 | this._callbacks = null;
|
6261 | this._contexts = null;
|
6262 | }
|
6263 |
|
6264 | assign(CallbackQueue.prototype, {
|
6265 |
|
6266 | /**
|
6267 | * Enqueues a callback to be invoked when `notifyAll` is invoked.
|
6268 | *
|
6269 | * @param {function} callback Invoked when `notifyAll` is invoked.
|
6270 | * @param {?object} context Context to call `callback` with.
|
6271 | * @internal
|
6272 | */
|
6273 | enqueue: function (callback, context) {
|
6274 | this._callbacks = this._callbacks || [];
|
6275 | this._contexts = this._contexts || [];
|
6276 | this._callbacks.push(callback);
|
6277 | this._contexts.push(context);
|
6278 | },
|
6279 |
|
6280 | /**
|
6281 | * Invokes all enqueued callbacks and clears the queue. This is invoked after
|
6282 | * the DOM representation of a component has been created or updated.
|
6283 | *
|
6284 | * @internal
|
6285 | */
|
6286 | notifyAll: function () {
|
6287 | var callbacks = this._callbacks;
|
6288 | var contexts = this._contexts;
|
6289 | if (callbacks) {
|
6290 | !(callbacks.length === contexts.length) ? true ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
|
6291 | this._callbacks = null;
|
6292 | this._contexts = null;
|
6293 | for (var i = 0; i < callbacks.length; i++) {
|
6294 | callbacks[i].call(contexts[i]);
|
6295 | }
|
6296 | callbacks.length = 0;
|
6297 | contexts.length = 0;
|
6298 | }
|
6299 | },
|
6300 |
|
6301 | /**
|
6302 | * Resets the internal queue.
|
6303 | *
|
6304 | * @internal
|
6305 | */
|
6306 | reset: function () {
|
6307 | this._callbacks = null;
|
6308 | this._contexts = null;
|
6309 | },
|
6310 |
|
6311 | /**
|
6312 | * `PooledClass` looks for this.
|
6313 | */
|
6314 | destructor: function () {
|
6315 | this.reset();
|
6316 | }
|
6317 |
|
6318 | });
|
6319 |
|
6320 | PooledClass.addPoolingTo(CallbackQueue);
|
6321 |
|
6322 | module.exports = CallbackQueue;
|
6323 |
|
6324 | /***/ },
|
6325 | /* 55 */
|
6326 | /***/ function(module, exports, __webpack_require__) {
|
6327 |
|
6328 | /**
|
6329 | * Copyright 2013-2015, Facebook, Inc.
|
6330 | * All rights reserved.
|
6331 | *
|
6332 | * This source code is licensed under the BSD-style license found in the
|
6333 | * LICENSE file in the root directory of this source tree. An additional grant
|
6334 | * of patent rights can be found in the PATENTS file in the same directory.
|
6335 | *
|
6336 | * @providesModule PooledClass
|
6337 | */
|
6338 |
|
6339 | 'use strict';
|
6340 |
|
6341 | var invariant = __webpack_require__(12);
|
6342 |
|
6343 | /**
|
6344 | * Static poolers. Several custom versions for each potential number of
|
6345 | * arguments. A completely generic pooler is easy to implement, but would
|
6346 | * require accessing the `arguments` object. In each of these, `this` refers to
|
6347 | * the Class itself, not an instance. If any others are needed, simply add them
|
6348 | * here, or in their own files.
|
6349 | */
|
6350 | var oneArgumentPooler = function (copyFieldsFrom) {
|
6351 | var Klass = this;
|
6352 | if (Klass.instancePool.length) {
|
6353 | var instance = Klass.instancePool.pop();
|
6354 | Klass.call(instance, copyFieldsFrom);
|
6355 | return instance;
|
6356 | } else {
|
6357 | return new Klass(copyFieldsFrom);
|
6358 | }
|
6359 | };
|
6360 |
|
6361 | var twoArgumentPooler = function (a1, a2) {
|
6362 | var Klass = this;
|
6363 | if (Klass.instancePool.length) {
|
6364 | var instance = Klass.instancePool.pop();
|
6365 | Klass.call(instance, a1, a2);
|
6366 | return instance;
|
6367 | } else {
|
6368 | return new Klass(a1, a2);
|
6369 | }
|
6370 | };
|
6371 |
|
6372 | var threeArgumentPooler = function (a1, a2, a3) {
|
6373 | var Klass = this;
|
6374 | if (Klass.instancePool.length) {
|
6375 | var instance = Klass.instancePool.pop();
|
6376 | Klass.call(instance, a1, a2, a3);
|
6377 | return instance;
|
6378 | } else {
|
6379 | return new Klass(a1, a2, a3);
|
6380 | }
|
6381 | };
|
6382 |
|
6383 | var fourArgumentPooler = function (a1, a2, a3, a4) {
|
6384 | var Klass = this;
|
6385 | if (Klass.instancePool.length) {
|
6386 | var instance = Klass.instancePool.pop();
|
6387 | Klass.call(instance, a1, a2, a3, a4);
|
6388 | return instance;
|
6389 | } else {
|
6390 | return new Klass(a1, a2, a3, a4);
|
6391 | }
|
6392 | };
|
6393 |
|
6394 | var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
6395 | var Klass = this;
|
6396 | if (Klass.instancePool.length) {
|
6397 | var instance = Klass.instancePool.pop();
|
6398 | Klass.call(instance, a1, a2, a3, a4, a5);
|
6399 | return instance;
|
6400 | } else {
|
6401 | return new Klass(a1, a2, a3, a4, a5);
|
6402 | }
|
6403 | };
|
6404 |
|
6405 | var standardReleaser = function (instance) {
|
6406 | var Klass = this;
|
6407 | !(instance instanceof Klass) ? true ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
|
6408 | instance.destructor();
|
6409 | if (Klass.instancePool.length < Klass.poolSize) {
|
6410 | Klass.instancePool.push(instance);
|
6411 | }
|
6412 | };
|
6413 |
|
6414 | var DEFAULT_POOL_SIZE = 10;
|
6415 | var DEFAULT_POOLER = oneArgumentPooler;
|
6416 |
|
6417 | /**
|
6418 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class
|
6419 | * itself (statically) not adding any prototypical fields. Any CopyConstructor
|
6420 | * you give this may have a `poolSize` property, and will look for a
|
6421 | * prototypical `destructor` on instances (optional).
|
6422 | *
|
6423 | * @param {Function} CopyConstructor Constructor that can be used to reset.
|
6424 | * @param {Function} pooler Customizable pooler.
|
6425 | */
|
6426 | var addPoolingTo = function (CopyConstructor, pooler) {
|
6427 | var NewKlass = CopyConstructor;
|
6428 | NewKlass.instancePool = [];
|
6429 | NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
6430 | if (!NewKlass.poolSize) {
|
6431 | NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
6432 | }
|
6433 | NewKlass.release = standardReleaser;
|
6434 | return NewKlass;
|
6435 | };
|
6436 |
|
6437 | var PooledClass = {
|
6438 | addPoolingTo: addPoolingTo,
|
6439 | oneArgumentPooler: oneArgumentPooler,
|
6440 | twoArgumentPooler: twoArgumentPooler,
|
6441 | threeArgumentPooler: threeArgumentPooler,
|
6442 | fourArgumentPooler: fourArgumentPooler,
|
6443 | fiveArgumentPooler: fiveArgumentPooler
|
6444 | };
|
6445 |
|
6446 | module.exports = PooledClass;
|
6447 |
|
6448 | /***/ },
|
6449 | /* 56 */
|
6450 | /***/ function(module, exports, __webpack_require__) {
|
6451 |
|
6452 | /**
|
6453 | * Copyright 2013-2015, Facebook, Inc.
|
6454 | * All rights reserved.
|
6455 | *
|
6456 | * This source code is licensed under the BSD-style license found in the
|
6457 | * LICENSE file in the root directory of this source tree. An additional grant
|
6458 | * of patent rights can be found in the PATENTS file in the same directory.
|
6459 | *
|
6460 | * @providesModule Transaction
|
6461 | */
|
6462 |
|
6463 | 'use strict';
|
6464 |
|
6465 | var invariant = __webpack_require__(12);
|
6466 |
|
6467 | /**
|
6468 | * `Transaction` creates a black box that is able to wrap any method such that
|
6469 | * certain invariants are maintained before and after the method is invoked
|
6470 | * (Even if an exception is thrown while invoking the wrapped method). Whoever
|
6471 | * instantiates a transaction can provide enforcers of the invariants at
|
6472 | * creation time. The `Transaction` class itself will supply one additional
|
6473 | * automatic invariant for you - the invariant that any transaction instance
|
6474 | * should not be run while it is already being run. You would typically create a
|
6475 | * single instance of a `Transaction` for reuse multiple times, that potentially
|
6476 | * is used to wrap several different methods. Wrappers are extremely simple -
|
6477 | * they only require implementing two methods.
|
6478 | *
|
6479 | * <pre>
|
6480 | * wrappers (injected at creation time)
|
6481 | * + +
|
6482 | * | |
|
6483 | * +-----------------|--------|--------------+
|
6484 | * | v | |
|
6485 | * | +---------------+ | |
|
6486 | * | +--| wrapper1 |---|----+ |
|
6487 | * | | +---------------+ v | |
|
6488 | * | | +-------------+ | |
|
6489 | * | | +----| wrapper2 |--------+ |
|
6490 | * | | | +-------------+ | | |
|
6491 | * | | | | | |
|
6492 | * | v v v v | wrapper
|
6493 | * | +---+ +---+ +---------+ +---+ +---+ | invariants
|
6494 | * perform(anyMethod) | | | | | | | | | | | | maintained
|
6495 | * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
|
6496 | * | | | | | | | | | | | |
|
6497 | * | | | | | | | | | | | |
|
6498 | * | | | | | | | | | | | |
|
6499 | * | +---+ +---+ +---------+ +---+ +---+ |
|
6500 | * | initialize close |
|
6501 | * +-----------------------------------------+
|
6502 | * </pre>
|
6503 | *
|
6504 | * Use cases:
|
6505 | * - Preserving the input selection ranges before/after reconciliation.
|
6506 | * Restoring selection even in the event of an unexpected error.
|
6507 | * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
|
6508 | * while guaranteeing that afterwards, the event system is reactivated.
|
6509 | * - Flushing a queue of collected DOM mutations to the main UI thread after a
|
6510 | * reconciliation takes place in a worker thread.
|
6511 | * - Invoking any collected `componentDidUpdate` callbacks after rendering new
|
6512 | * content.
|
6513 | * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
|
6514 | * to preserve the `scrollTop` (an automatic scroll aware DOM).
|
6515 | * - (Future use case): Layout calculations before and after DOM updates.
|
6516 | *
|
6517 | * Transactional plugin API:
|
6518 | * - A module that has an `initialize` method that returns any precomputation.
|
6519 | * - and a `close` method that accepts the precomputation. `close` is invoked
|
6520 | * when the wrapped process is completed, or has failed.
|
6521 | *
|
6522 | * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
|
6523 | * that implement `initialize` and `close`.
|
6524 | * @return {Transaction} Single transaction for reuse in thread.
|
6525 | *
|
6526 | * @class Transaction
|
6527 | */
|
6528 | var Mixin = {
|
6529 | /**
|
6530 | * Sets up this instance so that it is prepared for collecting metrics. Does
|
6531 | * so such that this setup method may be used on an instance that is already
|
6532 | * initialized, in a way that does not consume additional memory upon reuse.
|
6533 | * That can be useful if you decide to make your subclass of this mixin a
|
6534 | * "PooledClass".
|
6535 | */
|
6536 | reinitializeTransaction: function () {
|
6537 | this.transactionWrappers = this.getTransactionWrappers();
|
6538 | if (this.wrapperInitData) {
|
6539 | this.wrapperInitData.length = 0;
|
6540 | } else {
|
6541 | this.wrapperInitData = [];
|
6542 | }
|
6543 | this._isInTransaction = false;
|
6544 | },
|
6545 |
|
6546 | _isInTransaction: false,
|
6547 |
|
6548 | /**
|
6549 | * @abstract
|
6550 | * @return {Array<TransactionWrapper>} Array of transaction wrappers.
|
6551 | */
|
6552 | getTransactionWrappers: null,
|
6553 |
|
6554 | isInTransaction: function () {
|
6555 | return !!this._isInTransaction;
|
6556 | },
|
6557 |
|
6558 | /**
|
6559 | * Executes the function within a safety window. Use this for the top level
|
6560 | * methods that result in large amounts of computation/mutations that would
|
6561 | * need to be safety checked. The optional arguments helps prevent the need
|
6562 | * to bind in many cases.
|
6563 | *
|
6564 | * @param {function} method Member of scope to call.
|
6565 | * @param {Object} scope Scope to invoke from.
|
6566 | * @param {Object?=} a Argument to pass to the method.
|
6567 | * @param {Object?=} b Argument to pass to the method.
|
6568 | * @param {Object?=} c Argument to pass to the method.
|
6569 | * @param {Object?=} d Argument to pass to the method.
|
6570 | * @param {Object?=} e Argument to pass to the method.
|
6571 | * @param {Object?=} f Argument to pass to the method.
|
6572 | *
|
6573 | * @return {*} Return value from `method`.
|
6574 | */
|
6575 | perform: function (method, scope, a, b, c, d, e, f) {
|
6576 | !!this.isInTransaction() ? true ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
|
6577 | var errorThrown;
|
6578 | var ret;
|
6579 | try {
|
6580 | this._isInTransaction = true;
|
6581 | // Catching errors makes debugging more difficult, so we start with
|
6582 | // errorThrown set to true before setting it to false after calling
|
6583 | // close -- if it's still set to true in the finally block, it means
|
6584 | // one of these calls threw.
|
6585 | errorThrown = true;
|
6586 | this.initializeAll(0);
|
6587 | ret = method.call(scope, a, b, c, d, e, f);
|
6588 | errorThrown = false;
|
6589 | } finally {
|
6590 | try {
|
6591 | if (errorThrown) {
|
6592 | // If `method` throws, prefer to show that stack trace over any thrown
|
6593 | // by invoking `closeAll`.
|
6594 | try {
|
6595 | this.closeAll(0);
|
6596 | } catch (err) {}
|
6597 | } else {
|
6598 | // Since `method` didn't throw, we don't want to silence the exception
|
6599 | // here.
|
6600 | this.closeAll(0);
|
6601 | }
|
6602 | } finally {
|
6603 | this._isInTransaction = false;
|
6604 | }
|
6605 | }
|
6606 | return ret;
|
6607 | },
|
6608 |
|
6609 | initializeAll: function (startIndex) {
|
6610 | var transactionWrappers = this.transactionWrappers;
|
6611 | for (var i = startIndex; i < transactionWrappers.length; i++) {
|
6612 | var wrapper = transactionWrappers[i];
|
6613 | try {
|
6614 | // Catching errors makes debugging more difficult, so we start with the
|
6615 | // OBSERVED_ERROR state before overwriting it with the real return value
|
6616 | // of initialize -- if it's still set to OBSERVED_ERROR in the finally
|
6617 | // block, it means wrapper.initialize threw.
|
6618 | this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
|
6619 | this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
|
6620 | } finally {
|
6621 | if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
|
6622 | // The initializer for wrapper i threw an error; initialize the
|
6623 | // remaining wrappers but silence any exceptions from them to ensure
|
6624 | // that the first error is the one to bubble up.
|
6625 | try {
|
6626 | this.initializeAll(i + 1);
|
6627 | } catch (err) {}
|
6628 | }
|
6629 | }
|
6630 | }
|
6631 | },
|
6632 |
|
6633 | /**
|
6634 | * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
|
6635 | * them the respective return values of `this.transactionWrappers.init[i]`
|
6636 | * (`close`rs that correspond to initializers that failed will not be
|
6637 | * invoked).
|
6638 | */
|
6639 | closeAll: function (startIndex) {
|
6640 | !this.isInTransaction() ? true ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
|
6641 | var transactionWrappers = this.transactionWrappers;
|
6642 | for (var i = startIndex; i < transactionWrappers.length; i++) {
|
6643 | var wrapper = transactionWrappers[i];
|
6644 | var initData = this.wrapperInitData[i];
|
6645 | var errorThrown;
|
6646 | try {
|
6647 | // Catching errors makes debugging more difficult, so we start with
|
6648 | // errorThrown set to true before setting it to false after calling
|
6649 | // close -- if it's still set to true in the finally block, it means
|
6650 | // wrapper.close threw.
|
6651 | errorThrown = true;
|
6652 | if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
|
6653 | wrapper.close.call(this, initData);
|
6654 | }
|
6655 | errorThrown = false;
|
6656 | } finally {
|
6657 | if (errorThrown) {
|
6658 | // The closer for wrapper i threw an error; close the remaining
|
6659 | // wrappers but silence any exceptions from them to ensure that the
|
6660 | // first error is the one to bubble up.
|
6661 | try {
|
6662 | this.closeAll(i + 1);
|
6663 | } catch (e) {}
|
6664 | }
|
6665 | }
|
6666 | }
|
6667 | this.wrapperInitData.length = 0;
|
6668 | }
|
6669 | };
|
6670 |
|
6671 | var Transaction = {
|
6672 |
|
6673 | Mixin: Mixin,
|
6674 |
|
6675 | /**
|
6676 | * Token to look for to determine if an error occurred.
|
6677 | */
|
6678 | OBSERVED_ERROR: {}
|
6679 |
|
6680 | };
|
6681 |
|
6682 | module.exports = Transaction;
|
6683 |
|
6684 | /***/ },
|
6685 | /* 57 */
|
6686 | /***/ function(module, exports, __webpack_require__) {
|
6687 |
|
6688 | /**
|
6689 | * Copyright 2013-2015, Facebook, Inc.
|
6690 | * All rights reserved.
|
6691 | *
|
6692 | * This source code is licensed under the BSD-style license found in the
|
6693 | * LICENSE file in the root directory of this source tree. An additional grant
|
6694 | * of patent rights can be found in the PATENTS file in the same directory.
|
6695 | *
|
6696 | * @providesModule emptyObject
|
6697 | */
|
6698 |
|
6699 | 'use strict';
|
6700 |
|
6701 | var emptyObject = {};
|
6702 |
|
6703 | if (true) {
|
6704 | Object.freeze(emptyObject);
|
6705 | }
|
6706 |
|
6707 | module.exports = emptyObject;
|
6708 |
|
6709 | /***/ },
|
6710 | /* 58 */
|
6711 | /***/ function(module, exports, __webpack_require__) {
|
6712 |
|
6713 | /**
|
6714 | * Copyright 2013-2015, Facebook, Inc.
|
6715 | * All rights reserved.
|
6716 | *
|
6717 | * This source code is licensed under the BSD-style license found in the
|
6718 | * LICENSE file in the root directory of this source tree. An additional grant
|
6719 | * of patent rights can be found in the PATENTS file in the same directory.
|
6720 | *
|
6721 | * @providesModule containsNode
|
6722 | * @typechecks
|
6723 | */
|
6724 |
|
6725 | 'use strict';
|
6726 |
|
6727 | var isTextNode = __webpack_require__(59);
|
6728 |
|
6729 | /*eslint-disable no-bitwise */
|
6730 |
|
6731 | /**
|
6732 | * Checks if a given DOM node contains or is another DOM node.
|
6733 | *
|
6734 | * @param {?DOMNode} outerNode Outer DOM node.
|
6735 | * @param {?DOMNode} innerNode Inner DOM node.
|
6736 | * @return {boolean} True if `outerNode` contains or is `innerNode`.
|
6737 | */
|
6738 | function containsNode(_x, _x2) {
|
6739 | var _again = true;
|
6740 |
|
6741 | _function: while (_again) {
|
6742 | var outerNode = _x,
|
6743 | innerNode = _x2;
|
6744 | _again = false;
|
6745 |
|
6746 | if (!outerNode || !innerNode) {
|
6747 | return false;
|
6748 | } else if (outerNode === innerNode) {
|
6749 | return true;
|
6750 | } else if (isTextNode(outerNode)) {
|
6751 | return false;
|
6752 | } else if (isTextNode(innerNode)) {
|
6753 | _x = outerNode;
|
6754 | _x2 = innerNode.parentNode;
|
6755 | _again = true;
|
6756 | continue _function;
|
6757 | } else if (outerNode.contains) {
|
6758 | return outerNode.contains(innerNode);
|
6759 | } else if (outerNode.compareDocumentPosition) {
|
6760 | return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
6761 | } else {
|
6762 | return false;
|
6763 | }
|
6764 | }
|
6765 | }
|
6766 |
|
6767 | module.exports = containsNode;
|
6768 |
|
6769 | /***/ },
|
6770 | /* 59 */
|
6771 | /***/ function(module, exports, __webpack_require__) {
|
6772 |
|
6773 | /**
|
6774 | * Copyright 2013-2015, Facebook, Inc.
|
6775 | * All rights reserved.
|
6776 | *
|
6777 | * This source code is licensed under the BSD-style license found in the
|
6778 | * LICENSE file in the root directory of this source tree. An additional grant
|
6779 | * of patent rights can be found in the PATENTS file in the same directory.
|
6780 | *
|
6781 | * @providesModule isTextNode
|
6782 | * @typechecks
|
6783 | */
|
6784 |
|
6785 | 'use strict';
|
6786 |
|
6787 | var isNode = __webpack_require__(60);
|
6788 |
|
6789 | /**
|
6790 | * @param {*} object The object to check.
|
6791 | * @return {boolean} Whether or not the object is a DOM text node.
|
6792 | */
|
6793 | function isTextNode(object) {
|
6794 | return isNode(object) && object.nodeType == 3;
|
6795 | }
|
6796 |
|
6797 | module.exports = isTextNode;
|
6798 |
|
6799 | /***/ },
|
6800 | /* 60 */
|
6801 | /***/ function(module, exports) {
|
6802 |
|
6803 | /**
|
6804 | * Copyright 2013-2015, Facebook, Inc.
|
6805 | * All rights reserved.
|
6806 | *
|
6807 | * This source code is licensed under the BSD-style license found in the
|
6808 | * LICENSE file in the root directory of this source tree. An additional grant
|
6809 | * of patent rights can be found in the PATENTS file in the same directory.
|
6810 | *
|
6811 | * @providesModule isNode
|
6812 | * @typechecks
|
6813 | */
|
6814 |
|
6815 | /**
|
6816 | * @param {*} object The object to check.
|
6817 | * @return {boolean} Whether or not the object is a DOM node.
|
6818 | */
|
6819 | 'use strict';
|
6820 |
|
6821 | function isNode(object) {
|
6822 | return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
|
6823 | }
|
6824 |
|
6825 | module.exports = isNode;
|
6826 |
|
6827 | /***/ },
|
6828 | /* 61 */
|
6829 | /***/ function(module, exports, __webpack_require__) {
|
6830 |
|
6831 | /**
|
6832 | * Copyright 2013-2015, Facebook, Inc.
|
6833 | * All rights reserved.
|
6834 | *
|
6835 | * This source code is licensed under the BSD-style license found in the
|
6836 | * LICENSE file in the root directory of this source tree. An additional grant
|
6837 | * of patent rights can be found in the PATENTS file in the same directory.
|
6838 | *
|
6839 | * @providesModule instantiateReactComponent
|
6840 | * @typechecks static-only
|
6841 | */
|
6842 |
|
6843 | 'use strict';
|
6844 |
|
6845 | var ReactCompositeComponent = __webpack_require__(62);
|
6846 | var ReactEmptyComponent = __webpack_require__(67);
|
6847 | var ReactNativeComponent = __webpack_require__(68);
|
6848 |
|
6849 | var assign = __webpack_require__(38);
|
6850 | var invariant = __webpack_require__(12);
|
6851 | var warning = __webpack_require__(24);
|
6852 |
|
6853 | // To avoid a cyclic dependency, we create the final class in this module
|
6854 | var ReactCompositeComponentWrapper = function () {};
|
6855 | assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
|
6856 | _instantiateReactComponent: instantiateReactComponent
|
6857 | });
|
6858 |
|
6859 | function getDeclarationErrorAddendum(owner) {
|
6860 | if (owner) {
|
6861 | var name = owner.getName();
|
6862 | if (name) {
|
6863 | return ' Check the render method of `' + name + '`.';
|
6864 | }
|
6865 | }
|
6866 | return '';
|
6867 | }
|
6868 |
|
6869 | /**
|
6870 | * Check if the type reference is a known internal type. I.e. not a user
|
6871 | * provided composite type.
|
6872 | *
|
6873 | * @param {function} type
|
6874 | * @return {boolean} Returns true if this is a valid internal type.
|
6875 | */
|
6876 | function isInternalComponentType(type) {
|
6877 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
|
6878 | }
|
6879 |
|
6880 | /**
|
6881 | * Given a ReactNode, create an instance that will actually be mounted.
|
6882 | *
|
6883 | * @param {ReactNode} node
|
6884 | * @return {object} A new instance of the element's constructor.
|
6885 | * @protected
|
6886 | */
|
6887 | function instantiateReactComponent(node) {
|
6888 | var instance;
|
6889 |
|
6890 | if (node === null || node === false) {
|
6891 | instance = new ReactEmptyComponent(instantiateReactComponent);
|
6892 | } else if (typeof node === 'object') {
|
6893 | var element = node;
|
6894 | !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? true ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
|
6895 |
|
6896 | // Special case string values
|
6897 | if (typeof element.type === 'string') {
|
6898 | instance = ReactNativeComponent.createInternalComponent(element);
|
6899 | } else if (isInternalComponentType(element.type)) {
|
6900 | // This is temporarily available for custom components that are not string
|
6901 | // representations. I.e. ART. Once those are updated to use the string
|
6902 | // representation, we can drop this code path.
|
6903 | instance = new element.type(element);
|
6904 | } else {
|
6905 | instance = new ReactCompositeComponentWrapper();
|
6906 | }
|
6907 | } else if (typeof node === 'string' || typeof node === 'number') {
|
6908 | instance = ReactNativeComponent.createInstanceForText(node);
|
6909 | } else {
|
6910 | true ? true ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
|
6911 | }
|
6912 |
|
6913 | if (true) {
|
6914 | true ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
|
6915 | }
|
6916 |
|
6917 | // Sets up the instance. This can probably just move into the constructor now.
|
6918 | instance.construct(node);
|
6919 |
|
6920 | // These two fields are used by the DOM and ART diffing algorithms
|
6921 | // respectively. Instead of using expandos on components, we should be
|
6922 | // storing the state needed by the diffing algorithms elsewhere.
|
6923 | instance._mountIndex = 0;
|
6924 | instance._mountImage = null;
|
6925 |
|
6926 | if (true) {
|
6927 | instance._isOwnerNecessary = false;
|
6928 | instance._warnedAboutRefsInRender = false;
|
6929 | }
|
6930 |
|
6931 | // Internal instances should fully constructed at this point, so they should
|
6932 | // not get any new fields added to them at this point.
|
6933 | if (true) {
|
6934 | if (Object.preventExtensions) {
|
6935 | Object.preventExtensions(instance);
|
6936 | }
|
6937 | }
|
6938 |
|
6939 | return instance;
|
6940 | }
|
6941 |
|
6942 | module.exports = instantiateReactComponent;
|
6943 |
|
6944 | /***/ },
|
6945 | /* 62 */
|
6946 | /***/ function(module, exports, __webpack_require__) {
|
6947 |
|
6948 | /**
|
6949 | * Copyright 2013-2015, Facebook, Inc.
|
6950 | * All rights reserved.
|
6951 | *
|
6952 | * This source code is licensed under the BSD-style license found in the
|
6953 | * LICENSE file in the root directory of this source tree. An additional grant
|
6954 | * of patent rights can be found in the PATENTS file in the same directory.
|
6955 | *
|
6956 | * @providesModule ReactCompositeComponent
|
6957 | */
|
6958 |
|
6959 | 'use strict';
|
6960 |
|
6961 | var ReactComponentEnvironment = __webpack_require__(63);
|
6962 | var ReactCurrentOwner = __webpack_require__(4);
|
6963 | var ReactElement = __webpack_require__(41);
|
6964 | var ReactInstanceMap = __webpack_require__(46);
|
6965 | var ReactPerf = __webpack_require__(17);
|
6966 | var ReactPropTypeLocations = __webpack_require__(64);
|
6967 | var ReactPropTypeLocationNames = __webpack_require__(65);
|
6968 | var ReactReconciler = __webpack_require__(49);
|
6969 | var ReactUpdateQueue = __webpack_require__(52);
|
6970 |
|
6971 | var assign = __webpack_require__(38);
|
6972 | var emptyObject = __webpack_require__(57);
|
6973 | var invariant = __webpack_require__(12);
|
6974 | var shouldUpdateReactComponent = __webpack_require__(66);
|
6975 | var warning = __webpack_require__(24);
|
6976 |
|
6977 | function getDeclarationErrorAddendum(component) {
|
6978 | var owner = component._currentElement._owner || null;
|
6979 | if (owner) {
|
6980 | var name = owner.getName();
|
6981 | if (name) {
|
6982 | return ' Check the render method of `' + name + '`.';
|
6983 | }
|
6984 | }
|
6985 | return '';
|
6986 | }
|
6987 |
|
6988 | function StatelessComponent(Component) {}
|
6989 | StatelessComponent.prototype.render = function () {
|
6990 | var Component = ReactInstanceMap.get(this)._currentElement.type;
|
6991 | return Component(this.props, this.context, this.updater);
|
6992 | };
|
6993 |
|
6994 | /**
|
6995 | * ------------------ The Life-Cycle of a Composite Component ------------------
|
6996 | *
|
6997 | * - constructor: Initialization of state. The instance is now retained.
|
6998 | * - componentWillMount
|
6999 | * - render
|
7000 | * - [children's constructors]
|
7001 | * - [children's componentWillMount and render]
|
7002 | * - [children's componentDidMount]
|
7003 | * - componentDidMount
|
7004 | *
|
7005 | * Update Phases:
|
7006 | * - componentWillReceiveProps (only called if parent updated)
|
7007 | * - shouldComponentUpdate
|
7008 | * - componentWillUpdate
|
7009 | * - render
|
7010 | * - [children's constructors or receive props phases]
|
7011 | * - componentDidUpdate
|
7012 | *
|
7013 | * - componentWillUnmount
|
7014 | * - [children's componentWillUnmount]
|
7015 | * - [children destroyed]
|
7016 | * - (destroyed): The instance is now blank, released by React and ready for GC.
|
7017 | *
|
7018 | * -----------------------------------------------------------------------------
|
7019 | */
|
7020 |
|
7021 | /**
|
7022 | * An incrementing ID assigned to each component when it is mounted. This is
|
7023 | * used to enforce the order in which `ReactUpdates` updates dirty components.
|
7024 | *
|
7025 | * @private
|
7026 | */
|
7027 | var nextMountID = 1;
|
7028 |
|
7029 | /**
|
7030 | * @lends {ReactCompositeComponent.prototype}
|
7031 | */
|
7032 | var ReactCompositeComponentMixin = {
|
7033 |
|
7034 | /**
|
7035 | * Base constructor for all composite component.
|
7036 | *
|
7037 | * @param {ReactElement} element
|
7038 | * @final
|
7039 | * @internal
|
7040 | */
|
7041 | construct: function (element) {
|
7042 | this._currentElement = element;
|
7043 | this._rootNodeID = null;
|
7044 | this._instance = null;
|
7045 |
|
7046 | // See ReactUpdateQueue
|
7047 | this._pendingElement = null;
|
7048 | this._pendingStateQueue = null;
|
7049 | this._pendingReplaceState = false;
|
7050 | this._pendingForceUpdate = false;
|
7051 |
|
7052 | this._renderedComponent = null;
|
7053 |
|
7054 | this._context = null;
|
7055 | this._mountOrder = 0;
|
7056 | this._topLevelWrapper = null;
|
7057 |
|
7058 | // See ReactUpdates and ReactUpdateQueue.
|
7059 | this._pendingCallbacks = null;
|
7060 | },
|
7061 |
|
7062 | /**
|
7063 | * Initializes the component, renders markup, and registers event listeners.
|
7064 | *
|
7065 | * @param {string} rootID DOM ID of the root node.
|
7066 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
7067 | * @return {?string} Rendered markup to be inserted into the DOM.
|
7068 | * @final
|
7069 | * @internal
|
7070 | */
|
7071 | mountComponent: function (rootID, transaction, context) {
|
7072 | this._context = context;
|
7073 | this._mountOrder = nextMountID++;
|
7074 | this._rootNodeID = rootID;
|
7075 |
|
7076 | var publicProps = this._processProps(this._currentElement.props);
|
7077 | var publicContext = this._processContext(context);
|
7078 |
|
7079 | var Component = this._currentElement.type;
|
7080 |
|
7081 | // Initialize the public class
|
7082 | var inst;
|
7083 | var renderedElement;
|
7084 |
|
7085 | // This is a way to detect if Component is a stateless arrow function
|
7086 | // component, which is not newable. It might not be 100% reliable but is
|
7087 | // something we can do until we start detecting that Component extends
|
7088 | // React.Component. We already assume that typeof Component === 'function'.
|
7089 | var canInstantiate = ('prototype' in Component);
|
7090 |
|
7091 | if (canInstantiate) {
|
7092 | if (true) {
|
7093 | ReactCurrentOwner.current = this;
|
7094 | try {
|
7095 | inst = new Component(publicProps, publicContext, ReactUpdateQueue);
|
7096 | } finally {
|
7097 | ReactCurrentOwner.current = null;
|
7098 | }
|
7099 | } else {
|
7100 | inst = new Component(publicProps, publicContext, ReactUpdateQueue);
|
7101 | }
|
7102 | }
|
7103 |
|
7104 | if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
|
7105 | renderedElement = inst;
|
7106 | inst = new StatelessComponent(Component);
|
7107 | }
|
7108 |
|
7109 | if (true) {
|
7110 | // This will throw later in _renderValidatedComponent, but add an early
|
7111 | // warning now to help debugging
|
7112 | if (inst.render == null) {
|
7113 | true ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
|
7114 | } else {
|
7115 | // We support ES6 inheriting from React.Component, the module pattern,
|
7116 | // and stateless components, but not ES6 classes that don't extend
|
7117 | true ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
|
7118 | }
|
7119 | }
|
7120 |
|
7121 | // These should be set up in the constructor, but as a convenience for
|
7122 | // simpler class abstractions, we set them up after the fact.
|
7123 | inst.props = publicProps;
|
7124 | inst.context = publicContext;
|
7125 | inst.refs = emptyObject;
|
7126 | inst.updater = ReactUpdateQueue;
|
7127 |
|
7128 | this._instance = inst;
|
7129 |
|
7130 | // Store a reference from the instance back to the internal representation
|
7131 | ReactInstanceMap.set(inst, this);
|
7132 |
|
7133 | if (true) {
|
7134 | // Since plain JS classes are defined without any special initialization
|
7135 | // logic, we can not catch common errors early. Therefore, we have to
|
7136 | // catch them here, at initialization time, instead.
|
7137 | true ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
|
7138 | true ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
|
7139 | true ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
|
7140 | true ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
|
7141 | true ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
|
7142 | true ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
|
7143 | true ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
|
7144 | }
|
7145 |
|
7146 | var initialState = inst.state;
|
7147 | if (initialState === undefined) {
|
7148 | inst.state = initialState = null;
|
7149 | }
|
7150 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? true ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7151 |
|
7152 | this._pendingStateQueue = null;
|
7153 | this._pendingReplaceState = false;
|
7154 | this._pendingForceUpdate = false;
|
7155 |
|
7156 | if (inst.componentWillMount) {
|
7157 | inst.componentWillMount();
|
7158 | // When mounting, calls to `setState` by `componentWillMount` will set
|
7159 | // `this._pendingStateQueue` without triggering a re-render.
|
7160 | if (this._pendingStateQueue) {
|
7161 | inst.state = this._processPendingState(inst.props, inst.context);
|
7162 | }
|
7163 | }
|
7164 |
|
7165 | // If not a stateless component, we now render
|
7166 | if (renderedElement === undefined) {
|
7167 | renderedElement = this._renderValidatedComponent();
|
7168 | }
|
7169 |
|
7170 | this._renderedComponent = this._instantiateReactComponent(renderedElement);
|
7171 |
|
7172 | var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
|
7173 | if (inst.componentDidMount) {
|
7174 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
|
7175 | }
|
7176 |
|
7177 | return markup;
|
7178 | },
|
7179 |
|
7180 | /**
|
7181 | * Releases any resources allocated by `mountComponent`.
|
7182 | *
|
7183 | * @final
|
7184 | * @internal
|
7185 | */
|
7186 | unmountComponent: function () {
|
7187 | var inst = this._instance;
|
7188 |
|
7189 | if (inst.componentWillUnmount) {
|
7190 | inst.componentWillUnmount();
|
7191 | }
|
7192 |
|
7193 | ReactReconciler.unmountComponent(this._renderedComponent);
|
7194 | this._renderedComponent = null;
|
7195 | this._instance = null;
|
7196 |
|
7197 | // Reset pending fields
|
7198 | // Even if this component is scheduled for another update in ReactUpdates,
|
7199 | // it would still be ignored because these fields are reset.
|
7200 | this._pendingStateQueue = null;
|
7201 | this._pendingReplaceState = false;
|
7202 | this._pendingForceUpdate = false;
|
7203 | this._pendingCallbacks = null;
|
7204 | this._pendingElement = null;
|
7205 |
|
7206 | // These fields do not really need to be reset since this object is no
|
7207 | // longer accessible.
|
7208 | this._context = null;
|
7209 | this._rootNodeID = null;
|
7210 | this._topLevelWrapper = null;
|
7211 |
|
7212 | // Delete the reference from the instance to this internal representation
|
7213 | // which allow the internals to be properly cleaned up even if the user
|
7214 | // leaks a reference to the public instance.
|
7215 | ReactInstanceMap.remove(inst);
|
7216 |
|
7217 | // Some existing components rely on inst.props even after they've been
|
7218 | // destroyed (in event handlers).
|
7219 | // TODO: inst.props = null;
|
7220 | // TODO: inst.state = null;
|
7221 | // TODO: inst.context = null;
|
7222 | },
|
7223 |
|
7224 | /**
|
7225 | * Filters the context object to only contain keys specified in
|
7226 | * `contextTypes`
|
7227 | *
|
7228 | * @param {object} context
|
7229 | * @return {?object}
|
7230 | * @private
|
7231 | */
|
7232 | _maskContext: function (context) {
|
7233 | var maskedContext = null;
|
7234 | var Component = this._currentElement.type;
|
7235 | var contextTypes = Component.contextTypes;
|
7236 | if (!contextTypes) {
|
7237 | return emptyObject;
|
7238 | }
|
7239 | maskedContext = {};
|
7240 | for (var contextName in contextTypes) {
|
7241 | maskedContext[contextName] = context[contextName];
|
7242 | }
|
7243 | return maskedContext;
|
7244 | },
|
7245 |
|
7246 | /**
|
7247 | * Filters the context object to only contain keys specified in
|
7248 | * `contextTypes`, and asserts that they are valid.
|
7249 | *
|
7250 | * @param {object} context
|
7251 | * @return {?object}
|
7252 | * @private
|
7253 | */
|
7254 | _processContext: function (context) {
|
7255 | var maskedContext = this._maskContext(context);
|
7256 | if (true) {
|
7257 | var Component = this._currentElement.type;
|
7258 | if (Component.contextTypes) {
|
7259 | this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
|
7260 | }
|
7261 | }
|
7262 | return maskedContext;
|
7263 | },
|
7264 |
|
7265 | /**
|
7266 | * @param {object} currentContext
|
7267 | * @return {object}
|
7268 | * @private
|
7269 | */
|
7270 | _processChildContext: function (currentContext) {
|
7271 | var Component = this._currentElement.type;
|
7272 | var inst = this._instance;
|
7273 | var childContext = inst.getChildContext && inst.getChildContext();
|
7274 | if (childContext) {
|
7275 | !(typeof Component.childContextTypes === 'object') ? true ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7276 | if (true) {
|
7277 | this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
|
7278 | }
|
7279 | for (var name in childContext) {
|
7280 | !(name in Component.childContextTypes) ? true ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
|
7281 | }
|
7282 | return assign({}, currentContext, childContext);
|
7283 | }
|
7284 | return currentContext;
|
7285 | },
|
7286 |
|
7287 | /**
|
7288 | * Processes props by setting default values for unspecified props and
|
7289 | * asserting that the props are valid. Does not mutate its argument; returns
|
7290 | * a new props object with defaults merged in.
|
7291 | *
|
7292 | * @param {object} newProps
|
7293 | * @return {object}
|
7294 | * @private
|
7295 | */
|
7296 | _processProps: function (newProps) {
|
7297 | if (true) {
|
7298 | var Component = this._currentElement.type;
|
7299 | if (Component.propTypes) {
|
7300 | this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
|
7301 | }
|
7302 | }
|
7303 | return newProps;
|
7304 | },
|
7305 |
|
7306 | /**
|
7307 | * Assert that the props are valid
|
7308 | *
|
7309 | * @param {object} propTypes Map of prop name to a ReactPropType
|
7310 | * @param {object} props
|
7311 | * @param {string} location e.g. "prop", "context", "child context"
|
7312 | * @private
|
7313 | */
|
7314 | _checkPropTypes: function (propTypes, props, location) {
|
7315 | // TODO: Stop validating prop types here and only use the element
|
7316 | // validation.
|
7317 | var componentName = this.getName();
|
7318 | for (var propName in propTypes) {
|
7319 | if (propTypes.hasOwnProperty(propName)) {
|
7320 | var error;
|
7321 | try {
|
7322 | // This is intentionally an invariant that gets caught. It's the same
|
7323 | // behavior as without this statement except with a better message.
|
7324 | !(typeof propTypes[propName] === 'function') ? true ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
7325 | error = propTypes[propName](props, propName, componentName, location);
|
7326 | } catch (ex) {
|
7327 | error = ex;
|
7328 | }
|
7329 | if (error instanceof Error) {
|
7330 | // We may want to extend this logic for similar errors in
|
7331 | // top-level render calls, so I'm abstracting it away into
|
7332 | // a function to minimize refactoring in the future
|
7333 | var addendum = getDeclarationErrorAddendum(this);
|
7334 |
|
7335 | if (location === ReactPropTypeLocations.prop) {
|
7336 | // Preface gives us something to blacklist in warning module
|
7337 | true ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
|
7338 | } else {
|
7339 | true ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
|
7340 | }
|
7341 | }
|
7342 | }
|
7343 | }
|
7344 | },
|
7345 |
|
7346 | receiveComponent: function (nextElement, transaction, nextContext) {
|
7347 | var prevElement = this._currentElement;
|
7348 | var prevContext = this._context;
|
7349 |
|
7350 | this._pendingElement = null;
|
7351 |
|
7352 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
|
7353 | },
|
7354 |
|
7355 | /**
|
7356 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
|
7357 | * is set, update the component.
|
7358 | *
|
7359 | * @param {ReactReconcileTransaction} transaction
|
7360 | * @internal
|
7361 | */
|
7362 | performUpdateIfNecessary: function (transaction) {
|
7363 | if (this._pendingElement != null) {
|
7364 | ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
|
7365 | }
|
7366 |
|
7367 | if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
|
7368 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
|
7369 | }
|
7370 | },
|
7371 |
|
7372 | /**
|
7373 | * Perform an update to a mounted component. The componentWillReceiveProps and
|
7374 | * shouldComponentUpdate methods are called, then (assuming the update isn't
|
7375 | * skipped) the remaining update lifecycle methods are called and the DOM
|
7376 | * representation is updated.
|
7377 | *
|
7378 | * By default, this implements React's rendering and reconciliation algorithm.
|
7379 | * Sophisticated clients may wish to override this.
|
7380 | *
|
7381 | * @param {ReactReconcileTransaction} transaction
|
7382 | * @param {ReactElement} prevParentElement
|
7383 | * @param {ReactElement} nextParentElement
|
7384 | * @internal
|
7385 | * @overridable
|
7386 | */
|
7387 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
|
7388 | var inst = this._instance;
|
7389 |
|
7390 | var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
|
7391 | var nextProps;
|
7392 |
|
7393 | // Distinguish between a props update versus a simple state update
|
7394 | if (prevParentElement === nextParentElement) {
|
7395 | // Skip checking prop types again -- we don't read inst.props to avoid
|
7396 | // warning for DOM component props in this upgrade
|
7397 | nextProps = nextParentElement.props;
|
7398 | } else {
|
7399 | nextProps = this._processProps(nextParentElement.props);
|
7400 | // An update here will schedule an update but immediately set
|
7401 | // _pendingStateQueue which will ensure that any state updates gets
|
7402 | // immediately reconciled instead of waiting for the next batch.
|
7403 |
|
7404 | if (inst.componentWillReceiveProps) {
|
7405 | inst.componentWillReceiveProps(nextProps, nextContext);
|
7406 | }
|
7407 | }
|
7408 |
|
7409 | var nextState = this._processPendingState(nextProps, nextContext);
|
7410 |
|
7411 | var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
7412 |
|
7413 | if (true) {
|
7414 | true ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
|
7415 | }
|
7416 |
|
7417 | if (shouldUpdate) {
|
7418 | this._pendingForceUpdate = false;
|
7419 | // Will set `this.props`, `this.state` and `this.context`.
|
7420 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
|
7421 | } else {
|
7422 | // If it's determined that a component should not update, we still want
|
7423 | // to set props and state but we shortcut the rest of the update.
|
7424 | this._currentElement = nextParentElement;
|
7425 | this._context = nextUnmaskedContext;
|
7426 | inst.props = nextProps;
|
7427 | inst.state = nextState;
|
7428 | inst.context = nextContext;
|
7429 | }
|
7430 | },
|
7431 |
|
7432 | _processPendingState: function (props, context) {
|
7433 | var inst = this._instance;
|
7434 | var queue = this._pendingStateQueue;
|
7435 | var replace = this._pendingReplaceState;
|
7436 | this._pendingReplaceState = false;
|
7437 | this._pendingStateQueue = null;
|
7438 |
|
7439 | if (!queue) {
|
7440 | return inst.state;
|
7441 | }
|
7442 |
|
7443 | if (replace && queue.length === 1) {
|
7444 | return queue[0];
|
7445 | }
|
7446 |
|
7447 | var nextState = assign({}, replace ? queue[0] : inst.state);
|
7448 | for (var i = replace ? 1 : 0; i < queue.length; i++) {
|
7449 | var partial = queue[i];
|
7450 | assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
|
7451 | }
|
7452 |
|
7453 | return nextState;
|
7454 | },
|
7455 |
|
7456 | /**
|
7457 | * Merges new props and state, notifies delegate methods of update and
|
7458 | * performs update.
|
7459 | *
|
7460 | * @param {ReactElement} nextElement Next element
|
7461 | * @param {object} nextProps Next public object to set as properties.
|
7462 | * @param {?object} nextState Next object to set as state.
|
7463 | * @param {?object} nextContext Next public object to set as context.
|
7464 | * @param {ReactReconcileTransaction} transaction
|
7465 | * @param {?object} unmaskedContext
|
7466 | * @private
|
7467 | */
|
7468 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
|
7469 | var inst = this._instance;
|
7470 |
|
7471 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
|
7472 | var prevProps;
|
7473 | var prevState;
|
7474 | var prevContext;
|
7475 | if (hasComponentDidUpdate) {
|
7476 | prevProps = inst.props;
|
7477 | prevState = inst.state;
|
7478 | prevContext = inst.context;
|
7479 | }
|
7480 |
|
7481 | if (inst.componentWillUpdate) {
|
7482 | inst.componentWillUpdate(nextProps, nextState, nextContext);
|
7483 | }
|
7484 |
|
7485 | this._currentElement = nextElement;
|
7486 | this._context = unmaskedContext;
|
7487 | inst.props = nextProps;
|
7488 | inst.state = nextState;
|
7489 | inst.context = nextContext;
|
7490 |
|
7491 | this._updateRenderedComponent(transaction, unmaskedContext);
|
7492 |
|
7493 | if (hasComponentDidUpdate) {
|
7494 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
|
7495 | }
|
7496 | },
|
7497 |
|
7498 | /**
|
7499 | * Call the component's `render` method and update the DOM accordingly.
|
7500 | *
|
7501 | * @param {ReactReconcileTransaction} transaction
|
7502 | * @internal
|
7503 | */
|
7504 | _updateRenderedComponent: function (transaction, context) {
|
7505 | var prevComponentInstance = this._renderedComponent;
|
7506 | var prevRenderedElement = prevComponentInstance._currentElement;
|
7507 | var nextRenderedElement = this._renderValidatedComponent();
|
7508 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
|
7509 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
|
7510 | } else {
|
7511 | // These two IDs are actually the same! But nothing should rely on that.
|
7512 | var thisID = this._rootNodeID;
|
7513 | var prevComponentID = prevComponentInstance._rootNodeID;
|
7514 | ReactReconciler.unmountComponent(prevComponentInstance);
|
7515 |
|
7516 | this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
|
7517 | var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
|
7518 | this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
|
7519 | }
|
7520 | },
|
7521 |
|
7522 | /**
|
7523 | * @protected
|
7524 | */
|
7525 | _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
|
7526 | ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
|
7527 | },
|
7528 |
|
7529 | /**
|
7530 | * @protected
|
7531 | */
|
7532 | _renderValidatedComponentWithoutOwnerOrContext: function () {
|
7533 | var inst = this._instance;
|
7534 | var renderedComponent = inst.render();
|
7535 | if (true) {
|
7536 | // We allow auto-mocks to proceed as if they're returning null.
|
7537 | if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
|
7538 | // This is probably bad practice. Consider warning here and
|
7539 | // deprecating this convenience.
|
7540 | renderedComponent = null;
|
7541 | }
|
7542 | }
|
7543 |
|
7544 | return renderedComponent;
|
7545 | },
|
7546 |
|
7547 | /**
|
7548 | * @private
|
7549 | */
|
7550 | _renderValidatedComponent: function () {
|
7551 | var renderedComponent;
|
7552 | ReactCurrentOwner.current = this;
|
7553 | try {
|
7554 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
|
7555 | } finally {
|
7556 | ReactCurrentOwner.current = null;
|
7557 | }
|
7558 | !(
|
7559 | // TODO: An `isValidNode` function would probably be more appropriate
|
7560 | renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? true ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7561 | return renderedComponent;
|
7562 | },
|
7563 |
|
7564 | /**
|
7565 | * Lazily allocates the refs object and stores `component` as `ref`.
|
7566 | *
|
7567 | * @param {string} ref Reference name.
|
7568 | * @param {component} component Component to store as `ref`.
|
7569 | * @final
|
7570 | * @private
|
7571 | */
|
7572 | attachRef: function (ref, component) {
|
7573 | var inst = this.getPublicInstance();
|
7574 | !(inst != null) ? true ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
|
7575 | var publicComponentInstance = component.getPublicInstance();
|
7576 | if (true) {
|
7577 | var componentName = component && component.getName ? component.getName() : 'a component';
|
7578 | true ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
|
7579 | }
|
7580 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
|
7581 | refs[ref] = publicComponentInstance;
|
7582 | },
|
7583 |
|
7584 | /**
|
7585 | * Detaches a reference name.
|
7586 | *
|
7587 | * @param {string} ref Name to dereference.
|
7588 | * @final
|
7589 | * @private
|
7590 | */
|
7591 | detachRef: function (ref) {
|
7592 | var refs = this.getPublicInstance().refs;
|
7593 | delete refs[ref];
|
7594 | },
|
7595 |
|
7596 | /**
|
7597 | * Get a text description of the component that can be used to identify it
|
7598 | * in error messages.
|
7599 | * @return {string} The name or null.
|
7600 | * @internal
|
7601 | */
|
7602 | getName: function () {
|
7603 | var type = this._currentElement.type;
|
7604 | var constructor = this._instance && this._instance.constructor;
|
7605 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
|
7606 | },
|
7607 |
|
7608 | /**
|
7609 | * Get the publicly accessible representation of this component - i.e. what
|
7610 | * is exposed by refs and returned by render. Can be null for stateless
|
7611 | * components.
|
7612 | *
|
7613 | * @return {ReactComponent} the public component instance.
|
7614 | * @internal
|
7615 | */
|
7616 | getPublicInstance: function () {
|
7617 | var inst = this._instance;
|
7618 | if (inst instanceof StatelessComponent) {
|
7619 | return null;
|
7620 | }
|
7621 | return inst;
|
7622 | },
|
7623 |
|
7624 | // Stub
|
7625 | _instantiateReactComponent: null
|
7626 |
|
7627 | };
|
7628 |
|
7629 | ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
|
7630 | mountComponent: 'mountComponent',
|
7631 | updateComponent: 'updateComponent',
|
7632 | _renderValidatedComponent: '_renderValidatedComponent'
|
7633 | });
|
7634 |
|
7635 | var ReactCompositeComponent = {
|
7636 |
|
7637 | Mixin: ReactCompositeComponentMixin
|
7638 |
|
7639 | };
|
7640 |
|
7641 | module.exports = ReactCompositeComponent;
|
7642 |
|
7643 | /***/ },
|
7644 | /* 63 */
|
7645 | /***/ function(module, exports, __webpack_require__) {
|
7646 |
|
7647 | /**
|
7648 | * Copyright 2014-2015, Facebook, Inc.
|
7649 | * All rights reserved.
|
7650 | *
|
7651 | * This source code is licensed under the BSD-style license found in the
|
7652 | * LICENSE file in the root directory of this source tree. An additional grant
|
7653 | * of patent rights can be found in the PATENTS file in the same directory.
|
7654 | *
|
7655 | * @providesModule ReactComponentEnvironment
|
7656 | */
|
7657 |
|
7658 | 'use strict';
|
7659 |
|
7660 | var invariant = __webpack_require__(12);
|
7661 |
|
7662 | var injected = false;
|
7663 |
|
7664 | var ReactComponentEnvironment = {
|
7665 |
|
7666 | /**
|
7667 | * Optionally injectable environment dependent cleanup hook. (server vs.
|
7668 | * browser etc). Example: A browser system caches DOM nodes based on component
|
7669 | * ID and must remove that cache entry when this instance is unmounted.
|
7670 | */
|
7671 | unmountIDFromEnvironment: null,
|
7672 |
|
7673 | /**
|
7674 | * Optionally injectable hook for swapping out mount images in the middle of
|
7675 | * the tree.
|
7676 | */
|
7677 | replaceNodeWithMarkupByID: null,
|
7678 |
|
7679 | /**
|
7680 | * Optionally injectable hook for processing a queue of child updates. Will
|
7681 | * later move into MultiChildComponents.
|
7682 | */
|
7683 | processChildrenUpdates: null,
|
7684 |
|
7685 | injection: {
|
7686 | injectEnvironment: function (environment) {
|
7687 | !!injected ? true ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
|
7688 | ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
|
7689 | ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
|
7690 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
|
7691 | injected = true;
|
7692 | }
|
7693 | }
|
7694 |
|
7695 | };
|
7696 |
|
7697 | module.exports = ReactComponentEnvironment;
|
7698 |
|
7699 | /***/ },
|
7700 | /* 64 */
|
7701 | /***/ function(module, exports, __webpack_require__) {
|
7702 |
|
7703 | /**
|
7704 | * Copyright 2013-2015, Facebook, Inc.
|
7705 | * All rights reserved.
|
7706 | *
|
7707 | * This source code is licensed under the BSD-style license found in the
|
7708 | * LICENSE file in the root directory of this source tree. An additional grant
|
7709 | * of patent rights can be found in the PATENTS file in the same directory.
|
7710 | *
|
7711 | * @providesModule ReactPropTypeLocations
|
7712 | */
|
7713 |
|
7714 | 'use strict';
|
7715 |
|
7716 | var keyMirror = __webpack_require__(16);
|
7717 |
|
7718 | var ReactPropTypeLocations = keyMirror({
|
7719 | prop: null,
|
7720 | context: null,
|
7721 | childContext: null
|
7722 | });
|
7723 |
|
7724 | module.exports = ReactPropTypeLocations;
|
7725 |
|
7726 | /***/ },
|
7727 | /* 65 */
|
7728 | /***/ function(module, exports, __webpack_require__) {
|
7729 |
|
7730 | /**
|
7731 | * Copyright 2013-2015, Facebook, Inc.
|
7732 | * All rights reserved.
|
7733 | *
|
7734 | * This source code is licensed under the BSD-style license found in the
|
7735 | * LICENSE file in the root directory of this source tree. An additional grant
|
7736 | * of patent rights can be found in the PATENTS file in the same directory.
|
7737 | *
|
7738 | * @providesModule ReactPropTypeLocationNames
|
7739 | */
|
7740 |
|
7741 | 'use strict';
|
7742 |
|
7743 | var ReactPropTypeLocationNames = {};
|
7744 |
|
7745 | if (true) {
|
7746 | ReactPropTypeLocationNames = {
|
7747 | prop: 'prop',
|
7748 | context: 'context',
|
7749 | childContext: 'child context'
|
7750 | };
|
7751 | }
|
7752 |
|
7753 | module.exports = ReactPropTypeLocationNames;
|
7754 |
|
7755 | /***/ },
|
7756 | /* 66 */
|
7757 | /***/ function(module, exports) {
|
7758 |
|
7759 | /**
|
7760 | * Copyright 2013-2015, Facebook, Inc.
|
7761 | * All rights reserved.
|
7762 | *
|
7763 | * This source code is licensed under the BSD-style license found in the
|
7764 | * LICENSE file in the root directory of this source tree. An additional grant
|
7765 | * of patent rights can be found in the PATENTS file in the same directory.
|
7766 | *
|
7767 | * @providesModule shouldUpdateReactComponent
|
7768 | * @typechecks static-only
|
7769 | */
|
7770 |
|
7771 | 'use strict';
|
7772 |
|
7773 | /**
|
7774 | * Given a `prevElement` and `nextElement`, determines if the existing
|
7775 | * instance should be updated as opposed to being destroyed or replaced by a new
|
7776 | * instance. Both arguments are elements. This ensures that this logic can
|
7777 | * operate on stateless trees without any backing instance.
|
7778 | *
|
7779 | * @param {?object} prevElement
|
7780 | * @param {?object} nextElement
|
7781 | * @return {boolean} True if the existing instance should be updated.
|
7782 | * @protected
|
7783 | */
|
7784 | function shouldUpdateReactComponent(prevElement, nextElement) {
|
7785 | var prevEmpty = prevElement === null || prevElement === false;
|
7786 | var nextEmpty = nextElement === null || nextElement === false;
|
7787 | if (prevEmpty || nextEmpty) {
|
7788 | return prevEmpty === nextEmpty;
|
7789 | }
|
7790 |
|
7791 | var prevType = typeof prevElement;
|
7792 | var nextType = typeof nextElement;
|
7793 | if (prevType === 'string' || prevType === 'number') {
|
7794 | return nextType === 'string' || nextType === 'number';
|
7795 | } else {
|
7796 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
|
7797 | }
|
7798 | return false;
|
7799 | }
|
7800 |
|
7801 | module.exports = shouldUpdateReactComponent;
|
7802 |
|
7803 | /***/ },
|
7804 | /* 67 */
|
7805 | /***/ function(module, exports, __webpack_require__) {
|
7806 |
|
7807 | /**
|
7808 | * Copyright 2014-2015, Facebook, Inc.
|
7809 | * All rights reserved.
|
7810 | *
|
7811 | * This source code is licensed under the BSD-style license found in the
|
7812 | * LICENSE file in the root directory of this source tree. An additional grant
|
7813 | * of patent rights can be found in the PATENTS file in the same directory.
|
7814 | *
|
7815 | * @providesModule ReactEmptyComponent
|
7816 | */
|
7817 |
|
7818 | 'use strict';
|
7819 |
|
7820 | var ReactElement = __webpack_require__(41);
|
7821 | var ReactEmptyComponentRegistry = __webpack_require__(43);
|
7822 | var ReactReconciler = __webpack_require__(49);
|
7823 |
|
7824 | var assign = __webpack_require__(38);
|
7825 |
|
7826 | var placeholderElement;
|
7827 |
|
7828 | var ReactEmptyComponentInjection = {
|
7829 | injectEmptyComponent: function (component) {
|
7830 | placeholderElement = ReactElement.createElement(component);
|
7831 | }
|
7832 | };
|
7833 |
|
7834 | var ReactEmptyComponent = function (instantiate) {
|
7835 | this._currentElement = null;
|
7836 | this._rootNodeID = null;
|
7837 | this._renderedComponent = instantiate(placeholderElement);
|
7838 | };
|
7839 | assign(ReactEmptyComponent.prototype, {
|
7840 | construct: function (element) {},
|
7841 | mountComponent: function (rootID, transaction, context) {
|
7842 | ReactEmptyComponentRegistry.registerNullComponentID(rootID);
|
7843 | this._rootNodeID = rootID;
|
7844 | return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
|
7845 | },
|
7846 | receiveComponent: function () {},
|
7847 | unmountComponent: function (rootID, transaction, context) {
|
7848 | ReactReconciler.unmountComponent(this._renderedComponent);
|
7849 | ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
|
7850 | this._rootNodeID = null;
|
7851 | this._renderedComponent = null;
|
7852 | }
|
7853 | });
|
7854 |
|
7855 | ReactEmptyComponent.injection = ReactEmptyComponentInjection;
|
7856 |
|
7857 | module.exports = ReactEmptyComponent;
|
7858 |
|
7859 | /***/ },
|
7860 | /* 68 */
|
7861 | /***/ function(module, exports, __webpack_require__) {
|
7862 |
|
7863 | /**
|
7864 | * Copyright 2014-2015, Facebook, Inc.
|
7865 | * All rights reserved.
|
7866 | *
|
7867 | * This source code is licensed under the BSD-style license found in the
|
7868 | * LICENSE file in the root directory of this source tree. An additional grant
|
7869 | * of patent rights can be found in the PATENTS file in the same directory.
|
7870 | *
|
7871 | * @providesModule ReactNativeComponent
|
7872 | */
|
7873 |
|
7874 | 'use strict';
|
7875 |
|
7876 | var assign = __webpack_require__(38);
|
7877 | var invariant = __webpack_require__(12);
|
7878 |
|
7879 | var autoGenerateWrapperClass = null;
|
7880 | var genericComponentClass = null;
|
7881 | // This registry keeps track of wrapper classes around native tags.
|
7882 | var tagToComponentClass = {};
|
7883 | var textComponentClass = null;
|
7884 |
|
7885 | var ReactNativeComponentInjection = {
|
7886 | // This accepts a class that receives the tag string. This is a catch all
|
7887 | // that can render any kind of tag.
|
7888 | injectGenericComponentClass: function (componentClass) {
|
7889 | genericComponentClass = componentClass;
|
7890 | },
|
7891 | // This accepts a text component class that takes the text string to be
|
7892 | // rendered as props.
|
7893 | injectTextComponentClass: function (componentClass) {
|
7894 | textComponentClass = componentClass;
|
7895 | },
|
7896 | // This accepts a keyed object with classes as values. Each key represents a
|
7897 | // tag. That particular tag will use this class instead of the generic one.
|
7898 | injectComponentClasses: function (componentClasses) {
|
7899 | assign(tagToComponentClass, componentClasses);
|
7900 | }
|
7901 | };
|
7902 |
|
7903 | /**
|
7904 | * Get a composite component wrapper class for a specific tag.
|
7905 | *
|
7906 | * @param {ReactElement} element The tag for which to get the class.
|
7907 | * @return {function} The React class constructor function.
|
7908 | */
|
7909 | function getComponentClassForElement(element) {
|
7910 | if (typeof element.type === 'function') {
|
7911 | return element.type;
|
7912 | }
|
7913 | var tag = element.type;
|
7914 | var componentClass = tagToComponentClass[tag];
|
7915 | if (componentClass == null) {
|
7916 | tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
|
7917 | }
|
7918 | return componentClass;
|
7919 | }
|
7920 |
|
7921 | /**
|
7922 | * Get a native internal component class for a specific tag.
|
7923 | *
|
7924 | * @param {ReactElement} element The element to create.
|
7925 | * @return {function} The internal class constructor function.
|
7926 | */
|
7927 | function createInternalComponent(element) {
|
7928 | !genericComponentClass ? true ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
|
7929 | return new genericComponentClass(element.type, element.props);
|
7930 | }
|
7931 |
|
7932 | /**
|
7933 | * @param {ReactText} text
|
7934 | * @return {ReactComponent}
|
7935 | */
|
7936 | function createInstanceForText(text) {
|
7937 | return new textComponentClass(text);
|
7938 | }
|
7939 |
|
7940 | /**
|
7941 | * @param {ReactComponent} component
|
7942 | * @return {boolean}
|
7943 | */
|
7944 | function isTextComponent(component) {
|
7945 | return component instanceof textComponentClass;
|
7946 | }
|
7947 |
|
7948 | var ReactNativeComponent = {
|
7949 | getComponentClassForElement: getComponentClassForElement,
|
7950 | createInternalComponent: createInternalComponent,
|
7951 | createInstanceForText: createInstanceForText,
|
7952 | isTextComponent: isTextComponent,
|
7953 | injection: ReactNativeComponentInjection
|
7954 | };
|
7955 |
|
7956 | module.exports = ReactNativeComponent;
|
7957 |
|
7958 | /***/ },
|
7959 | /* 69 */
|
7960 | /***/ function(module, exports, __webpack_require__) {
|
7961 |
|
7962 | /**
|
7963 | * Copyright 2015, Facebook, Inc.
|
7964 | * All rights reserved.
|
7965 | *
|
7966 | * This source code is licensed under the BSD-style license found in the
|
7967 | * LICENSE file in the root directory of this source tree. An additional grant
|
7968 | * of patent rights can be found in the PATENTS file in the same directory.
|
7969 | *
|
7970 | * @providesModule validateDOMNesting
|
7971 | */
|
7972 |
|
7973 | 'use strict';
|
7974 |
|
7975 | var assign = __webpack_require__(38);
|
7976 | var emptyFunction = __webpack_require__(14);
|
7977 | var warning = __webpack_require__(24);
|
7978 |
|
7979 | var validateDOMNesting = emptyFunction;
|
7980 |
|
7981 | if (true) {
|
7982 | // This validation code was written based on the HTML5 parsing spec:
|
7983 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
|
7984 | //
|
7985 | // Note: this does not catch all invalid nesting, nor does it try to (as it's
|
7986 | // not clear what practical benefit doing so provides); instead, we warn only
|
7987 | // for cases where the parser will give a parse tree differing from what React
|
7988 | // intended. For example, <b><div></div></b> is invalid but we don't warn
|
7989 | // because it still parses correctly; we do warn for other cases like nested
|
7990 | // <p> tags where the beginning of the second element implicitly closes the
|
7991 | // first, causing a confusing mess.
|
7992 |
|
7993 | // https://html.spec.whatwg.org/multipage/syntax.html#special
|
7994 | var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
|
7995 |
|
7996 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
|
7997 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
|
7998 |
|
7999 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
|
8000 | // TODO: Distinguish by namespace here -- for <title>, including it here
|
8001 | // errs on the side of fewer warnings
|
8002 | 'foreignObject', 'desc', 'title'];
|
8003 |
|
8004 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
|
8005 | var buttonScopeTags = inScopeTags.concat(['button']);
|
8006 |
|
8007 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
|
8008 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
|
8009 |
|
8010 | var emptyAncestorInfo = {
|
8011 | parentTag: null,
|
8012 |
|
8013 | formTag: null,
|
8014 | aTagInScope: null,
|
8015 | buttonTagInScope: null,
|
8016 | nobrTagInScope: null,
|
8017 | pTagInButtonScope: null,
|
8018 |
|
8019 | listItemTagAutoclosing: null,
|
8020 | dlItemTagAutoclosing: null
|
8021 | };
|
8022 |
|
8023 | var updatedAncestorInfo = function (oldInfo, tag, instance) {
|
8024 | var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
|
8025 | var info = { tag: tag, instance: instance };
|
8026 |
|
8027 | if (inScopeTags.indexOf(tag) !== -1) {
|
8028 | ancestorInfo.aTagInScope = null;
|
8029 | ancestorInfo.buttonTagInScope = null;
|
8030 | ancestorInfo.nobrTagInScope = null;
|
8031 | }
|
8032 | if (buttonScopeTags.indexOf(tag) !== -1) {
|
8033 | ancestorInfo.pTagInButtonScope = null;
|
8034 | }
|
8035 |
|
8036 | // See rules for 'li', 'dd', 'dt' start tags in
|
8037 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
|
8038 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
|
8039 | ancestorInfo.listItemTagAutoclosing = null;
|
8040 | ancestorInfo.dlItemTagAutoclosing = null;
|
8041 | }
|
8042 |
|
8043 | ancestorInfo.parentTag = info;
|
8044 |
|
8045 | if (tag === 'form') {
|
8046 | ancestorInfo.formTag = info;
|
8047 | }
|
8048 | if (tag === 'a') {
|
8049 | ancestorInfo.aTagInScope = info;
|
8050 | }
|
8051 | if (tag === 'button') {
|
8052 | ancestorInfo.buttonTagInScope = info;
|
8053 | }
|
8054 | if (tag === 'nobr') {
|
8055 | ancestorInfo.nobrTagInScope = info;
|
8056 | }
|
8057 | if (tag === 'p') {
|
8058 | ancestorInfo.pTagInButtonScope = info;
|
8059 | }
|
8060 | if (tag === 'li') {
|
8061 | ancestorInfo.listItemTagAutoclosing = info;
|
8062 | }
|
8063 | if (tag === 'dd' || tag === 'dt') {
|
8064 | ancestorInfo.dlItemTagAutoclosing = info;
|
8065 | }
|
8066 |
|
8067 | return ancestorInfo;
|
8068 | };
|
8069 |
|
8070 | /**
|
8071 | * Returns whether
|
8072 | */
|
8073 | var isTagValidWithParent = function (tag, parentTag) {
|
8074 | // First, let's check if we're in an unusual parsing mode...
|
8075 | switch (parentTag) {
|
8076 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
|
8077 | case 'select':
|
8078 | return tag === 'option' || tag === 'optgroup' || tag === '#text';
|
8079 | case 'optgroup':
|
8080 | return tag === 'option' || tag === '#text';
|
8081 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
|
8082 | // but
|
8083 | case 'option':
|
8084 | return tag === '#text';
|
8085 |
|
8086 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
|
8087 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
|
8088 | // No special behavior since these rules fall back to "in body" mode for
|
8089 | // all except special table nodes which cause bad parsing behavior anyway.
|
8090 |
|
8091 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
|
8092 | case 'tr':
|
8093 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
|
8094 |
|
8095 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
|
8096 | case 'tbody':
|
8097 | case 'thead':
|
8098 | case 'tfoot':
|
8099 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
|
8100 |
|
8101 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
|
8102 | case 'colgroup':
|
8103 | return tag === 'col' || tag === 'template';
|
8104 |
|
8105 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
|
8106 | case 'table':
|
8107 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
|
8108 |
|
8109 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
|
8110 | case 'head':
|
8111 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
|
8112 |
|
8113 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
|
8114 | case 'html':
|
8115 | return tag === 'head' || tag === 'body';
|
8116 | }
|
8117 |
|
8118 | // Probably in the "in body" parsing mode, so we outlaw only tag combos
|
8119 | // where the parsing rules cause implicit opens or closes to be added.
|
8120 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
|
8121 | switch (tag) {
|
8122 | case 'h1':
|
8123 | case 'h2':
|
8124 | case 'h3':
|
8125 | case 'h4':
|
8126 | case 'h5':
|
8127 | case 'h6':
|
8128 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
|
8129 |
|
8130 | case 'rp':
|
8131 | case 'rt':
|
8132 | return impliedEndTags.indexOf(parentTag) === -1;
|
8133 |
|
8134 | case 'caption':
|
8135 | case 'col':
|
8136 | case 'colgroup':
|
8137 | case 'frame':
|
8138 | case 'head':
|
8139 | case 'tbody':
|
8140 | case 'td':
|
8141 | case 'tfoot':
|
8142 | case 'th':
|
8143 | case 'thead':
|
8144 | case 'tr':
|
8145 | // These tags are only valid with a few parents that have special child
|
8146 | // parsing rules -- if we're down here, then none of those matched and
|
8147 | // so we allow it only if we don't know what the parent is, as all other
|
8148 | // cases are invalid.
|
8149 | return parentTag == null;
|
8150 | }
|
8151 |
|
8152 | return true;
|
8153 | };
|
8154 |
|
8155 | /**
|
8156 | * Returns whether
|
8157 | */
|
8158 | var findInvalidAncestorForTag = function (tag, ancestorInfo) {
|
8159 | switch (tag) {
|
8160 | case 'address':
|
8161 | case 'article':
|
8162 | case 'aside':
|
8163 | case 'blockquote':
|
8164 | case 'center':
|
8165 | case 'details':
|
8166 | case 'dialog':
|
8167 | case 'dir':
|
8168 | case 'div':
|
8169 | case 'dl':
|
8170 | case 'fieldset':
|
8171 | case 'figcaption':
|
8172 | case 'figure':
|
8173 | case 'footer':
|
8174 | case 'header':
|
8175 | case 'hgroup':
|
8176 | case 'main':
|
8177 | case 'menu':
|
8178 | case 'nav':
|
8179 | case 'ol':
|
8180 | case 'p':
|
8181 | case 'section':
|
8182 | case 'summary':
|
8183 | case 'ul':
|
8184 |
|
8185 | case 'pre':
|
8186 | case 'listing':
|
8187 |
|
8188 | case 'table':
|
8189 |
|
8190 | case 'hr':
|
8191 |
|
8192 | case 'xmp':
|
8193 |
|
8194 | case 'h1':
|
8195 | case 'h2':
|
8196 | case 'h3':
|
8197 | case 'h4':
|
8198 | case 'h5':
|
8199 | case 'h6':
|
8200 | return ancestorInfo.pTagInButtonScope;
|
8201 |
|
8202 | case 'form':
|
8203 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
|
8204 |
|
8205 | case 'li':
|
8206 | return ancestorInfo.listItemTagAutoclosing;
|
8207 |
|
8208 | case 'dd':
|
8209 | case 'dt':
|
8210 | return ancestorInfo.dlItemTagAutoclosing;
|
8211 |
|
8212 | case 'button':
|
8213 | return ancestorInfo.buttonTagInScope;
|
8214 |
|
8215 | case 'a':
|
8216 | // Spec says something about storing a list of markers, but it sounds
|
8217 | // equivalent to this check.
|
8218 | return ancestorInfo.aTagInScope;
|
8219 |
|
8220 | case 'nobr':
|
8221 | return ancestorInfo.nobrTagInScope;
|
8222 | }
|
8223 |
|
8224 | return null;
|
8225 | };
|
8226 |
|
8227 | /**
|
8228 | * Given a ReactCompositeComponent instance, return a list of its recursive
|
8229 | * owners, starting at the root and ending with the instance itself.
|
8230 | */
|
8231 | var findOwnerStack = function (instance) {
|
8232 | if (!instance) {
|
8233 | return [];
|
8234 | }
|
8235 |
|
8236 | var stack = [];
|
8237 | /*eslint-disable space-after-keywords */
|
8238 | do {
|
8239 | /*eslint-enable space-after-keywords */
|
8240 | stack.push(instance);
|
8241 | } while (instance = instance._currentElement._owner);
|
8242 | stack.reverse();
|
8243 | return stack;
|
8244 | };
|
8245 |
|
8246 | var didWarn = {};
|
8247 |
|
8248 | validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
|
8249 | ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
8250 | var parentInfo = ancestorInfo.parentTag;
|
8251 | var parentTag = parentInfo && parentInfo.tag;
|
8252 |
|
8253 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
|
8254 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
|
8255 | var problematic = invalidParent || invalidAncestor;
|
8256 |
|
8257 | if (problematic) {
|
8258 | var ancestorTag = problematic.tag;
|
8259 | var ancestorInstance = problematic.instance;
|
8260 |
|
8261 | var childOwner = childInstance && childInstance._currentElement._owner;
|
8262 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
|
8263 |
|
8264 | var childOwners = findOwnerStack(childOwner);
|
8265 | var ancestorOwners = findOwnerStack(ancestorOwner);
|
8266 |
|
8267 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
|
8268 | var i;
|
8269 |
|
8270 | var deepestCommon = -1;
|
8271 | for (i = 0; i < minStackLen; i++) {
|
8272 | if (childOwners[i] === ancestorOwners[i]) {
|
8273 | deepestCommon = i;
|
8274 | } else {
|
8275 | break;
|
8276 | }
|
8277 | }
|
8278 |
|
8279 | var UNKNOWN = '(unknown)';
|
8280 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
|
8281 | return inst.getName() || UNKNOWN;
|
8282 | });
|
8283 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
|
8284 | return inst.getName() || UNKNOWN;
|
8285 | });
|
8286 | var ownerInfo = [].concat(
|
8287 | // If the parent and child instances have a common owner ancestor, start
|
8288 | // with that -- otherwise we just start with the parent's owners.
|
8289 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
|
8290 | // If we're warning about an invalid (non-parent) ancestry, add '...'
|
8291 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
|
8292 |
|
8293 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
|
8294 | if (didWarn[warnKey]) {
|
8295 | return;
|
8296 | }
|
8297 | didWarn[warnKey] = true;
|
8298 |
|
8299 | if (invalidParent) {
|
8300 | var info = '';
|
8301 | if (ancestorTag === 'table' && childTag === 'tr') {
|
8302 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
|
8303 | }
|
8304 | true ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
|
8305 | } else {
|
8306 | true ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
|
8307 | }
|
8308 | }
|
8309 | };
|
8310 |
|
8311 | validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
|
8312 |
|
8313 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
|
8314 |
|
8315 | // For testing
|
8316 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
|
8317 | ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
8318 | var parentInfo = ancestorInfo.parentTag;
|
8319 | var parentTag = parentInfo && parentInfo.tag;
|
8320 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
|
8321 | };
|
8322 | }
|
8323 |
|
8324 | module.exports = validateDOMNesting;
|
8325 |
|
8326 | /***/ },
|
8327 | /* 70 */
|
8328 | /***/ function(module, exports, __webpack_require__) {
|
8329 |
|
8330 | /**
|
8331 | * Copyright 2013-2015, Facebook, Inc.
|
8332 | * All rights reserved.
|
8333 | *
|
8334 | * This source code is licensed under the BSD-style license found in the
|
8335 | * LICENSE file in the root directory of this source tree. An additional grant
|
8336 | * of patent rights can be found in the PATENTS file in the same directory.
|
8337 | *
|
8338 | * @providesModule ReactDefaultInjection
|
8339 | */
|
8340 |
|
8341 | 'use strict';
|
8342 |
|
8343 | var BeforeInputEventPlugin = __webpack_require__(71);
|
8344 | var ChangeEventPlugin = __webpack_require__(79);
|
8345 | var ClientReactRootIndex = __webpack_require__(82);
|
8346 | var DefaultEventPluginOrder = __webpack_require__(83);
|
8347 | var EnterLeaveEventPlugin = __webpack_require__(84);
|
8348 | var ExecutionEnvironment = __webpack_require__(8);
|
8349 | var HTMLDOMPropertyConfig = __webpack_require__(88);
|
8350 | var ReactBrowserComponentMixin = __webpack_require__(89);
|
8351 | var ReactComponentBrowserEnvironment = __webpack_require__(25);
|
8352 | var ReactDefaultBatchingStrategy = __webpack_require__(91);
|
8353 | var ReactDOMComponent = __webpack_require__(92);
|
8354 | var ReactDOMTextComponent = __webpack_require__(5);
|
8355 | var ReactEventListener = __webpack_require__(117);
|
8356 | var ReactInjection = __webpack_require__(120);
|
8357 | var ReactInstanceHandles = __webpack_require__(44);
|
8358 | var ReactMount = __webpack_require__(27);
|
8359 | var ReactReconcileTransaction = __webpack_require__(124);
|
8360 | var SelectEventPlugin = __webpack_require__(129);
|
8361 | var ServerReactRootIndex = __webpack_require__(130);
|
8362 | var SimpleEventPlugin = __webpack_require__(131);
|
8363 | var SVGDOMPropertyConfig = __webpack_require__(140);
|
8364 |
|
8365 | var alreadyInjected = false;
|
8366 |
|
8367 | function inject() {
|
8368 | if (alreadyInjected) {
|
8369 | // TODO: This is currently true because these injections are shared between
|
8370 | // the client and the server package. They should be built independently
|
8371 | // and not share any injection state. Then this problem will be solved.
|
8372 | return;
|
8373 | }
|
8374 | alreadyInjected = true;
|
8375 |
|
8376 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
|
8377 |
|
8378 | /**
|
8379 | * Inject modules for resolving DOM hierarchy and plugin ordering.
|
8380 | */
|
8381 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
|
8382 | ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
|
8383 | ReactInjection.EventPluginHub.injectMount(ReactMount);
|
8384 |
|
8385 | /**
|
8386 | * Some important event plugins included by default (without having to require
|
8387 | * them).
|
8388 | */
|
8389 | ReactInjection.EventPluginHub.injectEventPluginsByName({
|
8390 | SimpleEventPlugin: SimpleEventPlugin,
|
8391 | EnterLeaveEventPlugin: EnterLeaveEventPlugin,
|
8392 | ChangeEventPlugin: ChangeEventPlugin,
|
8393 | SelectEventPlugin: SelectEventPlugin,
|
8394 | BeforeInputEventPlugin: BeforeInputEventPlugin
|
8395 | });
|
8396 |
|
8397 | ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
|
8398 |
|
8399 | ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
|
8400 |
|
8401 | ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
|
8402 |
|
8403 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
|
8404 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
|
8405 |
|
8406 | ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
|
8407 |
|
8408 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
|
8409 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
8410 |
|
8411 | ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
|
8412 |
|
8413 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
|
8414 |
|
8415 | if (true) {
|
8416 | var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
|
8417 | if (/[?&]react_perf\b/.test(url)) {
|
8418 | var ReactDefaultPerf = __webpack_require__(141);
|
8419 | ReactDefaultPerf.start();
|
8420 | }
|
8421 | }
|
8422 | }
|
8423 |
|
8424 | module.exports = {
|
8425 | inject: inject
|
8426 | };
|
8427 |
|
8428 | /***/ },
|
8429 | /* 71 */
|
8430 | /***/ function(module, exports, __webpack_require__) {
|
8431 |
|
8432 | /**
|
8433 | * Copyright 2013-2015 Facebook, Inc.
|
8434 | * All rights reserved.
|
8435 | *
|
8436 | * This source code is licensed under the BSD-style license found in the
|
8437 | * LICENSE file in the root directory of this source tree. An additional grant
|
8438 | * of patent rights can be found in the PATENTS file in the same directory.
|
8439 | *
|
8440 | * @providesModule BeforeInputEventPlugin
|
8441 | * @typechecks static-only
|
8442 | */
|
8443 |
|
8444 | 'use strict';
|
8445 |
|
8446 | var EventConstants = __webpack_require__(29);
|
8447 | var EventPropagators = __webpack_require__(72);
|
8448 | var ExecutionEnvironment = __webpack_require__(8);
|
8449 | var FallbackCompositionState = __webpack_require__(73);
|
8450 | var SyntheticCompositionEvent = __webpack_require__(75);
|
8451 | var SyntheticInputEvent = __webpack_require__(77);
|
8452 |
|
8453 | var keyOf = __webpack_require__(78);
|
8454 |
|
8455 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
|
8456 | var START_KEYCODE = 229;
|
8457 |
|
8458 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
|
8459 |
|
8460 | var documentMode = null;
|
8461 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
|
8462 | documentMode = document.documentMode;
|
8463 | }
|
8464 |
|
8465 | // Webkit offers a very useful `textInput` event that can be used to
|
8466 | // directly represent `beforeInput`. The IE `textinput` event is not as
|
8467 | // useful, so we don't use it.
|
8468 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
|
8469 |
|
8470 | // In IE9+, we have access to composition events, but the data supplied
|
8471 | // by the native compositionend event may be incorrect. Japanese ideographic
|
8472 | // spaces, for instance (\u3000) are not recorded correctly.
|
8473 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
|
8474 |
|
8475 | /**
|
8476 | * Opera <= 12 includes TextEvent in window, but does not fire
|
8477 | * text input events. Rely on keypress instead.
|
8478 | */
|
8479 | function isPresto() {
|
8480 | var opera = window.opera;
|
8481 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
|
8482 | }
|
8483 |
|
8484 | var SPACEBAR_CODE = 32;
|
8485 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
8486 |
|
8487 | var topLevelTypes = EventConstants.topLevelTypes;
|
8488 |
|
8489 | // Events and their corresponding property names.
|
8490 | var eventTypes = {
|
8491 | beforeInput: {
|
8492 | phasedRegistrationNames: {
|
8493 | bubbled: keyOf({ onBeforeInput: null }),
|
8494 | captured: keyOf({ onBeforeInputCapture: null })
|
8495 | },
|
8496 | dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
|
8497 | },
|
8498 | compositionEnd: {
|
8499 | phasedRegistrationNames: {
|
8500 | bubbled: keyOf({ onCompositionEnd: null }),
|
8501 | captured: keyOf({ onCompositionEndCapture: null })
|
8502 | },
|
8503 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8504 | },
|
8505 | compositionStart: {
|
8506 | phasedRegistrationNames: {
|
8507 | bubbled: keyOf({ onCompositionStart: null }),
|
8508 | captured: keyOf({ onCompositionStartCapture: null })
|
8509 | },
|
8510 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8511 | },
|
8512 | compositionUpdate: {
|
8513 | phasedRegistrationNames: {
|
8514 | bubbled: keyOf({ onCompositionUpdate: null }),
|
8515 | captured: keyOf({ onCompositionUpdateCapture: null })
|
8516 | },
|
8517 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8518 | }
|
8519 | };
|
8520 |
|
8521 | // Track whether we've ever handled a keypress on the space key.
|
8522 | var hasSpaceKeypress = false;
|
8523 |
|
8524 | /**
|
8525 | * Return whether a native keypress event is assumed to be a command.
|
8526 | * This is required because Firefox fires `keypress` events for key commands
|
8527 | * (cut, copy, select-all, etc.) even though no character is inserted.
|
8528 | */
|
8529 | function isKeypressCommand(nativeEvent) {
|
8530 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
|
8531 | // ctrlKey && altKey is equivalent to AltGr, and is not a command.
|
8532 | !(nativeEvent.ctrlKey && nativeEvent.altKey);
|
8533 | }
|
8534 |
|
8535 | /**
|
8536 | * Translate native top level events into event types.
|
8537 | *
|
8538 | * @param {string} topLevelType
|
8539 | * @return {object}
|
8540 | */
|
8541 | function getCompositionEventType(topLevelType) {
|
8542 | switch (topLevelType) {
|
8543 | case topLevelTypes.topCompositionStart:
|
8544 | return eventTypes.compositionStart;
|
8545 | case topLevelTypes.topCompositionEnd:
|
8546 | return eventTypes.compositionEnd;
|
8547 | case topLevelTypes.topCompositionUpdate:
|
8548 | return eventTypes.compositionUpdate;
|
8549 | }
|
8550 | }
|
8551 |
|
8552 | /**
|
8553 | * Does our fallback best-guess model think this event signifies that
|
8554 | * composition has begun?
|
8555 | *
|
8556 | * @param {string} topLevelType
|
8557 | * @param {object} nativeEvent
|
8558 | * @return {boolean}
|
8559 | */
|
8560 | function isFallbackCompositionStart(topLevelType, nativeEvent) {
|
8561 | return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
|
8562 | }
|
8563 |
|
8564 | /**
|
8565 | * Does our fallback mode think that this event is the end of composition?
|
8566 | *
|
8567 | * @param {string} topLevelType
|
8568 | * @param {object} nativeEvent
|
8569 | * @return {boolean}
|
8570 | */
|
8571 | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
|
8572 | switch (topLevelType) {
|
8573 | case topLevelTypes.topKeyUp:
|
8574 | // Command keys insert or clear IME input.
|
8575 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
|
8576 | case topLevelTypes.topKeyDown:
|
8577 | // Expect IME keyCode on each keydown. If we get any other
|
8578 | // code we must have exited earlier.
|
8579 | return nativeEvent.keyCode !== START_KEYCODE;
|
8580 | case topLevelTypes.topKeyPress:
|
8581 | case topLevelTypes.topMouseDown:
|
8582 | case topLevelTypes.topBlur:
|
8583 | // Events are not possible without cancelling IME.
|
8584 | return true;
|
8585 | default:
|
8586 | return false;
|
8587 | }
|
8588 | }
|
8589 |
|
8590 | /**
|
8591 | * Google Input Tools provides composition data via a CustomEvent,
|
8592 | * with the `data` property populated in the `detail` object. If this
|
8593 | * is available on the event object, use it. If not, this is a plain
|
8594 | * composition event and we have nothing special to extract.
|
8595 | *
|
8596 | * @param {object} nativeEvent
|
8597 | * @return {?string}
|
8598 | */
|
8599 | function getDataFromCustomEvent(nativeEvent) {
|
8600 | var detail = nativeEvent.detail;
|
8601 | if (typeof detail === 'object' && 'data' in detail) {
|
8602 | return detail.data;
|
8603 | }
|
8604 | return null;
|
8605 | }
|
8606 |
|
8607 | // Track the current IME composition fallback object, if any.
|
8608 | var currentComposition = null;
|
8609 |
|
8610 | /**
|
8611 | * @param {string} topLevelType Record from `EventConstants`.
|
8612 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
8613 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
8614 | * @param {object} nativeEvent Native browser event.
|
8615 | * @return {?object} A SyntheticCompositionEvent.
|
8616 | */
|
8617 | function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
8618 | var eventType;
|
8619 | var fallbackData;
|
8620 |
|
8621 | if (canUseCompositionEvent) {
|
8622 | eventType = getCompositionEventType(topLevelType);
|
8623 | } else if (!currentComposition) {
|
8624 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
|
8625 | eventType = eventTypes.compositionStart;
|
8626 | }
|
8627 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
8628 | eventType = eventTypes.compositionEnd;
|
8629 | }
|
8630 |
|
8631 | if (!eventType) {
|
8632 | return null;
|
8633 | }
|
8634 |
|
8635 | if (useFallbackCompositionData) {
|
8636 | // The current composition is stored statically and must not be
|
8637 | // overwritten while composition continues.
|
8638 | if (!currentComposition && eventType === eventTypes.compositionStart) {
|
8639 | currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
|
8640 | } else if (eventType === eventTypes.compositionEnd) {
|
8641 | if (currentComposition) {
|
8642 | fallbackData = currentComposition.getData();
|
8643 | }
|
8644 | }
|
8645 | }
|
8646 |
|
8647 | var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
|
8648 |
|
8649 | if (fallbackData) {
|
8650 | // Inject data generated from fallback path into the synthetic event.
|
8651 | // This matches the property of native CompositionEventInterface.
|
8652 | event.data = fallbackData;
|
8653 | } else {
|
8654 | var customData = getDataFromCustomEvent(nativeEvent);
|
8655 | if (customData !== null) {
|
8656 | event.data = customData;
|
8657 | }
|
8658 | }
|
8659 |
|
8660 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
8661 | return event;
|
8662 | }
|
8663 |
|
8664 | /**
|
8665 | * @param {string} topLevelType Record from `EventConstants`.
|
8666 | * @param {object} nativeEvent Native browser event.
|
8667 | * @return {?string} The string corresponding to this `beforeInput` event.
|
8668 | */
|
8669 | function getNativeBeforeInputChars(topLevelType, nativeEvent) {
|
8670 | switch (topLevelType) {
|
8671 | case topLevelTypes.topCompositionEnd:
|
8672 | return getDataFromCustomEvent(nativeEvent);
|
8673 | case topLevelTypes.topKeyPress:
|
8674 | /**
|
8675 | * If native `textInput` events are available, our goal is to make
|
8676 | * use of them. However, there is a special case: the spacebar key.
|
8677 | * In Webkit, preventing default on a spacebar `textInput` event
|
8678 | * cancels character insertion, but it *also* causes the browser
|
8679 | * to fall back to its default spacebar behavior of scrolling the
|
8680 | * page.
|
8681 | *
|
8682 | * Tracking at:
|
8683 | * https://code.google.com/p/chromium/issues/detail?id=355103
|
8684 | *
|
8685 | * To avoid this issue, use the keypress event as if no `textInput`
|
8686 | * event is available.
|
8687 | */
|
8688 | var which = nativeEvent.which;
|
8689 | if (which !== SPACEBAR_CODE) {
|
8690 | return null;
|
8691 | }
|
8692 |
|
8693 | hasSpaceKeypress = true;
|
8694 | return SPACEBAR_CHAR;
|
8695 |
|
8696 | case topLevelTypes.topTextInput:
|
8697 | // Record the characters to be added to the DOM.
|
8698 | var chars = nativeEvent.data;
|
8699 |
|
8700 | // If it's a spacebar character, assume that we have already handled
|
8701 | // it at the keypress level and bail immediately. Android Chrome
|
8702 | // doesn't give us keycodes, so we need to blacklist it.
|
8703 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
8704 | return null;
|
8705 | }
|
8706 |
|
8707 | return chars;
|
8708 |
|
8709 | default:
|
8710 | // For other native event types, do nothing.
|
8711 | return null;
|
8712 | }
|
8713 | }
|
8714 |
|
8715 | /**
|
8716 | * For browsers that do not provide the `textInput` event, extract the
|
8717 | * appropriate string to use for SyntheticInputEvent.
|
8718 | *
|
8719 | * @param {string} topLevelType Record from `EventConstants`.
|
8720 | * @param {object} nativeEvent Native browser event.
|
8721 | * @return {?string} The fallback string for this `beforeInput` event.
|
8722 | */
|
8723 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
|
8724 | // If we are currently composing (IME) and using a fallback to do so,
|
8725 | // try to extract the composed characters from the fallback object.
|
8726 | if (currentComposition) {
|
8727 | if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
8728 | var chars = currentComposition.getData();
|
8729 | FallbackCompositionState.release(currentComposition);
|
8730 | currentComposition = null;
|
8731 | return chars;
|
8732 | }
|
8733 | return null;
|
8734 | }
|
8735 |
|
8736 | switch (topLevelType) {
|
8737 | case topLevelTypes.topPaste:
|
8738 | // If a paste event occurs after a keypress, throw out the input
|
8739 | // chars. Paste events should not lead to BeforeInput events.
|
8740 | return null;
|
8741 | case topLevelTypes.topKeyPress:
|
8742 | /**
|
8743 | * As of v27, Firefox may fire keypress events even when no character
|
8744 | * will be inserted. A few possibilities:
|
8745 | *
|
8746 | * - `which` is `0`. Arrow keys, Esc key, etc.
|
8747 | *
|
8748 | * - `which` is the pressed key code, but no char is available.
|
8749 | * Ex: 'AltGr + d` in Polish. There is no modified character for
|
8750 | * this key combination and no character is inserted into the
|
8751 | * document, but FF fires the keypress for char code `100` anyway.
|
8752 | * No `input` event will occur.
|
8753 | *
|
8754 | * - `which` is the pressed key code, but a command combination is
|
8755 | * being used. Ex: `Cmd+C`. No character is inserted, and no
|
8756 | * `input` event will occur.
|
8757 | */
|
8758 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
|
8759 | return String.fromCharCode(nativeEvent.which);
|
8760 | }
|
8761 | return null;
|
8762 | case topLevelTypes.topCompositionEnd:
|
8763 | return useFallbackCompositionData ? null : nativeEvent.data;
|
8764 | default:
|
8765 | return null;
|
8766 | }
|
8767 | }
|
8768 |
|
8769 | /**
|
8770 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native
|
8771 | * `textInput` or fallback behavior.
|
8772 | *
|
8773 | * @param {string} topLevelType Record from `EventConstants`.
|
8774 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
8775 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
8776 | * @param {object} nativeEvent Native browser event.
|
8777 | * @return {?object} A SyntheticInputEvent.
|
8778 | */
|
8779 | function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
8780 | var chars;
|
8781 |
|
8782 | if (canUseTextInputEvent) {
|
8783 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
|
8784 | } else {
|
8785 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
|
8786 | }
|
8787 |
|
8788 | // If no characters are being inserted, no BeforeInput event should
|
8789 | // be fired.
|
8790 | if (!chars) {
|
8791 | return null;
|
8792 | }
|
8793 |
|
8794 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
|
8795 |
|
8796 | event.data = chars;
|
8797 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
8798 | return event;
|
8799 | }
|
8800 |
|
8801 | /**
|
8802 | * Create an `onBeforeInput` event to match
|
8803 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
|
8804 | *
|
8805 | * This event plugin is based on the native `textInput` event
|
8806 | * available in Chrome, Safari, Opera, and IE. This event fires after
|
8807 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
|
8808 | *
|
8809 | * `beforeInput` is spec'd but not implemented in any browsers, and
|
8810 | * the `input` event does not provide any useful information about what has
|
8811 | * actually been added, contrary to the spec. Thus, `textInput` is the best
|
8812 | * available event to identify the characters that have actually been inserted
|
8813 | * into the target node.
|
8814 | *
|
8815 | * This plugin is also responsible for emitting `composition` events, thus
|
8816 | * allowing us to share composition fallback code for both `beforeInput` and
|
8817 | * `composition` event types.
|
8818 | */
|
8819 | var BeforeInputEventPlugin = {
|
8820 |
|
8821 | eventTypes: eventTypes,
|
8822 |
|
8823 | /**
|
8824 | * @param {string} topLevelType Record from `EventConstants`.
|
8825 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
8826 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
8827 | * @param {object} nativeEvent Native browser event.
|
8828 | * @return {*} An accumulation of synthetic events.
|
8829 | * @see {EventPluginHub.extractEvents}
|
8830 | */
|
8831 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
8832 | return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
|
8833 | }
|
8834 | };
|
8835 |
|
8836 | module.exports = BeforeInputEventPlugin;
|
8837 |
|
8838 | /***/ },
|
8839 | /* 72 */
|
8840 | /***/ function(module, exports, __webpack_require__) {
|
8841 |
|
8842 | /**
|
8843 | * Copyright 2013-2015, Facebook, Inc.
|
8844 | * All rights reserved.
|
8845 | *
|
8846 | * This source code is licensed under the BSD-style license found in the
|
8847 | * LICENSE file in the root directory of this source tree. An additional grant
|
8848 | * of patent rights can be found in the PATENTS file in the same directory.
|
8849 | *
|
8850 | * @providesModule EventPropagators
|
8851 | */
|
8852 |
|
8853 | 'use strict';
|
8854 |
|
8855 | var EventConstants = __webpack_require__(29);
|
8856 | var EventPluginHub = __webpack_require__(30);
|
8857 |
|
8858 | var warning = __webpack_require__(24);
|
8859 |
|
8860 | var accumulateInto = __webpack_require__(34);
|
8861 | var forEachAccumulated = __webpack_require__(35);
|
8862 |
|
8863 | var PropagationPhases = EventConstants.PropagationPhases;
|
8864 | var getListener = EventPluginHub.getListener;
|
8865 |
|
8866 | /**
|
8867 | * Some event types have a notion of different registration names for different
|
8868 | * "phases" of propagation. This finds listeners by a given phase.
|
8869 | */
|
8870 | function listenerAtPhase(id, event, propagationPhase) {
|
8871 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
8872 | return getListener(id, registrationName);
|
8873 | }
|
8874 |
|
8875 | /**
|
8876 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
|
8877 | * here, allows us to not have to bind or create functions for each event.
|
8878 | * Mutating the event's members allows us to not have to create a wrapping
|
8879 | * "dispatch" object that pairs the event with the listener.
|
8880 | */
|
8881 | function accumulateDirectionalDispatches(domID, upwards, event) {
|
8882 | if (true) {
|
8883 | true ? warning(domID, 'Dispatching id must not be null') : undefined;
|
8884 | }
|
8885 | var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
8886 | var listener = listenerAtPhase(domID, event, phase);
|
8887 | if (listener) {
|
8888 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
8889 | event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
|
8890 | }
|
8891 | }
|
8892 |
|
8893 | /**
|
8894 | * Collect dispatches (must be entirely collected before dispatching - see unit
|
8895 | * tests). Lazily allocate the array to conserve memory. We must loop through
|
8896 | * each event and perform the traversal for each one. We cannot perform a
|
8897 | * single traversal for the entire collection of events because each event may
|
8898 | * have a different target.
|
8899 | */
|
8900 | function accumulateTwoPhaseDispatchesSingle(event) {
|
8901 | if (event && event.dispatchConfig.phasedRegistrationNames) {
|
8902 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
8903 | }
|
8904 | }
|
8905 |
|
8906 | /**
|
8907 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
|
8908 | */
|
8909 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
|
8910 | if (event && event.dispatchConfig.phasedRegistrationNames) {
|
8911 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
8912 | }
|
8913 | }
|
8914 |
|
8915 | /**
|
8916 | * Accumulates without regard to direction, does not look for phased
|
8917 | * registration names. Same as `accumulateDirectDispatchesSingle` but without
|
8918 | * requiring that the `dispatchMarker` be the same as the dispatched ID.
|
8919 | */
|
8920 | function accumulateDispatches(id, ignoredDirection, event) {
|
8921 | if (event && event.dispatchConfig.registrationName) {
|
8922 | var registrationName = event.dispatchConfig.registrationName;
|
8923 | var listener = getListener(id, registrationName);
|
8924 | if (listener) {
|
8925 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
8926 | event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
|
8927 | }
|
8928 | }
|
8929 | }
|
8930 |
|
8931 | /**
|
8932 | * Accumulates dispatches on an `SyntheticEvent`, but only for the
|
8933 | * `dispatchMarker`.
|
8934 | * @param {SyntheticEvent} event
|
8935 | */
|
8936 | function accumulateDirectDispatchesSingle(event) {
|
8937 | if (event && event.dispatchConfig.registrationName) {
|
8938 | accumulateDispatches(event.dispatchMarker, null, event);
|
8939 | }
|
8940 | }
|
8941 |
|
8942 | function accumulateTwoPhaseDispatches(events) {
|
8943 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
|
8944 | }
|
8945 |
|
8946 | function accumulateTwoPhaseDispatchesSkipTarget(events) {
|
8947 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
|
8948 | }
|
8949 |
|
8950 | function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
|
8951 | EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
|
8952 | }
|
8953 |
|
8954 | function accumulateDirectDispatches(events) {
|
8955 | forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
8956 | }
|
8957 |
|
8958 | /**
|
8959 | * A small set of propagation patterns, each of which will accept a small amount
|
8960 | * of information, and generate a set of "dispatch ready event objects" - which
|
8961 | * are sets of events that have already been annotated with a set of dispatched
|
8962 | * listener functions/ids. The API is designed this way to discourage these
|
8963 | * propagation strategies from actually executing the dispatches, since we
|
8964 | * always want to collect the entire set of dispatches before executing event a
|
8965 | * single one.
|
8966 | *
|
8967 | * @constructor EventPropagators
|
8968 | */
|
8969 | var EventPropagators = {
|
8970 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
|
8971 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
|
8972 | accumulateDirectDispatches: accumulateDirectDispatches,
|
8973 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
|
8974 | };
|
8975 |
|
8976 | module.exports = EventPropagators;
|
8977 |
|
8978 | /***/ },
|
8979 | /* 73 */
|
8980 | /***/ function(module, exports, __webpack_require__) {
|
8981 |
|
8982 | /**
|
8983 | * Copyright 2013-2015, Facebook, Inc.
|
8984 | * All rights reserved.
|
8985 | *
|
8986 | * This source code is licensed under the BSD-style license found in the
|
8987 | * LICENSE file in the root directory of this source tree. An additional grant
|
8988 | * of patent rights can be found in the PATENTS file in the same directory.
|
8989 | *
|
8990 | * @providesModule FallbackCompositionState
|
8991 | * @typechecks static-only
|
8992 | */
|
8993 |
|
8994 | 'use strict';
|
8995 |
|
8996 | var PooledClass = __webpack_require__(55);
|
8997 |
|
8998 | var assign = __webpack_require__(38);
|
8999 | var getTextContentAccessor = __webpack_require__(74);
|
9000 |
|
9001 | /**
|
9002 | * This helper class stores information about text content of a target node,
|
9003 | * allowing comparison of content before and after a given event.
|
9004 | *
|
9005 | * Identify the node where selection currently begins, then observe
|
9006 | * both its text content and its current position in the DOM. Since the
|
9007 | * browser may natively replace the target node during composition, we can
|
9008 | * use its position to find its replacement.
|
9009 | *
|
9010 | * @param {DOMEventTarget} root
|
9011 | */
|
9012 | function FallbackCompositionState(root) {
|
9013 | this._root = root;
|
9014 | this._startText = this.getText();
|
9015 | this._fallbackText = null;
|
9016 | }
|
9017 |
|
9018 | assign(FallbackCompositionState.prototype, {
|
9019 | destructor: function () {
|
9020 | this._root = null;
|
9021 | this._startText = null;
|
9022 | this._fallbackText = null;
|
9023 | },
|
9024 |
|
9025 | /**
|
9026 | * Get current text of input.
|
9027 | *
|
9028 | * @return {string}
|
9029 | */
|
9030 | getText: function () {
|
9031 | if ('value' in this._root) {
|
9032 | return this._root.value;
|
9033 | }
|
9034 | return this._root[getTextContentAccessor()];
|
9035 | },
|
9036 |
|
9037 | /**
|
9038 | * Determine the differing substring between the initially stored
|
9039 | * text content and the current content.
|
9040 | *
|
9041 | * @return {string}
|
9042 | */
|
9043 | getData: function () {
|
9044 | if (this._fallbackText) {
|
9045 | return this._fallbackText;
|
9046 | }
|
9047 |
|
9048 | var start;
|
9049 | var startValue = this._startText;
|
9050 | var startLength = startValue.length;
|
9051 | var end;
|
9052 | var endValue = this.getText();
|
9053 | var endLength = endValue.length;
|
9054 |
|
9055 | for (start = 0; start < startLength; start++) {
|
9056 | if (startValue[start] !== endValue[start]) {
|
9057 | break;
|
9058 | }
|
9059 | }
|
9060 |
|
9061 | var minEnd = startLength - start;
|
9062 | for (end = 1; end <= minEnd; end++) {
|
9063 | if (startValue[startLength - end] !== endValue[endLength - end]) {
|
9064 | break;
|
9065 | }
|
9066 | }
|
9067 |
|
9068 | var sliceTail = end > 1 ? 1 - end : undefined;
|
9069 | this._fallbackText = endValue.slice(start, sliceTail);
|
9070 | return this._fallbackText;
|
9071 | }
|
9072 | });
|
9073 |
|
9074 | PooledClass.addPoolingTo(FallbackCompositionState);
|
9075 |
|
9076 | module.exports = FallbackCompositionState;
|
9077 |
|
9078 | /***/ },
|
9079 | /* 74 */
|
9080 | /***/ function(module, exports, __webpack_require__) {
|
9081 |
|
9082 | /**
|
9083 | * Copyright 2013-2015, Facebook, Inc.
|
9084 | * All rights reserved.
|
9085 | *
|
9086 | * This source code is licensed under the BSD-style license found in the
|
9087 | * LICENSE file in the root directory of this source tree. An additional grant
|
9088 | * of patent rights can be found in the PATENTS file in the same directory.
|
9089 | *
|
9090 | * @providesModule getTextContentAccessor
|
9091 | */
|
9092 |
|
9093 | 'use strict';
|
9094 |
|
9095 | var ExecutionEnvironment = __webpack_require__(8);
|
9096 |
|
9097 | var contentKey = null;
|
9098 |
|
9099 | /**
|
9100 | * Gets the key used to access text content on a DOM node.
|
9101 | *
|
9102 | * @return {?string} Key used to access text content.
|
9103 | * @internal
|
9104 | */
|
9105 | function getTextContentAccessor() {
|
9106 | if (!contentKey && ExecutionEnvironment.canUseDOM) {
|
9107 | // Prefer textContent to innerText because many browsers support both but
|
9108 | // SVG <text> elements don't support innerText even when <div> does.
|
9109 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
|
9110 | }
|
9111 | return contentKey;
|
9112 | }
|
9113 |
|
9114 | module.exports = getTextContentAccessor;
|
9115 |
|
9116 | /***/ },
|
9117 | /* 75 */
|
9118 | /***/ function(module, exports, __webpack_require__) {
|
9119 |
|
9120 | /**
|
9121 | * Copyright 2013-2015, Facebook, Inc.
|
9122 | * All rights reserved.
|
9123 | *
|
9124 | * This source code is licensed under the BSD-style license found in the
|
9125 | * LICENSE file in the root directory of this source tree. An additional grant
|
9126 | * of patent rights can be found in the PATENTS file in the same directory.
|
9127 | *
|
9128 | * @providesModule SyntheticCompositionEvent
|
9129 | * @typechecks static-only
|
9130 | */
|
9131 |
|
9132 | 'use strict';
|
9133 |
|
9134 | var SyntheticEvent = __webpack_require__(76);
|
9135 |
|
9136 | /**
|
9137 | * @interface Event
|
9138 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
|
9139 | */
|
9140 | var CompositionEventInterface = {
|
9141 | data: null
|
9142 | };
|
9143 |
|
9144 | /**
|
9145 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9146 | * @param {string} dispatchMarker Marker identifying the event target.
|
9147 | * @param {object} nativeEvent Native browser event.
|
9148 | * @extends {SyntheticUIEvent}
|
9149 | */
|
9150 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9151 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
9152 | }
|
9153 |
|
9154 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
|
9155 |
|
9156 | module.exports = SyntheticCompositionEvent;
|
9157 |
|
9158 | /***/ },
|
9159 | /* 76 */
|
9160 | /***/ function(module, exports, __webpack_require__) {
|
9161 |
|
9162 | /**
|
9163 | * Copyright 2013-2015, Facebook, Inc.
|
9164 | * All rights reserved.
|
9165 | *
|
9166 | * This source code is licensed under the BSD-style license found in the
|
9167 | * LICENSE file in the root directory of this source tree. An additional grant
|
9168 | * of patent rights can be found in the PATENTS file in the same directory.
|
9169 | *
|
9170 | * @providesModule SyntheticEvent
|
9171 | * @typechecks static-only
|
9172 | */
|
9173 |
|
9174 | 'use strict';
|
9175 |
|
9176 | var PooledClass = __webpack_require__(55);
|
9177 |
|
9178 | var assign = __webpack_require__(38);
|
9179 | var emptyFunction = __webpack_require__(14);
|
9180 | var warning = __webpack_require__(24);
|
9181 |
|
9182 | /**
|
9183 | * @interface Event
|
9184 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
9185 | */
|
9186 | var EventInterface = {
|
9187 | type: null,
|
9188 | target: null,
|
9189 | // currentTarget is set when dispatching; no use in copying it here
|
9190 | currentTarget: emptyFunction.thatReturnsNull,
|
9191 | eventPhase: null,
|
9192 | bubbles: null,
|
9193 | cancelable: null,
|
9194 | timeStamp: function (event) {
|
9195 | return event.timeStamp || Date.now();
|
9196 | },
|
9197 | defaultPrevented: null,
|
9198 | isTrusted: null
|
9199 | };
|
9200 |
|
9201 | /**
|
9202 | * Synthetic events are dispatched by event plugins, typically in response to a
|
9203 | * top-level event delegation handler.
|
9204 | *
|
9205 | * These systems should generally use pooling to reduce the frequency of garbage
|
9206 | * collection. The system should check `isPersistent` to determine whether the
|
9207 | * event should be released into the pool after being dispatched. Users that
|
9208 | * need a persisted event should invoke `persist`.
|
9209 | *
|
9210 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
9211 | * normalizing browser quirks. Subclasses do not necessarily have to implement a
|
9212 | * DOM interface; custom application-specific events can also subclass this.
|
9213 | *
|
9214 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9215 | * @param {string} dispatchMarker Marker identifying the event target.
|
9216 | * @param {object} nativeEvent Native browser event.
|
9217 | */
|
9218 | function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9219 | this.dispatchConfig = dispatchConfig;
|
9220 | this.dispatchMarker = dispatchMarker;
|
9221 | this.nativeEvent = nativeEvent;
|
9222 |
|
9223 | var Interface = this.constructor.Interface;
|
9224 | for (var propName in Interface) {
|
9225 | if (!Interface.hasOwnProperty(propName)) {
|
9226 | continue;
|
9227 | }
|
9228 | var normalize = Interface[propName];
|
9229 | if (normalize) {
|
9230 | this[propName] = normalize(nativeEvent);
|
9231 | } else {
|
9232 | if (propName === 'target') {
|
9233 | this.target = nativeEventTarget;
|
9234 | } else {
|
9235 | this[propName] = nativeEvent[propName];
|
9236 | }
|
9237 | }
|
9238 | }
|
9239 |
|
9240 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
9241 | if (defaultPrevented) {
|
9242 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
9243 | } else {
|
9244 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
|
9245 | }
|
9246 | this.isPropagationStopped = emptyFunction.thatReturnsFalse;
|
9247 | }
|
9248 |
|
9249 | assign(SyntheticEvent.prototype, {
|
9250 |
|
9251 | preventDefault: function () {
|
9252 | this.defaultPrevented = true;
|
9253 | var event = this.nativeEvent;
|
9254 | if (true) {
|
9255 | true ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
|
9256 | }
|
9257 | if (!event) {
|
9258 | return;
|
9259 | }
|
9260 |
|
9261 | if (event.preventDefault) {
|
9262 | event.preventDefault();
|
9263 | } else {
|
9264 | event.returnValue = false;
|
9265 | }
|
9266 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
9267 | },
|
9268 |
|
9269 | stopPropagation: function () {
|
9270 | var event = this.nativeEvent;
|
9271 | if (true) {
|
9272 | true ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
|
9273 | }
|
9274 | if (!event) {
|
9275 | return;
|
9276 | }
|
9277 |
|
9278 | if (event.stopPropagation) {
|
9279 | event.stopPropagation();
|
9280 | } else {
|
9281 | event.cancelBubble = true;
|
9282 | }
|
9283 | this.isPropagationStopped = emptyFunction.thatReturnsTrue;
|
9284 | },
|
9285 |
|
9286 | /**
|
9287 | * We release all dispatched `SyntheticEvent`s after each event loop, adding
|
9288 | * them back into the pool. This allows a way to hold onto a reference that
|
9289 | * won't be added back into the pool.
|
9290 | */
|
9291 | persist: function () {
|
9292 | this.isPersistent = emptyFunction.thatReturnsTrue;
|
9293 | },
|
9294 |
|
9295 | /**
|
9296 | * Checks if this event should be released back into the pool.
|
9297 | *
|
9298 | * @return {boolean} True if this should not be released, false otherwise.
|
9299 | */
|
9300 | isPersistent: emptyFunction.thatReturnsFalse,
|
9301 |
|
9302 | /**
|
9303 | * `PooledClass` looks for `destructor` on each instance it releases.
|
9304 | */
|
9305 | destructor: function () {
|
9306 | var Interface = this.constructor.Interface;
|
9307 | for (var propName in Interface) {
|
9308 | this[propName] = null;
|
9309 | }
|
9310 | this.dispatchConfig = null;
|
9311 | this.dispatchMarker = null;
|
9312 | this.nativeEvent = null;
|
9313 | }
|
9314 |
|
9315 | });
|
9316 |
|
9317 | SyntheticEvent.Interface = EventInterface;
|
9318 |
|
9319 | /**
|
9320 | * Helper to reduce boilerplate when creating subclasses.
|
9321 | *
|
9322 | * @param {function} Class
|
9323 | * @param {?object} Interface
|
9324 | */
|
9325 | SyntheticEvent.augmentClass = function (Class, Interface) {
|
9326 | var Super = this;
|
9327 |
|
9328 | var prototype = Object.create(Super.prototype);
|
9329 | assign(prototype, Class.prototype);
|
9330 | Class.prototype = prototype;
|
9331 | Class.prototype.constructor = Class;
|
9332 |
|
9333 | Class.Interface = assign({}, Super.Interface, Interface);
|
9334 | Class.augmentClass = Super.augmentClass;
|
9335 |
|
9336 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
|
9337 | };
|
9338 |
|
9339 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
|
9340 |
|
9341 | module.exports = SyntheticEvent;
|
9342 |
|
9343 | /***/ },
|
9344 | /* 77 */
|
9345 | /***/ function(module, exports, __webpack_require__) {
|
9346 |
|
9347 | /**
|
9348 | * Copyright 2013-2015, Facebook, Inc.
|
9349 | * All rights reserved.
|
9350 | *
|
9351 | * This source code is licensed under the BSD-style license found in the
|
9352 | * LICENSE file in the root directory of this source tree. An additional grant
|
9353 | * of patent rights can be found in the PATENTS file in the same directory.
|
9354 | *
|
9355 | * @providesModule SyntheticInputEvent
|
9356 | * @typechecks static-only
|
9357 | */
|
9358 |
|
9359 | 'use strict';
|
9360 |
|
9361 | var SyntheticEvent = __webpack_require__(76);
|
9362 |
|
9363 | /**
|
9364 | * @interface Event
|
9365 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
|
9366 | * /#events-inputevents
|
9367 | */
|
9368 | var InputEventInterface = {
|
9369 | data: null
|
9370 | };
|
9371 |
|
9372 | /**
|
9373 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9374 | * @param {string} dispatchMarker Marker identifying the event target.
|
9375 | * @param {object} nativeEvent Native browser event.
|
9376 | * @extends {SyntheticUIEvent}
|
9377 | */
|
9378 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9379 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
9380 | }
|
9381 |
|
9382 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
|
9383 |
|
9384 | module.exports = SyntheticInputEvent;
|
9385 |
|
9386 | /***/ },
|
9387 | /* 78 */
|
9388 | /***/ function(module, exports) {
|
9389 |
|
9390 | /**
|
9391 | * Copyright 2013-2015, Facebook, Inc.
|
9392 | * All rights reserved.
|
9393 | *
|
9394 | * This source code is licensed under the BSD-style license found in the
|
9395 | * LICENSE file in the root directory of this source tree. An additional grant
|
9396 | * of patent rights can be found in the PATENTS file in the same directory.
|
9397 | *
|
9398 | * @providesModule keyOf
|
9399 | */
|
9400 |
|
9401 | /**
|
9402 | * Allows extraction of a minified key. Let's the build system minify keys
|
9403 | * without losing the ability to dynamically use key strings as values
|
9404 | * themselves. Pass in an object with a single key/val pair and it will return
|
9405 | * you the string key of that single record. Suppose you want to grab the
|
9406 | * value for a key 'className' inside of an object. Key/val minification may
|
9407 | * have aliased that key to be 'xa12'. keyOf({className: null}) will return
|
9408 | * 'xa12' in that case. Resolve keys you want to use once at startup time, then
|
9409 | * reuse those resolutions.
|
9410 | */
|
9411 | "use strict";
|
9412 |
|
9413 | var keyOf = function (oneKeyObj) {
|
9414 | var key;
|
9415 | for (key in oneKeyObj) {
|
9416 | if (!oneKeyObj.hasOwnProperty(key)) {
|
9417 | continue;
|
9418 | }
|
9419 | return key;
|
9420 | }
|
9421 | return null;
|
9422 | };
|
9423 |
|
9424 | module.exports = keyOf;
|
9425 |
|
9426 | /***/ },
|
9427 | /* 79 */
|
9428 | /***/ function(module, exports, __webpack_require__) {
|
9429 |
|
9430 | /**
|
9431 | * Copyright 2013-2015, Facebook, Inc.
|
9432 | * All rights reserved.
|
9433 | *
|
9434 | * This source code is licensed under the BSD-style license found in the
|
9435 | * LICENSE file in the root directory of this source tree. An additional grant
|
9436 | * of patent rights can be found in the PATENTS file in the same directory.
|
9437 | *
|
9438 | * @providesModule ChangeEventPlugin
|
9439 | */
|
9440 |
|
9441 | 'use strict';
|
9442 |
|
9443 | var EventConstants = __webpack_require__(29);
|
9444 | var EventPluginHub = __webpack_require__(30);
|
9445 | var EventPropagators = __webpack_require__(72);
|
9446 | var ExecutionEnvironment = __webpack_require__(8);
|
9447 | var ReactUpdates = __webpack_require__(53);
|
9448 | var SyntheticEvent = __webpack_require__(76);
|
9449 |
|
9450 | var getEventTarget = __webpack_require__(80);
|
9451 | var isEventSupported = __webpack_require__(39);
|
9452 | var isTextInputElement = __webpack_require__(81);
|
9453 | var keyOf = __webpack_require__(78);
|
9454 |
|
9455 | var topLevelTypes = EventConstants.topLevelTypes;
|
9456 |
|
9457 | var eventTypes = {
|
9458 | change: {
|
9459 | phasedRegistrationNames: {
|
9460 | bubbled: keyOf({ onChange: null }),
|
9461 | captured: keyOf({ onChangeCapture: null })
|
9462 | },
|
9463 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
|
9464 | }
|
9465 | };
|
9466 |
|
9467 | /**
|
9468 | * For IE shims
|
9469 | */
|
9470 | var activeElement = null;
|
9471 | var activeElementID = null;
|
9472 | var activeElementValue = null;
|
9473 | var activeElementValueProp = null;
|
9474 |
|
9475 | /**
|
9476 | * SECTION: handle `change` event
|
9477 | */
|
9478 | function shouldUseChangeEvent(elem) {
|
9479 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
|
9480 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
|
9481 | }
|
9482 |
|
9483 | var doesChangeEventBubble = false;
|
9484 | if (ExecutionEnvironment.canUseDOM) {
|
9485 | // See `handleChange` comment below
|
9486 | doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
|
9487 | }
|
9488 |
|
9489 | function manualDispatchChangeEvent(nativeEvent) {
|
9490 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
|
9491 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
9492 |
|
9493 | // If change and propertychange bubbled, we'd just bind to it like all the
|
9494 | // other events and have it go through ReactBrowserEventEmitter. Since it
|
9495 | // doesn't, we manually listen for the events and so we have to enqueue and
|
9496 | // process the abstract event manually.
|
9497 | //
|
9498 | // Batching is necessary here in order to ensure that all event handlers run
|
9499 | // before the next rerender (including event handlers attached to ancestor
|
9500 | // elements instead of directly on the input). Without this, controlled
|
9501 | // components don't work properly in conjunction with event bubbling because
|
9502 | // the component is rerendered and the value reverted before all the event
|
9503 | // handlers can run. See https://github.com/facebook/react/issues/708.
|
9504 | ReactUpdates.batchedUpdates(runEventInBatch, event);
|
9505 | }
|
9506 |
|
9507 | function runEventInBatch(event) {
|
9508 | EventPluginHub.enqueueEvents(event);
|
9509 | EventPluginHub.processEventQueue(false);
|
9510 | }
|
9511 |
|
9512 | function startWatchingForChangeEventIE8(target, targetID) {
|
9513 | activeElement = target;
|
9514 | activeElementID = targetID;
|
9515 | activeElement.attachEvent('onchange', manualDispatchChangeEvent);
|
9516 | }
|
9517 |
|
9518 | function stopWatchingForChangeEventIE8() {
|
9519 | if (!activeElement) {
|
9520 | return;
|
9521 | }
|
9522 | activeElement.detachEvent('onchange', manualDispatchChangeEvent);
|
9523 | activeElement = null;
|
9524 | activeElementID = null;
|
9525 | }
|
9526 |
|
9527 | function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9528 | if (topLevelType === topLevelTypes.topChange) {
|
9529 | return topLevelTargetID;
|
9530 | }
|
9531 | }
|
9532 | function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
|
9533 | if (topLevelType === topLevelTypes.topFocus) {
|
9534 | // stopWatching() should be a noop here but we call it just in case we
|
9535 | // missed a blur event somehow.
|
9536 | stopWatchingForChangeEventIE8();
|
9537 | startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
|
9538 | } else if (topLevelType === topLevelTypes.topBlur) {
|
9539 | stopWatchingForChangeEventIE8();
|
9540 | }
|
9541 | }
|
9542 |
|
9543 | /**
|
9544 | * SECTION: handle `input` event
|
9545 | */
|
9546 | var isInputEventSupported = false;
|
9547 | if (ExecutionEnvironment.canUseDOM) {
|
9548 | // IE9 claims to support the input event but fails to trigger it when
|
9549 | // deleting text, so we ignore its input events
|
9550 | isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
|
9551 | }
|
9552 |
|
9553 | /**
|
9554 | * (For old IE.) Replacement getter/setter for the `value` property that gets
|
9555 | * set on the active element.
|
9556 | */
|
9557 | var newValueProp = {
|
9558 | get: function () {
|
9559 | return activeElementValueProp.get.call(this);
|
9560 | },
|
9561 | set: function (val) {
|
9562 | // Cast to a string so we can do equality checks.
|
9563 | activeElementValue = '' + val;
|
9564 | activeElementValueProp.set.call(this, val);
|
9565 | }
|
9566 | };
|
9567 |
|
9568 | /**
|
9569 | * (For old IE.) Starts tracking propertychange events on the passed-in element
|
9570 | * and override the value property so that we can distinguish user events from
|
9571 | * value changes in JS.
|
9572 | */
|
9573 | function startWatchingForValueChange(target, targetID) {
|
9574 | activeElement = target;
|
9575 | activeElementID = targetID;
|
9576 | activeElementValue = target.value;
|
9577 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
|
9578 |
|
9579 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
|
9580 | // on DOM elements
|
9581 | Object.defineProperty(activeElement, 'value', newValueProp);
|
9582 | activeElement.attachEvent('onpropertychange', handlePropertyChange);
|
9583 | }
|
9584 |
|
9585 | /**
|
9586 | * (For old IE.) Removes the event listeners from the currently-tracked element,
|
9587 | * if any exists.
|
9588 | */
|
9589 | function stopWatchingForValueChange() {
|
9590 | if (!activeElement) {
|
9591 | return;
|
9592 | }
|
9593 |
|
9594 | // delete restores the original property definition
|
9595 | delete activeElement.value;
|
9596 | activeElement.detachEvent('onpropertychange', handlePropertyChange);
|
9597 |
|
9598 | activeElement = null;
|
9599 | activeElementID = null;
|
9600 | activeElementValue = null;
|
9601 | activeElementValueProp = null;
|
9602 | }
|
9603 |
|
9604 | /**
|
9605 | * (For old IE.) Handles a propertychange event, sending a `change` event if
|
9606 | * the value of the active element has changed.
|
9607 | */
|
9608 | function handlePropertyChange(nativeEvent) {
|
9609 | if (nativeEvent.propertyName !== 'value') {
|
9610 | return;
|
9611 | }
|
9612 | var value = nativeEvent.srcElement.value;
|
9613 | if (value === activeElementValue) {
|
9614 | return;
|
9615 | }
|
9616 | activeElementValue = value;
|
9617 |
|
9618 | manualDispatchChangeEvent(nativeEvent);
|
9619 | }
|
9620 |
|
9621 | /**
|
9622 | * If a `change` event should be fired, returns the target's ID.
|
9623 | */
|
9624 | function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9625 | if (topLevelType === topLevelTypes.topInput) {
|
9626 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
|
9627 | // what we want so fall through here and trigger an abstract event
|
9628 | return topLevelTargetID;
|
9629 | }
|
9630 | }
|
9631 |
|
9632 | // For IE8 and IE9.
|
9633 | function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
|
9634 | if (topLevelType === topLevelTypes.topFocus) {
|
9635 | // In IE8, we can capture almost all .value changes by adding a
|
9636 | // propertychange handler and looking for events with propertyName
|
9637 | // equal to 'value'
|
9638 | // In IE9, propertychange fires for most input events but is buggy and
|
9639 | // doesn't fire when text is deleted, but conveniently, selectionchange
|
9640 | // appears to fire in all of the remaining cases so we catch those and
|
9641 | // forward the event if the value has changed
|
9642 | // In either case, we don't want to call the event handler if the value
|
9643 | // is changed from JS so we redefine a setter for `.value` that updates
|
9644 | // our activeElementValue variable, allowing us to ignore those changes
|
9645 | //
|
9646 | // stopWatching() should be a noop here but we call it just in case we
|
9647 | // missed a blur event somehow.
|
9648 | stopWatchingForValueChange();
|
9649 | startWatchingForValueChange(topLevelTarget, topLevelTargetID);
|
9650 | } else if (topLevelType === topLevelTypes.topBlur) {
|
9651 | stopWatchingForValueChange();
|
9652 | }
|
9653 | }
|
9654 |
|
9655 | // For IE8 and IE9.
|
9656 | function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
|
9657 | if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
|
9658 | // On the selectionchange event, the target is just document which isn't
|
9659 | // helpful for us so just check activeElement instead.
|
9660 | //
|
9661 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
|
9662 | // propertychange on the first input event after setting `value` from a
|
9663 | // script and fires only keydown, keypress, keyup. Catching keyup usually
|
9664 | // gets it and catching keydown lets us fire an event for the first
|
9665 | // keystroke if user does a key repeat (it'll be a little delayed: right
|
9666 | // before the second keystroke). Other input methods (e.g., paste) seem to
|
9667 | // fire selectionchange normally.
|
9668 | if (activeElement && activeElement.value !== activeElementValue) {
|
9669 | activeElementValue = activeElement.value;
|
9670 | return activeElementID;
|
9671 | }
|
9672 | }
|
9673 | }
|
9674 |
|
9675 | /**
|
9676 | * SECTION: handle `click` event
|
9677 | */
|
9678 | function shouldUseClickEvent(elem) {
|
9679 | // Use the `click` event to detect changes to checkbox and radio inputs.
|
9680 | // This approach works across all browsers, whereas `change` does not fire
|
9681 | // until `blur` in IE8.
|
9682 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
|
9683 | }
|
9684 |
|
9685 | function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9686 | if (topLevelType === topLevelTypes.topClick) {
|
9687 | return topLevelTargetID;
|
9688 | }
|
9689 | }
|
9690 |
|
9691 | /**
|
9692 | * This plugin creates an `onChange` event that normalizes change events
|
9693 | * across form elements. This event fires at a time when it's possible to
|
9694 | * change the element's value without seeing a flicker.
|
9695 | *
|
9696 | * Supported elements are:
|
9697 | * - input (see `isTextInputElement`)
|
9698 | * - textarea
|
9699 | * - select
|
9700 | */
|
9701 | var ChangeEventPlugin = {
|
9702 |
|
9703 | eventTypes: eventTypes,
|
9704 |
|
9705 | /**
|
9706 | * @param {string} topLevelType Record from `EventConstants`.
|
9707 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
9708 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
9709 | * @param {object} nativeEvent Native browser event.
|
9710 | * @return {*} An accumulation of synthetic events.
|
9711 | * @see {EventPluginHub.extractEvents}
|
9712 | */
|
9713 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
9714 |
|
9715 | var getTargetIDFunc, handleEventFunc;
|
9716 | if (shouldUseChangeEvent(topLevelTarget)) {
|
9717 | if (doesChangeEventBubble) {
|
9718 | getTargetIDFunc = getTargetIDForChangeEvent;
|
9719 | } else {
|
9720 | handleEventFunc = handleEventsForChangeEventIE8;
|
9721 | }
|
9722 | } else if (isTextInputElement(topLevelTarget)) {
|
9723 | if (isInputEventSupported) {
|
9724 | getTargetIDFunc = getTargetIDForInputEvent;
|
9725 | } else {
|
9726 | getTargetIDFunc = getTargetIDForInputEventIE;
|
9727 | handleEventFunc = handleEventsForInputEventIE;
|
9728 | }
|
9729 | } else if (shouldUseClickEvent(topLevelTarget)) {
|
9730 | getTargetIDFunc = getTargetIDForClickEvent;
|
9731 | }
|
9732 |
|
9733 | if (getTargetIDFunc) {
|
9734 | var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
|
9735 | if (targetID) {
|
9736 | var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
|
9737 | event.type = 'change';
|
9738 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
9739 | return event;
|
9740 | }
|
9741 | }
|
9742 |
|
9743 | if (handleEventFunc) {
|
9744 | handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
|
9745 | }
|
9746 | }
|
9747 |
|
9748 | };
|
9749 |
|
9750 | module.exports = ChangeEventPlugin;
|
9751 |
|
9752 | /***/ },
|
9753 | /* 80 */
|
9754 | /***/ function(module, exports) {
|
9755 |
|
9756 | /**
|
9757 | * Copyright 2013-2015, Facebook, Inc.
|
9758 | * All rights reserved.
|
9759 | *
|
9760 | * This source code is licensed under the BSD-style license found in the
|
9761 | * LICENSE file in the root directory of this source tree. An additional grant
|
9762 | * of patent rights can be found in the PATENTS file in the same directory.
|
9763 | *
|
9764 | * @providesModule getEventTarget
|
9765 | * @typechecks static-only
|
9766 | */
|
9767 |
|
9768 | 'use strict';
|
9769 |
|
9770 | /**
|
9771 | * Gets the target node from a native browser event by accounting for
|
9772 | * inconsistencies in browser DOM APIs.
|
9773 | *
|
9774 | * @param {object} nativeEvent Native browser event.
|
9775 | * @return {DOMEventTarget} Target node.
|
9776 | */
|
9777 | function getEventTarget(nativeEvent) {
|
9778 | var target = nativeEvent.target || nativeEvent.srcElement || window;
|
9779 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
|
9780 | // @see http://www.quirksmode.org/js/events_properties.html
|
9781 | return target.nodeType === 3 ? target.parentNode : target;
|
9782 | }
|
9783 |
|
9784 | module.exports = getEventTarget;
|
9785 |
|
9786 | /***/ },
|
9787 | /* 81 */
|
9788 | /***/ function(module, exports) {
|
9789 |
|
9790 | /**
|
9791 | * Copyright 2013-2015, Facebook, Inc.
|
9792 | * All rights reserved.
|
9793 | *
|
9794 | * This source code is licensed under the BSD-style license found in the
|
9795 | * LICENSE file in the root directory of this source tree. An additional grant
|
9796 | * of patent rights can be found in the PATENTS file in the same directory.
|
9797 | *
|
9798 | * @providesModule isTextInputElement
|
9799 | */
|
9800 |
|
9801 | 'use strict';
|
9802 |
|
9803 | /**
|
9804 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
|
9805 | */
|
9806 | var supportedInputTypes = {
|
9807 | 'color': true,
|
9808 | 'date': true,
|
9809 | 'datetime': true,
|
9810 | 'datetime-local': true,
|
9811 | 'email': true,
|
9812 | 'month': true,
|
9813 | 'number': true,
|
9814 | 'password': true,
|
9815 | 'range': true,
|
9816 | 'search': true,
|
9817 | 'tel': true,
|
9818 | 'text': true,
|
9819 | 'time': true,
|
9820 | 'url': true,
|
9821 | 'week': true
|
9822 | };
|
9823 |
|
9824 | function isTextInputElement(elem) {
|
9825 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
9826 | return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
|
9827 | }
|
9828 |
|
9829 | module.exports = isTextInputElement;
|
9830 |
|
9831 | /***/ },
|
9832 | /* 82 */
|
9833 | /***/ function(module, exports) {
|
9834 |
|
9835 | /**
|
9836 | * Copyright 2013-2015, Facebook, Inc.
|
9837 | * All rights reserved.
|
9838 | *
|
9839 | * This source code is licensed under the BSD-style license found in the
|
9840 | * LICENSE file in the root directory of this source tree. An additional grant
|
9841 | * of patent rights can be found in the PATENTS file in the same directory.
|
9842 | *
|
9843 | * @providesModule ClientReactRootIndex
|
9844 | * @typechecks
|
9845 | */
|
9846 |
|
9847 | 'use strict';
|
9848 |
|
9849 | var nextReactRootIndex = 0;
|
9850 |
|
9851 | var ClientReactRootIndex = {
|
9852 | createReactRootIndex: function () {
|
9853 | return nextReactRootIndex++;
|
9854 | }
|
9855 | };
|
9856 |
|
9857 | module.exports = ClientReactRootIndex;
|
9858 |
|
9859 | /***/ },
|
9860 | /* 83 */
|
9861 | /***/ function(module, exports, __webpack_require__) {
|
9862 |
|
9863 | /**
|
9864 | * Copyright 2013-2015, Facebook, Inc.
|
9865 | * All rights reserved.
|
9866 | *
|
9867 | * This source code is licensed under the BSD-style license found in the
|
9868 | * LICENSE file in the root directory of this source tree. An additional grant
|
9869 | * of patent rights can be found in the PATENTS file in the same directory.
|
9870 | *
|
9871 | * @providesModule DefaultEventPluginOrder
|
9872 | */
|
9873 |
|
9874 | 'use strict';
|
9875 |
|
9876 | var keyOf = __webpack_require__(78);
|
9877 |
|
9878 | /**
|
9879 | * Module that is injectable into `EventPluginHub`, that specifies a
|
9880 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about
|
9881 | * plugins, without having to package every one of them. This is better than
|
9882 | * having plugins be ordered in the same order that they are injected because
|
9883 | * that ordering would be influenced by the packaging order.
|
9884 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
|
9885 | * preventing default on events is convenient in `SimpleEventPlugin` handlers.
|
9886 | */
|
9887 | var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
|
9888 |
|
9889 | module.exports = DefaultEventPluginOrder;
|
9890 |
|
9891 | /***/ },
|
9892 | /* 84 */
|
9893 | /***/ function(module, exports, __webpack_require__) {
|
9894 |
|
9895 | /**
|
9896 | * Copyright 2013-2015, Facebook, Inc.
|
9897 | * All rights reserved.
|
9898 | *
|
9899 | * This source code is licensed under the BSD-style license found in the
|
9900 | * LICENSE file in the root directory of this source tree. An additional grant
|
9901 | * of patent rights can be found in the PATENTS file in the same directory.
|
9902 | *
|
9903 | * @providesModule EnterLeaveEventPlugin
|
9904 | * @typechecks static-only
|
9905 | */
|
9906 |
|
9907 | 'use strict';
|
9908 |
|
9909 | var EventConstants = __webpack_require__(29);
|
9910 | var EventPropagators = __webpack_require__(72);
|
9911 | var SyntheticMouseEvent = __webpack_require__(85);
|
9912 |
|
9913 | var ReactMount = __webpack_require__(27);
|
9914 | var keyOf = __webpack_require__(78);
|
9915 |
|
9916 | var topLevelTypes = EventConstants.topLevelTypes;
|
9917 | var getFirstReactDOM = ReactMount.getFirstReactDOM;
|
9918 |
|
9919 | var eventTypes = {
|
9920 | mouseEnter: {
|
9921 | registrationName: keyOf({ onMouseEnter: null }),
|
9922 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
|
9923 | },
|
9924 | mouseLeave: {
|
9925 | registrationName: keyOf({ onMouseLeave: null }),
|
9926 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
|
9927 | }
|
9928 | };
|
9929 |
|
9930 | var extractedEvents = [null, null];
|
9931 |
|
9932 | var EnterLeaveEventPlugin = {
|
9933 |
|
9934 | eventTypes: eventTypes,
|
9935 |
|
9936 | /**
|
9937 | * For almost every interaction we care about, there will be both a top-level
|
9938 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
|
9939 | * we do not extract duplicate events. However, moving the mouse into the
|
9940 | * browser from outside will not fire a `mouseout` event. In this case, we use
|
9941 | * the `mouseover` top-level event.
|
9942 | *
|
9943 | * @param {string} topLevelType Record from `EventConstants`.
|
9944 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
9945 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
9946 | * @param {object} nativeEvent Native browser event.
|
9947 | * @return {*} An accumulation of synthetic events.
|
9948 | * @see {EventPluginHub.extractEvents}
|
9949 | */
|
9950 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
9951 | if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
|
9952 | return null;
|
9953 | }
|
9954 | if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
|
9955 | // Must not be a mouse in or mouse out - ignoring.
|
9956 | return null;
|
9957 | }
|
9958 |
|
9959 | var win;
|
9960 | if (topLevelTarget.window === topLevelTarget) {
|
9961 | // `topLevelTarget` is probably a window object.
|
9962 | win = topLevelTarget;
|
9963 | } else {
|
9964 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
|
9965 | var doc = topLevelTarget.ownerDocument;
|
9966 | if (doc) {
|
9967 | win = doc.defaultView || doc.parentWindow;
|
9968 | } else {
|
9969 | win = window;
|
9970 | }
|
9971 | }
|
9972 |
|
9973 | var from;
|
9974 | var to;
|
9975 | var fromID = '';
|
9976 | var toID = '';
|
9977 | if (topLevelType === topLevelTypes.topMouseOut) {
|
9978 | from = topLevelTarget;
|
9979 | fromID = topLevelTargetID;
|
9980 | to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
|
9981 | if (to) {
|
9982 | toID = ReactMount.getID(to);
|
9983 | } else {
|
9984 | to = win;
|
9985 | }
|
9986 | to = to || win;
|
9987 | } else {
|
9988 | from = win;
|
9989 | to = topLevelTarget;
|
9990 | toID = topLevelTargetID;
|
9991 | }
|
9992 |
|
9993 | if (from === to) {
|
9994 | // Nothing pertains to our managed components.
|
9995 | return null;
|
9996 | }
|
9997 |
|
9998 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
|
9999 | leave.type = 'mouseleave';
|
10000 | leave.target = from;
|
10001 | leave.relatedTarget = to;
|
10002 |
|
10003 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
|
10004 | enter.type = 'mouseenter';
|
10005 | enter.target = to;
|
10006 | enter.relatedTarget = from;
|
10007 |
|
10008 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
|
10009 |
|
10010 | extractedEvents[0] = leave;
|
10011 | extractedEvents[1] = enter;
|
10012 |
|
10013 | return extractedEvents;
|
10014 | }
|
10015 |
|
10016 | };
|
10017 |
|
10018 | module.exports = EnterLeaveEventPlugin;
|
10019 |
|
10020 | /***/ },
|
10021 | /* 85 */
|
10022 | /***/ function(module, exports, __webpack_require__) {
|
10023 |
|
10024 | /**
|
10025 | * Copyright 2013-2015, Facebook, Inc.
|
10026 | * All rights reserved.
|
10027 | *
|
10028 | * This source code is licensed under the BSD-style license found in the
|
10029 | * LICENSE file in the root directory of this source tree. An additional grant
|
10030 | * of patent rights can be found in the PATENTS file in the same directory.
|
10031 | *
|
10032 | * @providesModule SyntheticMouseEvent
|
10033 | * @typechecks static-only
|
10034 | */
|
10035 |
|
10036 | 'use strict';
|
10037 |
|
10038 | var SyntheticUIEvent = __webpack_require__(86);
|
10039 | var ViewportMetrics = __webpack_require__(37);
|
10040 |
|
10041 | var getEventModifierState = __webpack_require__(87);
|
10042 |
|
10043 | /**
|
10044 | * @interface MouseEvent
|
10045 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
10046 | */
|
10047 | var MouseEventInterface = {
|
10048 | screenX: null,
|
10049 | screenY: null,
|
10050 | clientX: null,
|
10051 | clientY: null,
|
10052 | ctrlKey: null,
|
10053 | shiftKey: null,
|
10054 | altKey: null,
|
10055 | metaKey: null,
|
10056 | getModifierState: getEventModifierState,
|
10057 | button: function (event) {
|
10058 | // Webkit, Firefox, IE9+
|
10059 | // which: 1 2 3
|
10060 | // button: 0 1 2 (standard)
|
10061 | var button = event.button;
|
10062 | if ('which' in event) {
|
10063 | return button;
|
10064 | }
|
10065 | // IE<9
|
10066 | // which: undefined
|
10067 | // button: 0 0 0
|
10068 | // button: 1 4 2 (onmouseup)
|
10069 | return button === 2 ? 2 : button === 4 ? 1 : 0;
|
10070 | },
|
10071 | buttons: null,
|
10072 | relatedTarget: function (event) {
|
10073 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
|
10074 | },
|
10075 | // "Proprietary" Interface.
|
10076 | pageX: function (event) {
|
10077 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
|
10078 | },
|
10079 | pageY: function (event) {
|
10080 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
|
10081 | }
|
10082 | };
|
10083 |
|
10084 | /**
|
10085 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
10086 | * @param {string} dispatchMarker Marker identifying the event target.
|
10087 | * @param {object} nativeEvent Native browser event.
|
10088 | * @extends {SyntheticUIEvent}
|
10089 | */
|
10090 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
10091 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
10092 | }
|
10093 |
|
10094 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
|
10095 |
|
10096 | module.exports = SyntheticMouseEvent;
|
10097 |
|
10098 | /***/ },
|
10099 | /* 86 */
|
10100 | /***/ function(module, exports, __webpack_require__) {
|
10101 |
|
10102 | /**
|
10103 | * Copyright 2013-2015, Facebook, Inc.
|
10104 | * All rights reserved.
|
10105 | *
|
10106 | * This source code is licensed under the BSD-style license found in the
|
10107 | * LICENSE file in the root directory of this source tree. An additional grant
|
10108 | * of patent rights can be found in the PATENTS file in the same directory.
|
10109 | *
|
10110 | * @providesModule SyntheticUIEvent
|
10111 | * @typechecks static-only
|
10112 | */
|
10113 |
|
10114 | 'use strict';
|
10115 |
|
10116 | var SyntheticEvent = __webpack_require__(76);
|
10117 |
|
10118 | var getEventTarget = __webpack_require__(80);
|
10119 |
|
10120 | /**
|
10121 | * @interface UIEvent
|
10122 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
10123 | */
|
10124 | var UIEventInterface = {
|
10125 | view: function (event) {
|
10126 | if (event.view) {
|
10127 | return event.view;
|
10128 | }
|
10129 |
|
10130 | var target = getEventTarget(event);
|
10131 | if (target != null && target.window === target) {
|
10132 | // target is a window object
|
10133 | return target;
|
10134 | }
|
10135 |
|
10136 | var doc = target.ownerDocument;
|
10137 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
|
10138 | if (doc) {
|
10139 | return doc.defaultView || doc.parentWindow;
|
10140 | } else {
|
10141 | return window;
|
10142 | }
|
10143 | },
|
10144 | detail: function (event) {
|
10145 | return event.detail || 0;
|
10146 | }
|
10147 | };
|
10148 |
|
10149 | /**
|
10150 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
10151 | * @param {string} dispatchMarker Marker identifying the event target.
|
10152 | * @param {object} nativeEvent Native browser event.
|
10153 | * @extends {SyntheticEvent}
|
10154 | */
|
10155 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
10156 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
10157 | }
|
10158 |
|
10159 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
|
10160 |
|
10161 | module.exports = SyntheticUIEvent;
|
10162 |
|
10163 | /***/ },
|
10164 | /* 87 */
|
10165 | /***/ function(module, exports) {
|
10166 |
|
10167 | /**
|
10168 | * Copyright 2013-2015, Facebook, Inc.
|
10169 | * All rights reserved.
|
10170 | *
|
10171 | * This source code is licensed under the BSD-style license found in the
|
10172 | * LICENSE file in the root directory of this source tree. An additional grant
|
10173 | * of patent rights can be found in the PATENTS file in the same directory.
|
10174 | *
|
10175 | * @providesModule getEventModifierState
|
10176 | * @typechecks static-only
|
10177 | */
|
10178 |
|
10179 | 'use strict';
|
10180 |
|
10181 | /**
|
10182 | * Translation from modifier key to the associated property in the event.
|
10183 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
10184 | */
|
10185 |
|
10186 | var modifierKeyToProp = {
|
10187 | 'Alt': 'altKey',
|
10188 | 'Control': 'ctrlKey',
|
10189 | 'Meta': 'metaKey',
|
10190 | 'Shift': 'shiftKey'
|
10191 | };
|
10192 |
|
10193 | // IE8 does not implement getModifierState so we simply map it to the only
|
10194 | // modifier keys exposed by the event itself, does not support Lock-keys.
|
10195 | // Currently, all major browsers except Chrome seems to support Lock-keys.
|
10196 | function modifierStateGetter(keyArg) {
|
10197 | var syntheticEvent = this;
|
10198 | var nativeEvent = syntheticEvent.nativeEvent;
|
10199 | if (nativeEvent.getModifierState) {
|
10200 | return nativeEvent.getModifierState(keyArg);
|
10201 | }
|
10202 | var keyProp = modifierKeyToProp[keyArg];
|
10203 | return keyProp ? !!nativeEvent[keyProp] : false;
|
10204 | }
|
10205 |
|
10206 | function getEventModifierState(nativeEvent) {
|
10207 | return modifierStateGetter;
|
10208 | }
|
10209 |
|
10210 | module.exports = getEventModifierState;
|
10211 |
|
10212 | /***/ },
|
10213 | /* 88 */
|
10214 | /***/ function(module, exports, __webpack_require__) {
|
10215 |
|
10216 | /**
|
10217 | * Copyright 2013-2015, Facebook, Inc.
|
10218 | * All rights reserved.
|
10219 | *
|
10220 | * This source code is licensed under the BSD-style license found in the
|
10221 | * LICENSE file in the root directory of this source tree. An additional grant
|
10222 | * of patent rights can be found in the PATENTS file in the same directory.
|
10223 | *
|
10224 | * @providesModule HTMLDOMPropertyConfig
|
10225 | */
|
10226 |
|
10227 | 'use strict';
|
10228 |
|
10229 | var DOMProperty = __webpack_require__(22);
|
10230 | var ExecutionEnvironment = __webpack_require__(8);
|
10231 |
|
10232 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
10233 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
10234 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
|
10235 | var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
10236 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
10237 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
10238 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
10239 |
|
10240 | var hasSVG;
|
10241 | if (ExecutionEnvironment.canUseDOM) {
|
10242 | var implementation = document.implementation;
|
10243 | hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
|
10244 | }
|
10245 |
|
10246 | var HTMLDOMPropertyConfig = {
|
10247 | isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
|
10248 | Properties: {
|
10249 | /**
|
10250 | * Standard Properties
|
10251 | */
|
10252 | accept: null,
|
10253 | acceptCharset: null,
|
10254 | accessKey: null,
|
10255 | action: null,
|
10256 | allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10257 | allowTransparency: MUST_USE_ATTRIBUTE,
|
10258 | alt: null,
|
10259 | async: HAS_BOOLEAN_VALUE,
|
10260 | autoComplete: null,
|
10261 | // autoFocus is polyfilled/normalized by AutoFocusUtils
|
10262 | // autoFocus: HAS_BOOLEAN_VALUE,
|
10263 | autoPlay: HAS_BOOLEAN_VALUE,
|
10264 | capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10265 | cellPadding: null,
|
10266 | cellSpacing: null,
|
10267 | charSet: MUST_USE_ATTRIBUTE,
|
10268 | challenge: MUST_USE_ATTRIBUTE,
|
10269 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10270 | classID: MUST_USE_ATTRIBUTE,
|
10271 | // To set className on SVG elements, it's necessary to use .setAttribute;
|
10272 | // this works on HTML elements too in all browsers except IE8. Conveniently,
|
10273 | // IE8 doesn't support SVG and so we can simply use the attribute in
|
10274 | // browsers that support SVG and the property in browsers that don't,
|
10275 | // regardless of whether the element is HTML or SVG.
|
10276 | className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
|
10277 | cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10278 | colSpan: null,
|
10279 | content: null,
|
10280 | contentEditable: null,
|
10281 | contextMenu: MUST_USE_ATTRIBUTE,
|
10282 | controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10283 | coords: null,
|
10284 | crossOrigin: null,
|
10285 | data: null, // For `<object />` acts as `src`.
|
10286 | dateTime: MUST_USE_ATTRIBUTE,
|
10287 | 'default': HAS_BOOLEAN_VALUE,
|
10288 | defer: HAS_BOOLEAN_VALUE,
|
10289 | dir: null,
|
10290 | disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10291 | download: HAS_OVERLOADED_BOOLEAN_VALUE,
|
10292 | draggable: null,
|
10293 | encType: null,
|
10294 | form: MUST_USE_ATTRIBUTE,
|
10295 | formAction: MUST_USE_ATTRIBUTE,
|
10296 | formEncType: MUST_USE_ATTRIBUTE,
|
10297 | formMethod: MUST_USE_ATTRIBUTE,
|
10298 | formNoValidate: HAS_BOOLEAN_VALUE,
|
10299 | formTarget: MUST_USE_ATTRIBUTE,
|
10300 | frameBorder: MUST_USE_ATTRIBUTE,
|
10301 | headers: null,
|
10302 | height: MUST_USE_ATTRIBUTE,
|
10303 | hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10304 | high: null,
|
10305 | href: null,
|
10306 | hrefLang: null,
|
10307 | htmlFor: null,
|
10308 | httpEquiv: null,
|
10309 | icon: null,
|
10310 | id: MUST_USE_PROPERTY,
|
10311 | inputMode: MUST_USE_ATTRIBUTE,
|
10312 | integrity: null,
|
10313 | is: MUST_USE_ATTRIBUTE,
|
10314 | keyParams: MUST_USE_ATTRIBUTE,
|
10315 | keyType: MUST_USE_ATTRIBUTE,
|
10316 | kind: null,
|
10317 | label: null,
|
10318 | lang: null,
|
10319 | list: MUST_USE_ATTRIBUTE,
|
10320 | loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10321 | low: null,
|
10322 | manifest: MUST_USE_ATTRIBUTE,
|
10323 | marginHeight: null,
|
10324 | marginWidth: null,
|
10325 | max: null,
|
10326 | maxLength: MUST_USE_ATTRIBUTE,
|
10327 | media: MUST_USE_ATTRIBUTE,
|
10328 | mediaGroup: null,
|
10329 | method: null,
|
10330 | min: null,
|
10331 | minLength: MUST_USE_ATTRIBUTE,
|
10332 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10333 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10334 | name: null,
|
10335 | nonce: MUST_USE_ATTRIBUTE,
|
10336 | noValidate: HAS_BOOLEAN_VALUE,
|
10337 | open: HAS_BOOLEAN_VALUE,
|
10338 | optimum: null,
|
10339 | pattern: null,
|
10340 | placeholder: null,
|
10341 | poster: null,
|
10342 | preload: null,
|
10343 | radioGroup: null,
|
10344 | readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10345 | rel: null,
|
10346 | required: HAS_BOOLEAN_VALUE,
|
10347 | reversed: HAS_BOOLEAN_VALUE,
|
10348 | role: MUST_USE_ATTRIBUTE,
|
10349 | rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10350 | rowSpan: null,
|
10351 | sandbox: null,
|
10352 | scope: null,
|
10353 | scoped: HAS_BOOLEAN_VALUE,
|
10354 | scrolling: null,
|
10355 | seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10356 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10357 | shape: null,
|
10358 | size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10359 | sizes: MUST_USE_ATTRIBUTE,
|
10360 | span: HAS_POSITIVE_NUMERIC_VALUE,
|
10361 | spellCheck: null,
|
10362 | src: null,
|
10363 | srcDoc: MUST_USE_PROPERTY,
|
10364 | srcLang: null,
|
10365 | srcSet: MUST_USE_ATTRIBUTE,
|
10366 | start: HAS_NUMERIC_VALUE,
|
10367 | step: null,
|
10368 | style: null,
|
10369 | summary: null,
|
10370 | tabIndex: null,
|
10371 | target: null,
|
10372 | title: null,
|
10373 | type: null,
|
10374 | useMap: null,
|
10375 | value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
|
10376 | width: MUST_USE_ATTRIBUTE,
|
10377 | wmode: MUST_USE_ATTRIBUTE,
|
10378 | wrap: null,
|
10379 |
|
10380 | /**
|
10381 | * RDFa Properties
|
10382 | */
|
10383 | about: MUST_USE_ATTRIBUTE,
|
10384 | datatype: MUST_USE_ATTRIBUTE,
|
10385 | inlist: MUST_USE_ATTRIBUTE,
|
10386 | prefix: MUST_USE_ATTRIBUTE,
|
10387 | // property is also supported for OpenGraph in meta tags.
|
10388 | property: MUST_USE_ATTRIBUTE,
|
10389 | resource: MUST_USE_ATTRIBUTE,
|
10390 | 'typeof': MUST_USE_ATTRIBUTE,
|
10391 | vocab: MUST_USE_ATTRIBUTE,
|
10392 |
|
10393 | /**
|
10394 | * Non-standard Properties
|
10395 | */
|
10396 | // autoCapitalize and autoCorrect are supported in Mobile Safari for
|
10397 | // keyboard hints.
|
10398 | autoCapitalize: MUST_USE_ATTRIBUTE,
|
10399 | autoCorrect: MUST_USE_ATTRIBUTE,
|
10400 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads
|
10401 | autoSave: null,
|
10402 | // color is for Safari mask-icon link
|
10403 | color: null,
|
10404 | // itemProp, itemScope, itemType are for
|
10405 | // Microdata support. See http://schema.org/docs/gs.html
|
10406 | itemProp: MUST_USE_ATTRIBUTE,
|
10407 | itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10408 | itemType: MUST_USE_ATTRIBUTE,
|
10409 | // itemID and itemRef are for Microdata support as well but
|
10410 | // only specified in the the WHATWG spec document. See
|
10411 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
|
10412 | itemID: MUST_USE_ATTRIBUTE,
|
10413 | itemRef: MUST_USE_ATTRIBUTE,
|
10414 | // results show looking glass icon and recent searches on input
|
10415 | // search fields in WebKit/Blink
|
10416 | results: null,
|
10417 | // IE-only attribute that specifies security restrictions on an iframe
|
10418 | // as an alternative to the sandbox attribute on IE<10
|
10419 | security: MUST_USE_ATTRIBUTE,
|
10420 | // IE-only attribute that controls focus behavior
|
10421 | unselectable: MUST_USE_ATTRIBUTE
|
10422 | },
|
10423 | DOMAttributeNames: {
|
10424 | acceptCharset: 'accept-charset',
|
10425 | className: 'class',
|
10426 | htmlFor: 'for',
|
10427 | httpEquiv: 'http-equiv'
|
10428 | },
|
10429 | DOMPropertyNames: {
|
10430 | autoComplete: 'autocomplete',
|
10431 | autoFocus: 'autofocus',
|
10432 | autoPlay: 'autoplay',
|
10433 | autoSave: 'autosave',
|
10434 | // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
|
10435 | // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
|
10436 | encType: 'encoding',
|
10437 | hrefLang: 'hreflang',
|
10438 | radioGroup: 'radiogroup',
|
10439 | spellCheck: 'spellcheck',
|
10440 | srcDoc: 'srcdoc',
|
10441 | srcSet: 'srcset'
|
10442 | }
|
10443 | };
|
10444 |
|
10445 | module.exports = HTMLDOMPropertyConfig;
|
10446 |
|
10447 | /***/ },
|
10448 | /* 89 */
|
10449 | /***/ function(module, exports, __webpack_require__) {
|
10450 |
|
10451 | /**
|
10452 | * Copyright 2013-2015, Facebook, Inc.
|
10453 | * All rights reserved.
|
10454 | *
|
10455 | * This source code is licensed under the BSD-style license found in the
|
10456 | * LICENSE file in the root directory of this source tree. An additional grant
|
10457 | * of patent rights can be found in the PATENTS file in the same directory.
|
10458 | *
|
10459 | * @providesModule ReactBrowserComponentMixin
|
10460 | */
|
10461 |
|
10462 | 'use strict';
|
10463 |
|
10464 | var ReactInstanceMap = __webpack_require__(46);
|
10465 |
|
10466 | var findDOMNode = __webpack_require__(90);
|
10467 | var warning = __webpack_require__(24);
|
10468 |
|
10469 | var didWarnKey = '_getDOMNodeDidWarn';
|
10470 |
|
10471 | var ReactBrowserComponentMixin = {
|
10472 | /**
|
10473 | * Returns the DOM node rendered by this component.
|
10474 | *
|
10475 | * @return {DOMElement} The root node of this component.
|
10476 | * @final
|
10477 | * @protected
|
10478 | */
|
10479 | getDOMNode: function () {
|
10480 | true ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
|
10481 | this.constructor[didWarnKey] = true;
|
10482 | return findDOMNode(this);
|
10483 | }
|
10484 | };
|
10485 |
|
10486 | module.exports = ReactBrowserComponentMixin;
|
10487 |
|
10488 | /***/ },
|
10489 | /* 90 */
|
10490 | /***/ function(module, exports, __webpack_require__) {
|
10491 |
|
10492 | /**
|
10493 | * Copyright 2013-2015, Facebook, Inc.
|
10494 | * All rights reserved.
|
10495 | *
|
10496 | * This source code is licensed under the BSD-style license found in the
|
10497 | * LICENSE file in the root directory of this source tree. An additional grant
|
10498 | * of patent rights can be found in the PATENTS file in the same directory.
|
10499 | *
|
10500 | * @providesModule findDOMNode
|
10501 | * @typechecks static-only
|
10502 | */
|
10503 |
|
10504 | 'use strict';
|
10505 |
|
10506 | var ReactCurrentOwner = __webpack_require__(4);
|
10507 | var ReactInstanceMap = __webpack_require__(46);
|
10508 | var ReactMount = __webpack_require__(27);
|
10509 |
|
10510 | var invariant = __webpack_require__(12);
|
10511 | var warning = __webpack_require__(24);
|
10512 |
|
10513 | /**
|
10514 | * Returns the DOM node rendered by this element.
|
10515 | *
|
10516 | * @param {ReactComponent|DOMElement} componentOrElement
|
10517 | * @return {?DOMElement} The root node of this element.
|
10518 | */
|
10519 | function findDOMNode(componentOrElement) {
|
10520 | if (true) {
|
10521 | var owner = ReactCurrentOwner.current;
|
10522 | if (owner !== null) {
|
10523 | true ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
|
10524 | owner._warnedAboutRefsInRender = true;
|
10525 | }
|
10526 | }
|
10527 | if (componentOrElement == null) {
|
10528 | return null;
|
10529 | }
|
10530 | if (componentOrElement.nodeType === 1) {
|
10531 | return componentOrElement;
|
10532 | }
|
10533 | if (ReactInstanceMap.has(componentOrElement)) {
|
10534 | return ReactMount.getNodeFromInstance(componentOrElement);
|
10535 | }
|
10536 | !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? true ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
|
10537 | true ? true ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
10538 | }
|
10539 |
|
10540 | module.exports = findDOMNode;
|
10541 |
|
10542 | /***/ },
|
10543 | /* 91 */
|
10544 | /***/ function(module, exports, __webpack_require__) {
|
10545 |
|
10546 | /**
|
10547 | * Copyright 2013-2015, Facebook, Inc.
|
10548 | * All rights reserved.
|
10549 | *
|
10550 | * This source code is licensed under the BSD-style license found in the
|
10551 | * LICENSE file in the root directory of this source tree. An additional grant
|
10552 | * of patent rights can be found in the PATENTS file in the same directory.
|
10553 | *
|
10554 | * @providesModule ReactDefaultBatchingStrategy
|
10555 | */
|
10556 |
|
10557 | 'use strict';
|
10558 |
|
10559 | var ReactUpdates = __webpack_require__(53);
|
10560 | var Transaction = __webpack_require__(56);
|
10561 |
|
10562 | var assign = __webpack_require__(38);
|
10563 | var emptyFunction = __webpack_require__(14);
|
10564 |
|
10565 | var RESET_BATCHED_UPDATES = {
|
10566 | initialize: emptyFunction,
|
10567 | close: function () {
|
10568 | ReactDefaultBatchingStrategy.isBatchingUpdates = false;
|
10569 | }
|
10570 | };
|
10571 |
|
10572 | var FLUSH_BATCHED_UPDATES = {
|
10573 | initialize: emptyFunction,
|
10574 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
|
10575 | };
|
10576 |
|
10577 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
|
10578 |
|
10579 | function ReactDefaultBatchingStrategyTransaction() {
|
10580 | this.reinitializeTransaction();
|
10581 | }
|
10582 |
|
10583 | assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
|
10584 | getTransactionWrappers: function () {
|
10585 | return TRANSACTION_WRAPPERS;
|
10586 | }
|
10587 | });
|
10588 |
|
10589 | var transaction = new ReactDefaultBatchingStrategyTransaction();
|
10590 |
|
10591 | var ReactDefaultBatchingStrategy = {
|
10592 | isBatchingUpdates: false,
|
10593 |
|
10594 | /**
|
10595 | * Call the provided function in a context within which calls to `setState`
|
10596 | * and friends are batched such that components aren't updated unnecessarily.
|
10597 | */
|
10598 | batchedUpdates: function (callback, a, b, c, d, e) {
|
10599 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
|
10600 |
|
10601 | ReactDefaultBatchingStrategy.isBatchingUpdates = true;
|
10602 |
|
10603 | // The code is written this way to avoid extra allocations
|
10604 | if (alreadyBatchingUpdates) {
|
10605 | callback(a, b, c, d, e);
|
10606 | } else {
|
10607 | transaction.perform(callback, null, a, b, c, d, e);
|
10608 | }
|
10609 | }
|
10610 | };
|
10611 |
|
10612 | module.exports = ReactDefaultBatchingStrategy;
|
10613 |
|
10614 | /***/ },
|
10615 | /* 92 */
|
10616 | /***/ function(module, exports, __webpack_require__) {
|
10617 |
|
10618 | /**
|
10619 | * Copyright 2013-2015, Facebook, Inc.
|
10620 | * All rights reserved.
|
10621 | *
|
10622 | * This source code is licensed under the BSD-style license found in the
|
10623 | * LICENSE file in the root directory of this source tree. An additional grant
|
10624 | * of patent rights can be found in the PATENTS file in the same directory.
|
10625 | *
|
10626 | * @providesModule ReactDOMComponent
|
10627 | * @typechecks static-only
|
10628 | */
|
10629 |
|
10630 | /* global hasOwnProperty:true */
|
10631 |
|
10632 | 'use strict';
|
10633 |
|
10634 | var AutoFocusUtils = __webpack_require__(93);
|
10635 | var CSSPropertyOperations = __webpack_require__(95);
|
10636 | var DOMProperty = __webpack_require__(22);
|
10637 | var DOMPropertyOperations = __webpack_require__(21);
|
10638 | var EventConstants = __webpack_require__(29);
|
10639 | var ReactBrowserEventEmitter = __webpack_require__(28);
|
10640 | var ReactComponentBrowserEnvironment = __webpack_require__(25);
|
10641 | var ReactDOMButton = __webpack_require__(103);
|
10642 | var ReactDOMInput = __webpack_require__(104);
|
10643 | var ReactDOMOption = __webpack_require__(108);
|
10644 | var ReactDOMSelect = __webpack_require__(111);
|
10645 | var ReactDOMTextarea = __webpack_require__(112);
|
10646 | var ReactMount = __webpack_require__(27);
|
10647 | var ReactMultiChild = __webpack_require__(113);
|
10648 | var ReactPerf = __webpack_require__(17);
|
10649 | var ReactUpdateQueue = __webpack_require__(52);
|
10650 |
|
10651 | var assign = __webpack_require__(38);
|
10652 | var canDefineProperty = __webpack_require__(42);
|
10653 | var escapeTextContentForBrowser = __webpack_require__(20);
|
10654 | var invariant = __webpack_require__(12);
|
10655 | var isEventSupported = __webpack_require__(39);
|
10656 | var keyOf = __webpack_require__(78);
|
10657 | var setInnerHTML = __webpack_require__(18);
|
10658 | var setTextContent = __webpack_require__(19);
|
10659 | var shallowEqual = __webpack_require__(116);
|
10660 | var validateDOMNesting = __webpack_require__(69);
|
10661 | var warning = __webpack_require__(24);
|
10662 |
|
10663 | var deleteListener = ReactBrowserEventEmitter.deleteListener;
|
10664 | var listenTo = ReactBrowserEventEmitter.listenTo;
|
10665 | var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
|
10666 |
|
10667 | // For quickly matching children type, to test if can be treated as content.
|
10668 | var CONTENT_TYPES = { 'string': true, 'number': true };
|
10669 |
|
10670 | var CHILDREN = keyOf({ children: null });
|
10671 | var STYLE = keyOf({ style: null });
|
10672 | var HTML = keyOf({ __html: null });
|
10673 |
|
10674 | var ELEMENT_NODE_TYPE = 1;
|
10675 |
|
10676 | function getDeclarationErrorAddendum(internalInstance) {
|
10677 | if (internalInstance) {
|
10678 | var owner = internalInstance._currentElement._owner || null;
|
10679 | if (owner) {
|
10680 | var name = owner.getName();
|
10681 | if (name) {
|
10682 | return ' This DOM node was rendered by `' + name + '`.';
|
10683 | }
|
10684 | }
|
10685 | }
|
10686 | return '';
|
10687 | }
|
10688 |
|
10689 | var legacyPropsDescriptor;
|
10690 | if (true) {
|
10691 | legacyPropsDescriptor = {
|
10692 | props: {
|
10693 | enumerable: false,
|
10694 | get: function () {
|
10695 | var component = this._reactInternalComponent;
|
10696 | true ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
|
10697 | return component._currentElement.props;
|
10698 | }
|
10699 | }
|
10700 | };
|
10701 | }
|
10702 |
|
10703 | function legacyGetDOMNode() {
|
10704 | if (true) {
|
10705 | var component = this._reactInternalComponent;
|
10706 | true ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10707 | }
|
10708 | return this;
|
10709 | }
|
10710 |
|
10711 | function legacyIsMounted() {
|
10712 | var component = this._reactInternalComponent;
|
10713 | if (true) {
|
10714 | true ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10715 | }
|
10716 | return !!component;
|
10717 | }
|
10718 |
|
10719 | function legacySetStateEtc() {
|
10720 | if (true) {
|
10721 | var component = this._reactInternalComponent;
|
10722 | true ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10723 | }
|
10724 | }
|
10725 |
|
10726 | function legacySetProps(partialProps, callback) {
|
10727 | var component = this._reactInternalComponent;
|
10728 | if (true) {
|
10729 | true ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10730 | }
|
10731 | if (!component) {
|
10732 | return;
|
10733 | }
|
10734 | ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
|
10735 | if (callback) {
|
10736 | ReactUpdateQueue.enqueueCallbackInternal(component, callback);
|
10737 | }
|
10738 | }
|
10739 |
|
10740 | function legacyReplaceProps(partialProps, callback) {
|
10741 | var component = this._reactInternalComponent;
|
10742 | if (true) {
|
10743 | true ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10744 | }
|
10745 | if (!component) {
|
10746 | return;
|
10747 | }
|
10748 | ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
|
10749 | if (callback) {
|
10750 | ReactUpdateQueue.enqueueCallbackInternal(component, callback);
|
10751 | }
|
10752 | }
|
10753 |
|
10754 | function friendlyStringify(obj) {
|
10755 | if (typeof obj === 'object') {
|
10756 | if (Array.isArray(obj)) {
|
10757 | return '[' + obj.map(friendlyStringify).join(', ') + ']';
|
10758 | } else {
|
10759 | var pairs = [];
|
10760 | for (var key in obj) {
|
10761 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
10762 | var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
|
10763 | pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
|
10764 | }
|
10765 | }
|
10766 | return '{' + pairs.join(', ') + '}';
|
10767 | }
|
10768 | } else if (typeof obj === 'string') {
|
10769 | return JSON.stringify(obj);
|
10770 | } else if (typeof obj === 'function') {
|
10771 | return '[function object]';
|
10772 | }
|
10773 | // Differs from JSON.stringify in that undefined becauses undefined and that
|
10774 | // inf and nan don't become null
|
10775 | return String(obj);
|
10776 | }
|
10777 |
|
10778 | var styleMutationWarning = {};
|
10779 |
|
10780 | function checkAndWarnForMutatedStyle(style1, style2, component) {
|
10781 | if (style1 == null || style2 == null) {
|
10782 | return;
|
10783 | }
|
10784 | if (shallowEqual(style1, style2)) {
|
10785 | return;
|
10786 | }
|
10787 |
|
10788 | var componentName = component._tag;
|
10789 | var owner = component._currentElement._owner;
|
10790 | var ownerName;
|
10791 | if (owner) {
|
10792 | ownerName = owner.getName();
|
10793 | }
|
10794 |
|
10795 | var hash = ownerName + '|' + componentName;
|
10796 |
|
10797 | if (styleMutationWarning.hasOwnProperty(hash)) {
|
10798 | return;
|
10799 | }
|
10800 |
|
10801 | styleMutationWarning[hash] = true;
|
10802 |
|
10803 | true ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
|
10804 | }
|
10805 |
|
10806 | /**
|
10807 | * @param {object} component
|
10808 | * @param {?object} props
|
10809 | */
|
10810 | function assertValidProps(component, props) {
|
10811 | if (!props) {
|
10812 | return;
|
10813 | }
|
10814 | // Note the use of `==` which checks for null or undefined.
|
10815 | if (true) {
|
10816 | if (voidElementTags[component._tag]) {
|
10817 | true ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
|
10818 | }
|
10819 | }
|
10820 | if (props.dangerouslySetInnerHTML != null) {
|
10821 | !(props.children == null) ? true ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
|
10822 | !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? true ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
|
10823 | }
|
10824 | if (true) {
|
10825 | true ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
|
10826 | true ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
|
10827 | }
|
10828 | !(props.style == null || typeof props.style === 'object') ? true ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
|
10829 | }
|
10830 |
|
10831 | function enqueuePutListener(id, registrationName, listener, transaction) {
|
10832 | if (true) {
|
10833 | // IE8 has no API for event capturing and the `onScroll` event doesn't
|
10834 | // bubble.
|
10835 | true ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
|
10836 | }
|
10837 | var container = ReactMount.findReactContainerForID(id);
|
10838 | if (container) {
|
10839 | var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
|
10840 | listenTo(registrationName, doc);
|
10841 | }
|
10842 | transaction.getReactMountReady().enqueue(putListener, {
|
10843 | id: id,
|
10844 | registrationName: registrationName,
|
10845 | listener: listener
|
10846 | });
|
10847 | }
|
10848 |
|
10849 | function putListener() {
|
10850 | var listenerToPut = this;
|
10851 | ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
|
10852 | }
|
10853 |
|
10854 | // There are so many media events, it makes sense to just
|
10855 | // maintain a list rather than create a `trapBubbledEvent` for each
|
10856 | var mediaEvents = {
|
10857 | topAbort: 'abort',
|
10858 | topCanPlay: 'canplay',
|
10859 | topCanPlayThrough: 'canplaythrough',
|
10860 | topDurationChange: 'durationchange',
|
10861 | topEmptied: 'emptied',
|
10862 | topEncrypted: 'encrypted',
|
10863 | topEnded: 'ended',
|
10864 | topError: 'error',
|
10865 | topLoadedData: 'loadeddata',
|
10866 | topLoadedMetadata: 'loadedmetadata',
|
10867 | topLoadStart: 'loadstart',
|
10868 | topPause: 'pause',
|
10869 | topPlay: 'play',
|
10870 | topPlaying: 'playing',
|
10871 | topProgress: 'progress',
|
10872 | topRateChange: 'ratechange',
|
10873 | topSeeked: 'seeked',
|
10874 | topSeeking: 'seeking',
|
10875 | topStalled: 'stalled',
|
10876 | topSuspend: 'suspend',
|
10877 | topTimeUpdate: 'timeupdate',
|
10878 | topVolumeChange: 'volumechange',
|
10879 | topWaiting: 'waiting'
|
10880 | };
|
10881 |
|
10882 | function trapBubbledEventsLocal() {
|
10883 | var inst = this;
|
10884 | // If a component renders to null or if another component fatals and causes
|
10885 | // the state of the tree to be corrupted, `node` here can be null.
|
10886 | !inst._rootNodeID ? true ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
|
10887 | var node = ReactMount.getNode(inst._rootNodeID);
|
10888 | !node ? true ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
|
10889 |
|
10890 | switch (inst._tag) {
|
10891 | case 'iframe':
|
10892 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
10893 | break;
|
10894 | case 'video':
|
10895 | case 'audio':
|
10896 |
|
10897 | inst._wrapperState.listeners = [];
|
10898 | // create listener for each media event
|
10899 | for (var event in mediaEvents) {
|
10900 | if (mediaEvents.hasOwnProperty(event)) {
|
10901 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
|
10902 | }
|
10903 | }
|
10904 |
|
10905 | break;
|
10906 | case 'img':
|
10907 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
10908 | break;
|
10909 | case 'form':
|
10910 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
|
10911 | break;
|
10912 | }
|
10913 | }
|
10914 |
|
10915 | function mountReadyInputWrapper() {
|
10916 | ReactDOMInput.mountReadyWrapper(this);
|
10917 | }
|
10918 |
|
10919 | function postUpdateSelectWrapper() {
|
10920 | ReactDOMSelect.postUpdateWrapper(this);
|
10921 | }
|
10922 |
|
10923 | // For HTML, certain tags should omit their close tag. We keep a whitelist for
|
10924 | // those special cased tags.
|
10925 |
|
10926 | var omittedCloseTags = {
|
10927 | 'area': true,
|
10928 | 'base': true,
|
10929 | 'br': true,
|
10930 | 'col': true,
|
10931 | 'embed': true,
|
10932 | 'hr': true,
|
10933 | 'img': true,
|
10934 | 'input': true,
|
10935 | 'keygen': true,
|
10936 | 'link': true,
|
10937 | 'meta': true,
|
10938 | 'param': true,
|
10939 | 'source': true,
|
10940 | 'track': true,
|
10941 | 'wbr': true
|
10942 | };
|
10943 |
|
10944 | // NOTE: menuitem's close tag should be omitted, but that causes problems.
|
10945 | var newlineEatingTags = {
|
10946 | 'listing': true,
|
10947 | 'pre': true,
|
10948 | 'textarea': true
|
10949 | };
|
10950 |
|
10951 | // For HTML, certain tags cannot have children. This has the same purpose as
|
10952 | // `omittedCloseTags` except that `menuitem` should still have its closing tag.
|
10953 |
|
10954 | var voidElementTags = assign({
|
10955 | 'menuitem': true
|
10956 | }, omittedCloseTags);
|
10957 |
|
10958 | // We accept any tag to be rendered but since this gets injected into arbitrary
|
10959 | // HTML, we want to make sure that it's a safe tag.
|
10960 | // http://www.w3.org/TR/REC-xml/#NT-Name
|
10961 |
|
10962 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
10963 | var validatedTagCache = {};
|
10964 | var hasOwnProperty = ({}).hasOwnProperty;
|
10965 |
|
10966 | function validateDangerousTag(tag) {
|
10967 | if (!hasOwnProperty.call(validatedTagCache, tag)) {
|
10968 | !VALID_TAG_REGEX.test(tag) ? true ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
|
10969 | validatedTagCache[tag] = true;
|
10970 | }
|
10971 | }
|
10972 |
|
10973 | function processChildContextDev(context, inst) {
|
10974 | // Pass down our tag name to child components for validation purposes
|
10975 | context = assign({}, context);
|
10976 | var info = context[validateDOMNesting.ancestorInfoContextKey];
|
10977 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
|
10978 | return context;
|
10979 | }
|
10980 |
|
10981 | function isCustomComponent(tagName, props) {
|
10982 | return tagName.indexOf('-') >= 0 || props.is != null;
|
10983 | }
|
10984 |
|
10985 | /**
|
10986 | * Creates a new React class that is idempotent and capable of containing other
|
10987 | * React components. It accepts event listeners and DOM properties that are
|
10988 | * valid according to `DOMProperty`.
|
10989 | *
|
10990 | * - Event listeners: `onClick`, `onMouseDown`, etc.
|
10991 | * - DOM properties: `className`, `name`, `title`, etc.
|
10992 | *
|
10993 | * The `style` property functions differently from the DOM API. It accepts an
|
10994 | * object mapping of style properties to values.
|
10995 | *
|
10996 | * @constructor ReactDOMComponent
|
10997 | * @extends ReactMultiChild
|
10998 | */
|
10999 | function ReactDOMComponent(tag) {
|
11000 | validateDangerousTag(tag);
|
11001 | this._tag = tag.toLowerCase();
|
11002 | this._renderedChildren = null;
|
11003 | this._previousStyle = null;
|
11004 | this._previousStyleCopy = null;
|
11005 | this._rootNodeID = null;
|
11006 | this._wrapperState = null;
|
11007 | this._topLevelWrapper = null;
|
11008 | this._nodeWithLegacyProperties = null;
|
11009 | if (true) {
|
11010 | this._unprocessedContextDev = null;
|
11011 | this._processedContextDev = null;
|
11012 | }
|
11013 | }
|
11014 |
|
11015 | ReactDOMComponent.displayName = 'ReactDOMComponent';
|
11016 |
|
11017 | ReactDOMComponent.Mixin = {
|
11018 |
|
11019 | construct: function (element) {
|
11020 | this._currentElement = element;
|
11021 | },
|
11022 |
|
11023 | /**
|
11024 | * Generates root tag markup then recurses. This method has side effects and
|
11025 | * is not idempotent.
|
11026 | *
|
11027 | * @internal
|
11028 | * @param {string} rootID The root DOM ID for this node.
|
11029 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11030 | * @param {object} context
|
11031 | * @return {string} The computed markup.
|
11032 | */
|
11033 | mountComponent: function (rootID, transaction, context) {
|
11034 | this._rootNodeID = rootID;
|
11035 |
|
11036 | var props = this._currentElement.props;
|
11037 |
|
11038 | switch (this._tag) {
|
11039 | case 'iframe':
|
11040 | case 'img':
|
11041 | case 'form':
|
11042 | case 'video':
|
11043 | case 'audio':
|
11044 | this._wrapperState = {
|
11045 | listeners: null
|
11046 | };
|
11047 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
|
11048 | break;
|
11049 | case 'button':
|
11050 | props = ReactDOMButton.getNativeProps(this, props, context);
|
11051 | break;
|
11052 | case 'input':
|
11053 | ReactDOMInput.mountWrapper(this, props, context);
|
11054 | props = ReactDOMInput.getNativeProps(this, props, context);
|
11055 | break;
|
11056 | case 'option':
|
11057 | ReactDOMOption.mountWrapper(this, props, context);
|
11058 | props = ReactDOMOption.getNativeProps(this, props, context);
|
11059 | break;
|
11060 | case 'select':
|
11061 | ReactDOMSelect.mountWrapper(this, props, context);
|
11062 | props = ReactDOMSelect.getNativeProps(this, props, context);
|
11063 | context = ReactDOMSelect.processChildContext(this, props, context);
|
11064 | break;
|
11065 | case 'textarea':
|
11066 | ReactDOMTextarea.mountWrapper(this, props, context);
|
11067 | props = ReactDOMTextarea.getNativeProps(this, props, context);
|
11068 | break;
|
11069 | }
|
11070 |
|
11071 | assertValidProps(this, props);
|
11072 | if (true) {
|
11073 | if (context[validateDOMNesting.ancestorInfoContextKey]) {
|
11074 | validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
|
11075 | }
|
11076 | }
|
11077 |
|
11078 | if (true) {
|
11079 | this._unprocessedContextDev = context;
|
11080 | this._processedContextDev = processChildContextDev(context, this);
|
11081 | context = this._processedContextDev;
|
11082 | }
|
11083 |
|
11084 | var mountImage;
|
11085 | if (transaction.useCreateElement) {
|
11086 | var ownerDocument = context[ReactMount.ownerDocumentContextKey];
|
11087 | var el = ownerDocument.createElement(this._currentElement.type);
|
11088 | DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
|
11089 | // Populate node cache
|
11090 | ReactMount.getID(el);
|
11091 | this._updateDOMProperties({}, props, transaction, el);
|
11092 | this._createInitialChildren(transaction, props, context, el);
|
11093 | mountImage = el;
|
11094 | } else {
|
11095 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
|
11096 | var tagContent = this._createContentMarkup(transaction, props, context);
|
11097 | if (!tagContent && omittedCloseTags[this._tag]) {
|
11098 | mountImage = tagOpen + '/>';
|
11099 | } else {
|
11100 | mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
|
11101 | }
|
11102 | }
|
11103 |
|
11104 | switch (this._tag) {
|
11105 | case 'input':
|
11106 | transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
|
11107 | // falls through
|
11108 | case 'button':
|
11109 | case 'select':
|
11110 | case 'textarea':
|
11111 | if (props.autoFocus) {
|
11112 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
|
11113 | }
|
11114 | break;
|
11115 | }
|
11116 |
|
11117 | return mountImage;
|
11118 | },
|
11119 |
|
11120 | /**
|
11121 | * Creates markup for the open tag and all attributes.
|
11122 | *
|
11123 | * This method has side effects because events get registered.
|
11124 | *
|
11125 | * Iterating over object properties is faster than iterating over arrays.
|
11126 | * @see http://jsperf.com/obj-vs-arr-iteration
|
11127 | *
|
11128 | * @private
|
11129 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11130 | * @param {object} props
|
11131 | * @return {string} Markup of opening tag.
|
11132 | */
|
11133 | _createOpenTagMarkupAndPutListeners: function (transaction, props) {
|
11134 | var ret = '<' + this._currentElement.type;
|
11135 |
|
11136 | for (var propKey in props) {
|
11137 | if (!props.hasOwnProperty(propKey)) {
|
11138 | continue;
|
11139 | }
|
11140 | var propValue = props[propKey];
|
11141 | if (propValue == null) {
|
11142 | continue;
|
11143 | }
|
11144 | if (registrationNameModules.hasOwnProperty(propKey)) {
|
11145 | if (propValue) {
|
11146 | enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
|
11147 | }
|
11148 | } else {
|
11149 | if (propKey === STYLE) {
|
11150 | if (propValue) {
|
11151 | if (true) {
|
11152 | // See `_updateDOMProperties`. style block
|
11153 | this._previousStyle = propValue;
|
11154 | }
|
11155 | propValue = this._previousStyleCopy = assign({}, props.style);
|
11156 | }
|
11157 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
|
11158 | }
|
11159 | var markup = null;
|
11160 | if (this._tag != null && isCustomComponent(this._tag, props)) {
|
11161 | if (propKey !== CHILDREN) {
|
11162 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
|
11163 | }
|
11164 | } else {
|
11165 | markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
|
11166 | }
|
11167 | if (markup) {
|
11168 | ret += ' ' + markup;
|
11169 | }
|
11170 | }
|
11171 | }
|
11172 |
|
11173 | // For static pages, no need to put React ID and checksum. Saves lots of
|
11174 | // bytes.
|
11175 | if (transaction.renderToStaticMarkup) {
|
11176 | return ret;
|
11177 | }
|
11178 |
|
11179 | var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
|
11180 | return ret + ' ' + markupForID;
|
11181 | },
|
11182 |
|
11183 | /**
|
11184 | * Creates markup for the content between the tags.
|
11185 | *
|
11186 | * @private
|
11187 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11188 | * @param {object} props
|
11189 | * @param {object} context
|
11190 | * @return {string} Content markup.
|
11191 | */
|
11192 | _createContentMarkup: function (transaction, props, context) {
|
11193 | var ret = '';
|
11194 |
|
11195 | // Intentional use of != to avoid catching zero/false.
|
11196 | var innerHTML = props.dangerouslySetInnerHTML;
|
11197 | if (innerHTML != null) {
|
11198 | if (innerHTML.__html != null) {
|
11199 | ret = innerHTML.__html;
|
11200 | }
|
11201 | } else {
|
11202 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
11203 | var childrenToUse = contentToUse != null ? null : props.children;
|
11204 | if (contentToUse != null) {
|
11205 | // TODO: Validate that text is allowed as a child of this node
|
11206 | ret = escapeTextContentForBrowser(contentToUse);
|
11207 | } else if (childrenToUse != null) {
|
11208 | var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
11209 | ret = mountImages.join('');
|
11210 | }
|
11211 | }
|
11212 | if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
|
11213 | // text/html ignores the first character in these tags if it's a newline
|
11214 | // Prefer to break application/xml over text/html (for now) by adding
|
11215 | // a newline specifically to get eaten by the parser. (Alternately for
|
11216 | // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
|
11217 | // \r is normalized out by HTMLTextAreaElement#value.)
|
11218 | // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
|
11219 | // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
|
11220 | // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
|
11221 | // See: Parsing of "textarea" "listing" and "pre" elements
|
11222 | // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
|
11223 | return '\n' + ret;
|
11224 | } else {
|
11225 | return ret;
|
11226 | }
|
11227 | },
|
11228 |
|
11229 | _createInitialChildren: function (transaction, props, context, el) {
|
11230 | // Intentional use of != to avoid catching zero/false.
|
11231 | var innerHTML = props.dangerouslySetInnerHTML;
|
11232 | if (innerHTML != null) {
|
11233 | if (innerHTML.__html != null) {
|
11234 | setInnerHTML(el, innerHTML.__html);
|
11235 | }
|
11236 | } else {
|
11237 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
11238 | var childrenToUse = contentToUse != null ? null : props.children;
|
11239 | if (contentToUse != null) {
|
11240 | // TODO: Validate that text is allowed as a child of this node
|
11241 | setTextContent(el, contentToUse);
|
11242 | } else if (childrenToUse != null) {
|
11243 | var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
11244 | for (var i = 0; i < mountImages.length; i++) {
|
11245 | el.appendChild(mountImages[i]);
|
11246 | }
|
11247 | }
|
11248 | }
|
11249 | },
|
11250 |
|
11251 | /**
|
11252 | * Receives a next element and updates the component.
|
11253 | *
|
11254 | * @internal
|
11255 | * @param {ReactElement} nextElement
|
11256 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11257 | * @param {object} context
|
11258 | */
|
11259 | receiveComponent: function (nextElement, transaction, context) {
|
11260 | var prevElement = this._currentElement;
|
11261 | this._currentElement = nextElement;
|
11262 | this.updateComponent(transaction, prevElement, nextElement, context);
|
11263 | },
|
11264 |
|
11265 | /**
|
11266 | * Updates a native DOM component after it has already been allocated and
|
11267 | * attached to the DOM. Reconciles the root DOM node, then recurses.
|
11268 | *
|
11269 | * @param {ReactReconcileTransaction} transaction
|
11270 | * @param {ReactElement} prevElement
|
11271 | * @param {ReactElement} nextElement
|
11272 | * @internal
|
11273 | * @overridable
|
11274 | */
|
11275 | updateComponent: function (transaction, prevElement, nextElement, context) {
|
11276 | var lastProps = prevElement.props;
|
11277 | var nextProps = this._currentElement.props;
|
11278 |
|
11279 | switch (this._tag) {
|
11280 | case 'button':
|
11281 | lastProps = ReactDOMButton.getNativeProps(this, lastProps);
|
11282 | nextProps = ReactDOMButton.getNativeProps(this, nextProps);
|
11283 | break;
|
11284 | case 'input':
|
11285 | ReactDOMInput.updateWrapper(this);
|
11286 | lastProps = ReactDOMInput.getNativeProps(this, lastProps);
|
11287 | nextProps = ReactDOMInput.getNativeProps(this, nextProps);
|
11288 | break;
|
11289 | case 'option':
|
11290 | lastProps = ReactDOMOption.getNativeProps(this, lastProps);
|
11291 | nextProps = ReactDOMOption.getNativeProps(this, nextProps);
|
11292 | break;
|
11293 | case 'select':
|
11294 | lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
|
11295 | nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
|
11296 | break;
|
11297 | case 'textarea':
|
11298 | ReactDOMTextarea.updateWrapper(this);
|
11299 | lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
|
11300 | nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
|
11301 | break;
|
11302 | }
|
11303 |
|
11304 | if (true) {
|
11305 | // If the context is reference-equal to the old one, pass down the same
|
11306 | // processed object so the update bailout in ReactReconciler behaves
|
11307 | // correctly (and identically in dev and prod). See #5005.
|
11308 | if (this._unprocessedContextDev !== context) {
|
11309 | this._unprocessedContextDev = context;
|
11310 | this._processedContextDev = processChildContextDev(context, this);
|
11311 | }
|
11312 | context = this._processedContextDev;
|
11313 | }
|
11314 |
|
11315 | assertValidProps(this, nextProps);
|
11316 | this._updateDOMProperties(lastProps, nextProps, transaction, null);
|
11317 | this._updateDOMChildren(lastProps, nextProps, transaction, context);
|
11318 |
|
11319 | if (!canDefineProperty && this._nodeWithLegacyProperties) {
|
11320 | this._nodeWithLegacyProperties.props = nextProps;
|
11321 | }
|
11322 |
|
11323 | if (this._tag === 'select') {
|
11324 | // <select> value update needs to occur after <option> children
|
11325 | // reconciliation
|
11326 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
|
11327 | }
|
11328 | },
|
11329 |
|
11330 | /**
|
11331 | * Reconciles the properties by detecting differences in property values and
|
11332 | * updating the DOM as necessary. This function is probably the single most
|
11333 | * critical path for performance optimization.
|
11334 | *
|
11335 | * TODO: Benchmark whether checking for changed values in memory actually
|
11336 | * improves performance (especially statically positioned elements).
|
11337 | * TODO: Benchmark the effects of putting this at the top since 99% of props
|
11338 | * do not change for a given reconciliation.
|
11339 | * TODO: Benchmark areas that can be improved with caching.
|
11340 | *
|
11341 | * @private
|
11342 | * @param {object} lastProps
|
11343 | * @param {object} nextProps
|
11344 | * @param {ReactReconcileTransaction} transaction
|
11345 | * @param {?DOMElement} node
|
11346 | */
|
11347 | _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
|
11348 | var propKey;
|
11349 | var styleName;
|
11350 | var styleUpdates;
|
11351 | for (propKey in lastProps) {
|
11352 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
|
11353 | continue;
|
11354 | }
|
11355 | if (propKey === STYLE) {
|
11356 | var lastStyle = this._previousStyleCopy;
|
11357 | for (styleName in lastStyle) {
|
11358 | if (lastStyle.hasOwnProperty(styleName)) {
|
11359 | styleUpdates = styleUpdates || {};
|
11360 | styleUpdates[styleName] = '';
|
11361 | }
|
11362 | }
|
11363 | this._previousStyleCopy = null;
|
11364 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
11365 | if (lastProps[propKey]) {
|
11366 | // Only call deleteListener if there was a listener previously or
|
11367 | // else willDeleteListener gets called when there wasn't actually a
|
11368 | // listener (e.g., onClick={null})
|
11369 | deleteListener(this._rootNodeID, propKey);
|
11370 | }
|
11371 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
|
11372 | if (!node) {
|
11373 | node = ReactMount.getNode(this._rootNodeID);
|
11374 | }
|
11375 | DOMPropertyOperations.deleteValueForProperty(node, propKey);
|
11376 | }
|
11377 | }
|
11378 | for (propKey in nextProps) {
|
11379 | var nextProp = nextProps[propKey];
|
11380 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
|
11381 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
|
11382 | continue;
|
11383 | }
|
11384 | if (propKey === STYLE) {
|
11385 | if (nextProp) {
|
11386 | if (true) {
|
11387 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
|
11388 | this._previousStyle = nextProp;
|
11389 | }
|
11390 | nextProp = this._previousStyleCopy = assign({}, nextProp);
|
11391 | } else {
|
11392 | this._previousStyleCopy = null;
|
11393 | }
|
11394 | if (lastProp) {
|
11395 | // Unset styles on `lastProp` but not on `nextProp`.
|
11396 | for (styleName in lastProp) {
|
11397 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
|
11398 | styleUpdates = styleUpdates || {};
|
11399 | styleUpdates[styleName] = '';
|
11400 | }
|
11401 | }
|
11402 | // Update styles that changed since `lastProp`.
|
11403 | for (styleName in nextProp) {
|
11404 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
|
11405 | styleUpdates = styleUpdates || {};
|
11406 | styleUpdates[styleName] = nextProp[styleName];
|
11407 | }
|
11408 | }
|
11409 | } else {
|
11410 | // Relies on `updateStylesByID` not mutating `styleUpdates`.
|
11411 | styleUpdates = nextProp;
|
11412 | }
|
11413 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
11414 | if (nextProp) {
|
11415 | enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
|
11416 | } else if (lastProp) {
|
11417 | deleteListener(this._rootNodeID, propKey);
|
11418 | }
|
11419 | } else if (isCustomComponent(this._tag, nextProps)) {
|
11420 | if (!node) {
|
11421 | node = ReactMount.getNode(this._rootNodeID);
|
11422 | }
|
11423 | if (propKey === CHILDREN) {
|
11424 | nextProp = null;
|
11425 | }
|
11426 | DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
|
11427 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
|
11428 | if (!node) {
|
11429 | node = ReactMount.getNode(this._rootNodeID);
|
11430 | }
|
11431 | // If we're updating to null or undefined, we should remove the property
|
11432 | // from the DOM node instead of inadvertantly setting to a string. This
|
11433 | // brings us in line with the same behavior we have on initial render.
|
11434 | if (nextProp != null) {
|
11435 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
|
11436 | } else {
|
11437 | DOMPropertyOperations.deleteValueForProperty(node, propKey);
|
11438 | }
|
11439 | }
|
11440 | }
|
11441 | if (styleUpdates) {
|
11442 | if (!node) {
|
11443 | node = ReactMount.getNode(this._rootNodeID);
|
11444 | }
|
11445 | CSSPropertyOperations.setValueForStyles(node, styleUpdates);
|
11446 | }
|
11447 | },
|
11448 |
|
11449 | /**
|
11450 | * Reconciles the children with the various properties that affect the
|
11451 | * children content.
|
11452 | *
|
11453 | * @param {object} lastProps
|
11454 | * @param {object} nextProps
|
11455 | * @param {ReactReconcileTransaction} transaction
|
11456 | * @param {object} context
|
11457 | */
|
11458 | _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
|
11459 | var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
|
11460 | var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
|
11461 |
|
11462 | var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
|
11463 | var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
|
11464 |
|
11465 | // Note the use of `!=` which checks for null or undefined.
|
11466 | var lastChildren = lastContent != null ? null : lastProps.children;
|
11467 | var nextChildren = nextContent != null ? null : nextProps.children;
|
11468 |
|
11469 | // If we're switching from children to content/html or vice versa, remove
|
11470 | // the old content
|
11471 | var lastHasContentOrHtml = lastContent != null || lastHtml != null;
|
11472 | var nextHasContentOrHtml = nextContent != null || nextHtml != null;
|
11473 | if (lastChildren != null && nextChildren == null) {
|
11474 | this.updateChildren(null, transaction, context);
|
11475 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
|
11476 | this.updateTextContent('');
|
11477 | }
|
11478 |
|
11479 | if (nextContent != null) {
|
11480 | if (lastContent !== nextContent) {
|
11481 | this.updateTextContent('' + nextContent);
|
11482 | }
|
11483 | } else if (nextHtml != null) {
|
11484 | if (lastHtml !== nextHtml) {
|
11485 | this.updateMarkup('' + nextHtml);
|
11486 | }
|
11487 | } else if (nextChildren != null) {
|
11488 | this.updateChildren(nextChildren, transaction, context);
|
11489 | }
|
11490 | },
|
11491 |
|
11492 | /**
|
11493 | * Destroys all event registrations for this instance. Does not remove from
|
11494 | * the DOM. That must be done by the parent.
|
11495 | *
|
11496 | * @internal
|
11497 | */
|
11498 | unmountComponent: function () {
|
11499 | switch (this._tag) {
|
11500 | case 'iframe':
|
11501 | case 'img':
|
11502 | case 'form':
|
11503 | case 'video':
|
11504 | case 'audio':
|
11505 | var listeners = this._wrapperState.listeners;
|
11506 | if (listeners) {
|
11507 | for (var i = 0; i < listeners.length; i++) {
|
11508 | listeners[i].remove();
|
11509 | }
|
11510 | }
|
11511 | break;
|
11512 | case 'input':
|
11513 | ReactDOMInput.unmountWrapper(this);
|
11514 | break;
|
11515 | case 'html':
|
11516 | case 'head':
|
11517 | case 'body':
|
11518 | /**
|
11519 | * Components like <html> <head> and <body> can't be removed or added
|
11520 | * easily in a cross-browser way, however it's valuable to be able to
|
11521 | * take advantage of React's reconciliation for styling and <title>
|
11522 | * management. So we just document it and throw in dangerous cases.
|
11523 | */
|
11524 | true ? true ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
|
11525 | break;
|
11526 | }
|
11527 |
|
11528 | this.unmountChildren();
|
11529 | ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
|
11530 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
11531 | this._rootNodeID = null;
|
11532 | this._wrapperState = null;
|
11533 | if (this._nodeWithLegacyProperties) {
|
11534 | var node = this._nodeWithLegacyProperties;
|
11535 | node._reactInternalComponent = null;
|
11536 | this._nodeWithLegacyProperties = null;
|
11537 | }
|
11538 | },
|
11539 |
|
11540 | getPublicInstance: function () {
|
11541 | if (!this._nodeWithLegacyProperties) {
|
11542 | var node = ReactMount.getNode(this._rootNodeID);
|
11543 |
|
11544 | node._reactInternalComponent = this;
|
11545 | node.getDOMNode = legacyGetDOMNode;
|
11546 | node.isMounted = legacyIsMounted;
|
11547 | node.setState = legacySetStateEtc;
|
11548 | node.replaceState = legacySetStateEtc;
|
11549 | node.forceUpdate = legacySetStateEtc;
|
11550 | node.setProps = legacySetProps;
|
11551 | node.replaceProps = legacyReplaceProps;
|
11552 |
|
11553 | if (true) {
|
11554 | if (canDefineProperty) {
|
11555 | Object.defineProperties(node, legacyPropsDescriptor);
|
11556 | } else {
|
11557 | // updateComponent will update this property on subsequent renders
|
11558 | node.props = this._currentElement.props;
|
11559 | }
|
11560 | } else {
|
11561 | // updateComponent will update this property on subsequent renders
|
11562 | node.props = this._currentElement.props;
|
11563 | }
|
11564 |
|
11565 | this._nodeWithLegacyProperties = node;
|
11566 | }
|
11567 | return this._nodeWithLegacyProperties;
|
11568 | }
|
11569 |
|
11570 | };
|
11571 |
|
11572 | ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
|
11573 | mountComponent: 'mountComponent',
|
11574 | updateComponent: 'updateComponent'
|
11575 | });
|
11576 |
|
11577 | assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
|
11578 |
|
11579 | module.exports = ReactDOMComponent;
|
11580 |
|
11581 | /***/ },
|
11582 | /* 93 */
|
11583 | /***/ function(module, exports, __webpack_require__) {
|
11584 |
|
11585 | /**
|
11586 | * Copyright 2013-2015, Facebook, Inc.
|
11587 | * All rights reserved.
|
11588 | *
|
11589 | * This source code is licensed under the BSD-style license found in the
|
11590 | * LICENSE file in the root directory of this source tree. An additional grant
|
11591 | * of patent rights can be found in the PATENTS file in the same directory.
|
11592 | *
|
11593 | * @providesModule AutoFocusUtils
|
11594 | * @typechecks static-only
|
11595 | */
|
11596 |
|
11597 | 'use strict';
|
11598 |
|
11599 | var ReactMount = __webpack_require__(27);
|
11600 |
|
11601 | var findDOMNode = __webpack_require__(90);
|
11602 | var focusNode = __webpack_require__(94);
|
11603 |
|
11604 | var Mixin = {
|
11605 | componentDidMount: function () {
|
11606 | if (this.props.autoFocus) {
|
11607 | focusNode(findDOMNode(this));
|
11608 | }
|
11609 | }
|
11610 | };
|
11611 |
|
11612 | var AutoFocusUtils = {
|
11613 | Mixin: Mixin,
|
11614 |
|
11615 | focusDOMComponent: function () {
|
11616 | focusNode(ReactMount.getNode(this._rootNodeID));
|
11617 | }
|
11618 | };
|
11619 |
|
11620 | module.exports = AutoFocusUtils;
|
11621 |
|
11622 | /***/ },
|
11623 | /* 94 */
|
11624 | /***/ function(module, exports) {
|
11625 |
|
11626 | /**
|
11627 | * Copyright 2013-2015, Facebook, Inc.
|
11628 | * All rights reserved.
|
11629 | *
|
11630 | * This source code is licensed under the BSD-style license found in the
|
11631 | * LICENSE file in the root directory of this source tree. An additional grant
|
11632 | * of patent rights can be found in the PATENTS file in the same directory.
|
11633 | *
|
11634 | * @providesModule focusNode
|
11635 | */
|
11636 |
|
11637 | 'use strict';
|
11638 |
|
11639 | /**
|
11640 | * @param {DOMElement} node input/textarea to focus
|
11641 | */
|
11642 | function focusNode(node) {
|
11643 | // IE8 can throw "Can't move focus to the control because it is invisible,
|
11644 | // not enabled, or of a type that does not accept the focus." for all kinds of
|
11645 | // reasons that are too expensive and fragile to test.
|
11646 | try {
|
11647 | node.focus();
|
11648 | } catch (e) {}
|
11649 | }
|
11650 |
|
11651 | module.exports = focusNode;
|
11652 |
|
11653 | /***/ },
|
11654 | /* 95 */
|
11655 | /***/ function(module, exports, __webpack_require__) {
|
11656 |
|
11657 | /**
|
11658 | * Copyright 2013-2015, Facebook, Inc.
|
11659 | * All rights reserved.
|
11660 | *
|
11661 | * This source code is licensed under the BSD-style license found in the
|
11662 | * LICENSE file in the root directory of this source tree. An additional grant
|
11663 | * of patent rights can be found in the PATENTS file in the same directory.
|
11664 | *
|
11665 | * @providesModule CSSPropertyOperations
|
11666 | * @typechecks static-only
|
11667 | */
|
11668 |
|
11669 | 'use strict';
|
11670 |
|
11671 | var CSSProperty = __webpack_require__(96);
|
11672 | var ExecutionEnvironment = __webpack_require__(8);
|
11673 | var ReactPerf = __webpack_require__(17);
|
11674 |
|
11675 | var camelizeStyleName = __webpack_require__(97);
|
11676 | var dangerousStyleValue = __webpack_require__(99);
|
11677 | var hyphenateStyleName = __webpack_require__(100);
|
11678 | var memoizeStringOnly = __webpack_require__(102);
|
11679 | var warning = __webpack_require__(24);
|
11680 |
|
11681 | var processStyleName = memoizeStringOnly(function (styleName) {
|
11682 | return hyphenateStyleName(styleName);
|
11683 | });
|
11684 |
|
11685 | var hasShorthandPropertyBug = false;
|
11686 | var styleFloatAccessor = 'cssFloat';
|
11687 | if (ExecutionEnvironment.canUseDOM) {
|
11688 | var tempStyle = document.createElement('div').style;
|
11689 | try {
|
11690 | // IE8 throws "Invalid argument." if resetting shorthand style properties.
|
11691 | tempStyle.font = '';
|
11692 | } catch (e) {
|
11693 | hasShorthandPropertyBug = true;
|
11694 | }
|
11695 | // IE8 only supports accessing cssFloat (standard) as styleFloat
|
11696 | if (document.documentElement.style.cssFloat === undefined) {
|
11697 | styleFloatAccessor = 'styleFloat';
|
11698 | }
|
11699 | }
|
11700 |
|
11701 | if (true) {
|
11702 | // 'msTransform' is correct, but the other prefixes should be capitalized
|
11703 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
11704 |
|
11705 | // style values shouldn't contain a semicolon
|
11706 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
11707 |
|
11708 | var warnedStyleNames = {};
|
11709 | var warnedStyleValues = {};
|
11710 |
|
11711 | var warnHyphenatedStyleName = function (name) {
|
11712 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
11713 | return;
|
11714 | }
|
11715 |
|
11716 | warnedStyleNames[name] = true;
|
11717 | true ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
|
11718 | };
|
11719 |
|
11720 | var warnBadVendoredStyleName = function (name) {
|
11721 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
11722 | return;
|
11723 | }
|
11724 |
|
11725 | warnedStyleNames[name] = true;
|
11726 | true ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
|
11727 | };
|
11728 |
|
11729 | var warnStyleValueWithSemicolon = function (name, value) {
|
11730 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
11731 | return;
|
11732 | }
|
11733 |
|
11734 | warnedStyleValues[value] = true;
|
11735 | true ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
|
11736 | };
|
11737 |
|
11738 | /**
|
11739 | * @param {string} name
|
11740 | * @param {*} value
|
11741 | */
|
11742 | var warnValidStyle = function (name, value) {
|
11743 | if (name.indexOf('-') > -1) {
|
11744 | warnHyphenatedStyleName(name);
|
11745 | } else if (badVendoredStyleNamePattern.test(name)) {
|
11746 | warnBadVendoredStyleName(name);
|
11747 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
11748 | warnStyleValueWithSemicolon(name, value);
|
11749 | }
|
11750 | };
|
11751 | }
|
11752 |
|
11753 | /**
|
11754 | * Operations for dealing with CSS properties.
|
11755 | */
|
11756 | var CSSPropertyOperations = {
|
11757 |
|
11758 | /**
|
11759 | * Serializes a mapping of style properties for use as inline styles:
|
11760 | *
|
11761 | * > createMarkupForStyles({width: '200px', height: 0})
|
11762 | * "width:200px;height:0;"
|
11763 | *
|
11764 | * Undefined values are ignored so that declarative programming is easier.
|
11765 | * The result should be HTML-escaped before insertion into the DOM.
|
11766 | *
|
11767 | * @param {object} styles
|
11768 | * @return {?string}
|
11769 | */
|
11770 | createMarkupForStyles: function (styles) {
|
11771 | var serialized = '';
|
11772 | for (var styleName in styles) {
|
11773 | if (!styles.hasOwnProperty(styleName)) {
|
11774 | continue;
|
11775 | }
|
11776 | var styleValue = styles[styleName];
|
11777 | if (true) {
|
11778 | warnValidStyle(styleName, styleValue);
|
11779 | }
|
11780 | if (styleValue != null) {
|
11781 | serialized += processStyleName(styleName) + ':';
|
11782 | serialized += dangerousStyleValue(styleName, styleValue) + ';';
|
11783 | }
|
11784 | }
|
11785 | return serialized || null;
|
11786 | },
|
11787 |
|
11788 | /**
|
11789 | * Sets the value for multiple styles on a node. If a value is specified as
|
11790 | * '' (empty string), the corresponding style property will be unset.
|
11791 | *
|
11792 | * @param {DOMElement} node
|
11793 | * @param {object} styles
|
11794 | */
|
11795 | setValueForStyles: function (node, styles) {
|
11796 | var style = node.style;
|
11797 | for (var styleName in styles) {
|
11798 | if (!styles.hasOwnProperty(styleName)) {
|
11799 | continue;
|
11800 | }
|
11801 | if (true) {
|
11802 | warnValidStyle(styleName, styles[styleName]);
|
11803 | }
|
11804 | var styleValue = dangerousStyleValue(styleName, styles[styleName]);
|
11805 | if (styleName === 'float') {
|
11806 | styleName = styleFloatAccessor;
|
11807 | }
|
11808 | if (styleValue) {
|
11809 | style[styleName] = styleValue;
|
11810 | } else {
|
11811 | var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
|
11812 | if (expansion) {
|
11813 | // Shorthand property that IE8 won't like unsetting, so unset each
|
11814 | // component to placate it
|
11815 | for (var individualStyleName in expansion) {
|
11816 | style[individualStyleName] = '';
|
11817 | }
|
11818 | } else {
|
11819 | style[styleName] = '';
|
11820 | }
|
11821 | }
|
11822 | }
|
11823 | }
|
11824 |
|
11825 | };
|
11826 |
|
11827 | ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
|
11828 | setValueForStyles: 'setValueForStyles'
|
11829 | });
|
11830 |
|
11831 | module.exports = CSSPropertyOperations;
|
11832 |
|
11833 | /***/ },
|
11834 | /* 96 */
|
11835 | /***/ function(module, exports) {
|
11836 |
|
11837 | /**
|
11838 | * Copyright 2013-2015, Facebook, Inc.
|
11839 | * All rights reserved.
|
11840 | *
|
11841 | * This source code is licensed under the BSD-style license found in the
|
11842 | * LICENSE file in the root directory of this source tree. An additional grant
|
11843 | * of patent rights can be found in the PATENTS file in the same directory.
|
11844 | *
|
11845 | * @providesModule CSSProperty
|
11846 | */
|
11847 |
|
11848 | 'use strict';
|
11849 |
|
11850 | /**
|
11851 | * CSS properties which accept numbers but are not in units of "px".
|
11852 | */
|
11853 | var isUnitlessNumber = {
|
11854 | animationIterationCount: true,
|
11855 | boxFlex: true,
|
11856 | boxFlexGroup: true,
|
11857 | boxOrdinalGroup: true,
|
11858 | columnCount: true,
|
11859 | flex: true,
|
11860 | flexGrow: true,
|
11861 | flexPositive: true,
|
11862 | flexShrink: true,
|
11863 | flexNegative: true,
|
11864 | flexOrder: true,
|
11865 | fontWeight: true,
|
11866 | lineClamp: true,
|
11867 | lineHeight: true,
|
11868 | opacity: true,
|
11869 | order: true,
|
11870 | orphans: true,
|
11871 | tabSize: true,
|
11872 | widows: true,
|
11873 | zIndex: true,
|
11874 | zoom: true,
|
11875 |
|
11876 | // SVG-related properties
|
11877 | fillOpacity: true,
|
11878 | stopOpacity: true,
|
11879 | strokeDashoffset: true,
|
11880 | strokeOpacity: true,
|
11881 | strokeWidth: true
|
11882 | };
|
11883 |
|
11884 | /**
|
11885 | * @param {string} prefix vendor-specific prefix, eg: Webkit
|
11886 | * @param {string} key style name, eg: transitionDuration
|
11887 | * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
11888 | * WebkitTransitionDuration
|
11889 | */
|
11890 | function prefixKey(prefix, key) {
|
11891 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
11892 | }
|
11893 |
|
11894 | /**
|
11895 | * Support style names that may come passed in prefixed by adding permutations
|
11896 | * of vendor prefixes.
|
11897 | */
|
11898 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
11899 |
|
11900 | // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
|
11901 | // infinite loop, because it iterates over the newly added props too.
|
11902 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
11903 | prefixes.forEach(function (prefix) {
|
11904 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
11905 | });
|
11906 | });
|
11907 |
|
11908 | /**
|
11909 | * Most style properties can be unset by doing .style[prop] = '' but IE8
|
11910 | * doesn't like doing that with shorthand properties so for the properties that
|
11911 | * IE8 breaks on, which are listed here, we instead unset each of the
|
11912 | * individual properties. See http://bugs.jquery.com/ticket/12385.
|
11913 | * The 4-value 'clock' properties like margin, padding, border-width seem to
|
11914 | * behave without any problems. Curiously, list-style works too without any
|
11915 | * special prodding.
|
11916 | */
|
11917 | var shorthandPropertyExpansions = {
|
11918 | background: {
|
11919 | backgroundAttachment: true,
|
11920 | backgroundColor: true,
|
11921 | backgroundImage: true,
|
11922 | backgroundPositionX: true,
|
11923 | backgroundPositionY: true,
|
11924 | backgroundRepeat: true
|
11925 | },
|
11926 | backgroundPosition: {
|
11927 | backgroundPositionX: true,
|
11928 | backgroundPositionY: true
|
11929 | },
|
11930 | border: {
|
11931 | borderWidth: true,
|
11932 | borderStyle: true,
|
11933 | borderColor: true
|
11934 | },
|
11935 | borderBottom: {
|
11936 | borderBottomWidth: true,
|
11937 | borderBottomStyle: true,
|
11938 | borderBottomColor: true
|
11939 | },
|
11940 | borderLeft: {
|
11941 | borderLeftWidth: true,
|
11942 | borderLeftStyle: true,
|
11943 | borderLeftColor: true
|
11944 | },
|
11945 | borderRight: {
|
11946 | borderRightWidth: true,
|
11947 | borderRightStyle: true,
|
11948 | borderRightColor: true
|
11949 | },
|
11950 | borderTop: {
|
11951 | borderTopWidth: true,
|
11952 | borderTopStyle: true,
|
11953 | borderTopColor: true
|
11954 | },
|
11955 | font: {
|
11956 | fontStyle: true,
|
11957 | fontVariant: true,
|
11958 | fontWeight: true,
|
11959 | fontSize: true,
|
11960 | lineHeight: true,
|
11961 | fontFamily: true
|
11962 | },
|
11963 | outline: {
|
11964 | outlineWidth: true,
|
11965 | outlineStyle: true,
|
11966 | outlineColor: true
|
11967 | }
|
11968 | };
|
11969 |
|
11970 | var CSSProperty = {
|
11971 | isUnitlessNumber: isUnitlessNumber,
|
11972 | shorthandPropertyExpansions: shorthandPropertyExpansions
|
11973 | };
|
11974 |
|
11975 | module.exports = CSSProperty;
|
11976 |
|
11977 | /***/ },
|
11978 | /* 97 */
|
11979 | /***/ function(module, exports, __webpack_require__) {
|
11980 |
|
11981 | /**
|
11982 | * Copyright 2013-2015, Facebook, Inc.
|
11983 | * All rights reserved.
|
11984 | *
|
11985 | * This source code is licensed under the BSD-style license found in the
|
11986 | * LICENSE file in the root directory of this source tree. An additional grant
|
11987 | * of patent rights can be found in the PATENTS file in the same directory.
|
11988 | *
|
11989 | * @providesModule camelizeStyleName
|
11990 | * @typechecks
|
11991 | */
|
11992 |
|
11993 | 'use strict';
|
11994 |
|
11995 | var camelize = __webpack_require__(98);
|
11996 |
|
11997 | var msPattern = /^-ms-/;
|
11998 |
|
11999 | /**
|
12000 | * Camelcases a hyphenated CSS property name, for example:
|
12001 | *
|
12002 | * > camelizeStyleName('background-color')
|
12003 | * < "backgroundColor"
|
12004 | * > camelizeStyleName('-moz-transition')
|
12005 | * < "MozTransition"
|
12006 | * > camelizeStyleName('-ms-transition')
|
12007 | * < "msTransition"
|
12008 | *
|
12009 | * As Andi Smith suggests
|
12010 | * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
12011 | * is converted to lowercase `ms`.
|
12012 | *
|
12013 | * @param {string} string
|
12014 | * @return {string}
|
12015 | */
|
12016 | function camelizeStyleName(string) {
|
12017 | return camelize(string.replace(msPattern, 'ms-'));
|
12018 | }
|
12019 |
|
12020 | module.exports = camelizeStyleName;
|
12021 |
|
12022 | /***/ },
|
12023 | /* 98 */
|
12024 | /***/ function(module, exports) {
|
12025 |
|
12026 | /**
|
12027 | * Copyright 2013-2015, Facebook, Inc.
|
12028 | * All rights reserved.
|
12029 | *
|
12030 | * This source code is licensed under the BSD-style license found in the
|
12031 | * LICENSE file in the root directory of this source tree. An additional grant
|
12032 | * of patent rights can be found in the PATENTS file in the same directory.
|
12033 | *
|
12034 | * @providesModule camelize
|
12035 | * @typechecks
|
12036 | */
|
12037 |
|
12038 | "use strict";
|
12039 |
|
12040 | var _hyphenPattern = /-(.)/g;
|
12041 |
|
12042 | /**
|
12043 | * Camelcases a hyphenated string, for example:
|
12044 | *
|
12045 | * > camelize('background-color')
|
12046 | * < "backgroundColor"
|
12047 | *
|
12048 | * @param {string} string
|
12049 | * @return {string}
|
12050 | */
|
12051 | function camelize(string) {
|
12052 | return string.replace(_hyphenPattern, function (_, character) {
|
12053 | return character.toUpperCase();
|
12054 | });
|
12055 | }
|
12056 |
|
12057 | module.exports = camelize;
|
12058 |
|
12059 | /***/ },
|
12060 | /* 99 */
|
12061 | /***/ function(module, exports, __webpack_require__) {
|
12062 |
|
12063 | /**
|
12064 | * Copyright 2013-2015, Facebook, Inc.
|
12065 | * All rights reserved.
|
12066 | *
|
12067 | * This source code is licensed under the BSD-style license found in the
|
12068 | * LICENSE file in the root directory of this source tree. An additional grant
|
12069 | * of patent rights can be found in the PATENTS file in the same directory.
|
12070 | *
|
12071 | * @providesModule dangerousStyleValue
|
12072 | * @typechecks static-only
|
12073 | */
|
12074 |
|
12075 | 'use strict';
|
12076 |
|
12077 | var CSSProperty = __webpack_require__(96);
|
12078 |
|
12079 | var isUnitlessNumber = CSSProperty.isUnitlessNumber;
|
12080 |
|
12081 | /**
|
12082 | * Convert a value into the proper css writable value. The style name `name`
|
12083 | * should be logical (no hyphens), as specified
|
12084 | * in `CSSProperty.isUnitlessNumber`.
|
12085 | *
|
12086 | * @param {string} name CSS property name such as `topMargin`.
|
12087 | * @param {*} value CSS property value such as `10px`.
|
12088 | * @return {string} Normalized style value with dimensions applied.
|
12089 | */
|
12090 | function dangerousStyleValue(name, value) {
|
12091 | // Note that we've removed escapeTextForBrowser() calls here since the
|
12092 | // whole string will be escaped when the attribute is injected into
|
12093 | // the markup. If you provide unsafe user data here they can inject
|
12094 | // arbitrary CSS which may be problematic (I couldn't repro this):
|
12095 | // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
|
12096 | // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
|
12097 | // This is not an XSS hole but instead a potential CSS injection issue
|
12098 | // which has lead to a greater discussion about how we're going to
|
12099 | // trust URLs moving forward. See #2115901
|
12100 |
|
12101 | var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
12102 | if (isEmpty) {
|
12103 | return '';
|
12104 | }
|
12105 |
|
12106 | var isNonNumeric = isNaN(value);
|
12107 | if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
|
12108 | return '' + value; // cast to string
|
12109 | }
|
12110 |
|
12111 | if (typeof value === 'string') {
|
12112 | value = value.trim();
|
12113 | }
|
12114 | return value + 'px';
|
12115 | }
|
12116 |
|
12117 | module.exports = dangerousStyleValue;
|
12118 |
|
12119 | /***/ },
|
12120 | /* 100 */
|
12121 | /***/ function(module, exports, __webpack_require__) {
|
12122 |
|
12123 | /**
|
12124 | * Copyright 2013-2015, Facebook, Inc.
|
12125 | * All rights reserved.
|
12126 | *
|
12127 | * This source code is licensed under the BSD-style license found in the
|
12128 | * LICENSE file in the root directory of this source tree. An additional grant
|
12129 | * of patent rights can be found in the PATENTS file in the same directory.
|
12130 | *
|
12131 | * @providesModule hyphenateStyleName
|
12132 | * @typechecks
|
12133 | */
|
12134 |
|
12135 | 'use strict';
|
12136 |
|
12137 | var hyphenate = __webpack_require__(101);
|
12138 |
|
12139 | var msPattern = /^ms-/;
|
12140 |
|
12141 | /**
|
12142 | * Hyphenates a camelcased CSS property name, for example:
|
12143 | *
|
12144 | * > hyphenateStyleName('backgroundColor')
|
12145 | * < "background-color"
|
12146 | * > hyphenateStyleName('MozTransition')
|
12147 | * < "-moz-transition"
|
12148 | * > hyphenateStyleName('msTransition')
|
12149 | * < "-ms-transition"
|
12150 | *
|
12151 | * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
12152 | * is converted to `-ms-`.
|
12153 | *
|
12154 | * @param {string} string
|
12155 | * @return {string}
|
12156 | */
|
12157 | function hyphenateStyleName(string) {
|
12158 | return hyphenate(string).replace(msPattern, '-ms-');
|
12159 | }
|
12160 |
|
12161 | module.exports = hyphenateStyleName;
|
12162 |
|
12163 | /***/ },
|
12164 | /* 101 */
|
12165 | /***/ function(module, exports) {
|
12166 |
|
12167 | /**
|
12168 | * Copyright 2013-2015, Facebook, Inc.
|
12169 | * All rights reserved.
|
12170 | *
|
12171 | * This source code is licensed under the BSD-style license found in the
|
12172 | * LICENSE file in the root directory of this source tree. An additional grant
|
12173 | * of patent rights can be found in the PATENTS file in the same directory.
|
12174 | *
|
12175 | * @providesModule hyphenate
|
12176 | * @typechecks
|
12177 | */
|
12178 |
|
12179 | 'use strict';
|
12180 |
|
12181 | var _uppercasePattern = /([A-Z])/g;
|
12182 |
|
12183 | /**
|
12184 | * Hyphenates a camelcased string, for example:
|
12185 | *
|
12186 | * > hyphenate('backgroundColor')
|
12187 | * < "background-color"
|
12188 | *
|
12189 | * For CSS style names, use `hyphenateStyleName` instead which works properly
|
12190 | * with all vendor prefixes, including `ms`.
|
12191 | *
|
12192 | * @param {string} string
|
12193 | * @return {string}
|
12194 | */
|
12195 | function hyphenate(string) {
|
12196 | return string.replace(_uppercasePattern, '-$1').toLowerCase();
|
12197 | }
|
12198 |
|
12199 | module.exports = hyphenate;
|
12200 |
|
12201 | /***/ },
|
12202 | /* 102 */
|
12203 | /***/ function(module, exports) {
|
12204 |
|
12205 | /**
|
12206 | * Copyright 2013-2015, Facebook, Inc.
|
12207 | * All rights reserved.
|
12208 | *
|
12209 | * This source code is licensed under the BSD-style license found in the
|
12210 | * LICENSE file in the root directory of this source tree. An additional grant
|
12211 | * of patent rights can be found in the PATENTS file in the same directory.
|
12212 | *
|
12213 | * @providesModule memoizeStringOnly
|
12214 | * @typechecks static-only
|
12215 | */
|
12216 |
|
12217 | 'use strict';
|
12218 |
|
12219 | /**
|
12220 | * Memoizes the return value of a function that accepts one string argument.
|
12221 | *
|
12222 | * @param {function} callback
|
12223 | * @return {function}
|
12224 | */
|
12225 | function memoizeStringOnly(callback) {
|
12226 | var cache = {};
|
12227 | return function (string) {
|
12228 | if (!cache.hasOwnProperty(string)) {
|
12229 | cache[string] = callback.call(this, string);
|
12230 | }
|
12231 | return cache[string];
|
12232 | };
|
12233 | }
|
12234 |
|
12235 | module.exports = memoizeStringOnly;
|
12236 |
|
12237 | /***/ },
|
12238 | /* 103 */
|
12239 | /***/ function(module, exports) {
|
12240 |
|
12241 | /**
|
12242 | * Copyright 2013-2015, Facebook, Inc.
|
12243 | * All rights reserved.
|
12244 | *
|
12245 | * This source code is licensed under the BSD-style license found in the
|
12246 | * LICENSE file in the root directory of this source tree. An additional grant
|
12247 | * of patent rights can be found in the PATENTS file in the same directory.
|
12248 | *
|
12249 | * @providesModule ReactDOMButton
|
12250 | */
|
12251 |
|
12252 | 'use strict';
|
12253 |
|
12254 | var mouseListenerNames = {
|
12255 | onClick: true,
|
12256 | onDoubleClick: true,
|
12257 | onMouseDown: true,
|
12258 | onMouseMove: true,
|
12259 | onMouseUp: true,
|
12260 |
|
12261 | onClickCapture: true,
|
12262 | onDoubleClickCapture: true,
|
12263 | onMouseDownCapture: true,
|
12264 | onMouseMoveCapture: true,
|
12265 | onMouseUpCapture: true
|
12266 | };
|
12267 |
|
12268 | /**
|
12269 | * Implements a <button> native component that does not receive mouse events
|
12270 | * when `disabled` is set.
|
12271 | */
|
12272 | var ReactDOMButton = {
|
12273 | getNativeProps: function (inst, props, context) {
|
12274 | if (!props.disabled) {
|
12275 | return props;
|
12276 | }
|
12277 |
|
12278 | // Copy the props, except the mouse listeners
|
12279 | var nativeProps = {};
|
12280 | for (var key in props) {
|
12281 | if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
|
12282 | nativeProps[key] = props[key];
|
12283 | }
|
12284 | }
|
12285 |
|
12286 | return nativeProps;
|
12287 | }
|
12288 | };
|
12289 |
|
12290 | module.exports = ReactDOMButton;
|
12291 |
|
12292 | /***/ },
|
12293 | /* 104 */
|
12294 | /***/ function(module, exports, __webpack_require__) {
|
12295 |
|
12296 | /**
|
12297 | * Copyright 2013-2015, Facebook, Inc.
|
12298 | * All rights reserved.
|
12299 | *
|
12300 | * This source code is licensed under the BSD-style license found in the
|
12301 | * LICENSE file in the root directory of this source tree. An additional grant
|
12302 | * of patent rights can be found in the PATENTS file in the same directory.
|
12303 | *
|
12304 | * @providesModule ReactDOMInput
|
12305 | */
|
12306 |
|
12307 | 'use strict';
|
12308 |
|
12309 | var ReactDOMIDOperations = __webpack_require__(26);
|
12310 | var LinkedValueUtils = __webpack_require__(105);
|
12311 | var ReactMount = __webpack_require__(27);
|
12312 | var ReactUpdates = __webpack_require__(53);
|
12313 |
|
12314 | var assign = __webpack_require__(38);
|
12315 | var invariant = __webpack_require__(12);
|
12316 |
|
12317 | var instancesByReactID = {};
|
12318 |
|
12319 | function forceUpdateIfMounted() {
|
12320 | if (this._rootNodeID) {
|
12321 | // DOM component is still mounted; update
|
12322 | ReactDOMInput.updateWrapper(this);
|
12323 | }
|
12324 | }
|
12325 |
|
12326 | /**
|
12327 | * Implements an <input> native component that allows setting these optional
|
12328 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
|
12329 | *
|
12330 | * If `checked` or `value` are not supplied (or null/undefined), user actions
|
12331 | * that affect the checked state or value will trigger updates to the element.
|
12332 | *
|
12333 | * If they are supplied (and not null/undefined), the rendered element will not
|
12334 | * trigger updates to the element. Instead, the props must change in order for
|
12335 | * the rendered element to be updated.
|
12336 | *
|
12337 | * The rendered element will be initialized as unchecked (or `defaultChecked`)
|
12338 | * with an empty value (or `defaultValue`).
|
12339 | *
|
12340 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
|
12341 | */
|
12342 | var ReactDOMInput = {
|
12343 | getNativeProps: function (inst, props, context) {
|
12344 | var value = LinkedValueUtils.getValue(props);
|
12345 | var checked = LinkedValueUtils.getChecked(props);
|
12346 |
|
12347 | var nativeProps = assign({}, props, {
|
12348 | defaultChecked: undefined,
|
12349 | defaultValue: undefined,
|
12350 | value: value != null ? value : inst._wrapperState.initialValue,
|
12351 | checked: checked != null ? checked : inst._wrapperState.initialChecked,
|
12352 | onChange: inst._wrapperState.onChange
|
12353 | });
|
12354 |
|
12355 | return nativeProps;
|
12356 | },
|
12357 |
|
12358 | mountWrapper: function (inst, props) {
|
12359 | if (true) {
|
12360 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
|
12361 | }
|
12362 |
|
12363 | var defaultValue = props.defaultValue;
|
12364 | inst._wrapperState = {
|
12365 | initialChecked: props.defaultChecked || false,
|
12366 | initialValue: defaultValue != null ? defaultValue : null,
|
12367 | onChange: _handleChange.bind(inst)
|
12368 | };
|
12369 | },
|
12370 |
|
12371 | mountReadyWrapper: function (inst) {
|
12372 | // Can't be in mountWrapper or else server rendering leaks.
|
12373 | instancesByReactID[inst._rootNodeID] = inst;
|
12374 | },
|
12375 |
|
12376 | unmountWrapper: function (inst) {
|
12377 | delete instancesByReactID[inst._rootNodeID];
|
12378 | },
|
12379 |
|
12380 | updateWrapper: function (inst) {
|
12381 | var props = inst._currentElement.props;
|
12382 |
|
12383 | // TODO: Shouldn't this be getChecked(props)?
|
12384 | var checked = props.checked;
|
12385 | if (checked != null) {
|
12386 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
|
12387 | }
|
12388 |
|
12389 | var value = LinkedValueUtils.getValue(props);
|
12390 | if (value != null) {
|
12391 | // Cast `value` to a string to ensure the value is set correctly. While
|
12392 | // browsers typically do this as necessary, jsdom doesn't.
|
12393 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
|
12394 | }
|
12395 | }
|
12396 | };
|
12397 |
|
12398 | function _handleChange(event) {
|
12399 | var props = this._currentElement.props;
|
12400 |
|
12401 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
12402 |
|
12403 | // Here we use asap to wait until all updates have propagated, which
|
12404 | // is important when using controlled components within layers:
|
12405 | // https://github.com/facebook/react/issues/1698
|
12406 | ReactUpdates.asap(forceUpdateIfMounted, this);
|
12407 |
|
12408 | var name = props.name;
|
12409 | if (props.type === 'radio' && name != null) {
|
12410 | var rootNode = ReactMount.getNode(this._rootNodeID);
|
12411 | var queryRoot = rootNode;
|
12412 |
|
12413 | while (queryRoot.parentNode) {
|
12414 | queryRoot = queryRoot.parentNode;
|
12415 | }
|
12416 |
|
12417 | // If `rootNode.form` was non-null, then we could try `form.elements`,
|
12418 | // but that sometimes behaves strangely in IE8. We could also try using
|
12419 | // `form.getElementsByName`, but that will only return direct children
|
12420 | // and won't include inputs that use the HTML5 `form=` attribute. Since
|
12421 | // the input might not even be in a form, let's just use the global
|
12422 | // `querySelectorAll` to ensure we don't miss anything.
|
12423 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
|
12424 |
|
12425 | for (var i = 0; i < group.length; i++) {
|
12426 | var otherNode = group[i];
|
12427 | if (otherNode === rootNode || otherNode.form !== rootNode.form) {
|
12428 | continue;
|
12429 | }
|
12430 | // This will throw if radio buttons rendered by different copies of React
|
12431 | // and the same name are rendered into the same form (same as #1939).
|
12432 | // That's probably okay; we don't support it just as we don't support
|
12433 | // mixing React with non-React.
|
12434 | var otherID = ReactMount.getID(otherNode);
|
12435 | !otherID ? true ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
|
12436 | var otherInstance = instancesByReactID[otherID];
|
12437 | !otherInstance ? true ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
|
12438 | // If this is a controlled radio button group, forcing the input that
|
12439 | // was previously checked to update will cause it to be come re-checked
|
12440 | // as appropriate.
|
12441 | ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
|
12442 | }
|
12443 | }
|
12444 |
|
12445 | return returnValue;
|
12446 | }
|
12447 |
|
12448 | module.exports = ReactDOMInput;
|
12449 |
|
12450 | /***/ },
|
12451 | /* 105 */
|
12452 | /***/ function(module, exports, __webpack_require__) {
|
12453 |
|
12454 | /**
|
12455 | * Copyright 2013-2015, Facebook, Inc.
|
12456 | * All rights reserved.
|
12457 | *
|
12458 | * This source code is licensed under the BSD-style license found in the
|
12459 | * LICENSE file in the root directory of this source tree. An additional grant
|
12460 | * of patent rights can be found in the PATENTS file in the same directory.
|
12461 | *
|
12462 | * @providesModule LinkedValueUtils
|
12463 | * @typechecks static-only
|
12464 | */
|
12465 |
|
12466 | 'use strict';
|
12467 |
|
12468 | var ReactPropTypes = __webpack_require__(106);
|
12469 | var ReactPropTypeLocations = __webpack_require__(64);
|
12470 |
|
12471 | var invariant = __webpack_require__(12);
|
12472 | var warning = __webpack_require__(24);
|
12473 |
|
12474 | var hasReadOnlyValue = {
|
12475 | 'button': true,
|
12476 | 'checkbox': true,
|
12477 | 'image': true,
|
12478 | 'hidden': true,
|
12479 | 'radio': true,
|
12480 | 'reset': true,
|
12481 | 'submit': true
|
12482 | };
|
12483 |
|
12484 | function _assertSingleLink(inputProps) {
|
12485 | !(inputProps.checkedLink == null || inputProps.valueLink == null) ? true ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
|
12486 | }
|
12487 | function _assertValueLink(inputProps) {
|
12488 | _assertSingleLink(inputProps);
|
12489 | !(inputProps.value == null && inputProps.onChange == null) ? true ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
|
12490 | }
|
12491 |
|
12492 | function _assertCheckedLink(inputProps) {
|
12493 | _assertSingleLink(inputProps);
|
12494 | !(inputProps.checked == null && inputProps.onChange == null) ? true ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
|
12495 | }
|
12496 |
|
12497 | var propTypes = {
|
12498 | value: function (props, propName, componentName) {
|
12499 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
|
12500 | return null;
|
12501 | }
|
12502 | return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
12503 | },
|
12504 | checked: function (props, propName, componentName) {
|
12505 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
|
12506 | return null;
|
12507 | }
|
12508 | return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
12509 | },
|
12510 | onChange: ReactPropTypes.func
|
12511 | };
|
12512 |
|
12513 | var loggedTypeFailures = {};
|
12514 | function getDeclarationErrorAddendum(owner) {
|
12515 | if (owner) {
|
12516 | var name = owner.getName();
|
12517 | if (name) {
|
12518 | return ' Check the render method of `' + name + '`.';
|
12519 | }
|
12520 | }
|
12521 | return '';
|
12522 | }
|
12523 |
|
12524 | /**
|
12525 | * Provide a linked `value` attribute for controlled forms. You should not use
|
12526 | * this outside of the ReactDOM controlled form components.
|
12527 | */
|
12528 | var LinkedValueUtils = {
|
12529 | checkPropTypes: function (tagName, props, owner) {
|
12530 | for (var propName in propTypes) {
|
12531 | if (propTypes.hasOwnProperty(propName)) {
|
12532 | var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
|
12533 | }
|
12534 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
12535 | // Only monitor this failure once because there tends to be a lot of the
|
12536 | // same error.
|
12537 | loggedTypeFailures[error.message] = true;
|
12538 |
|
12539 | var addendum = getDeclarationErrorAddendum(owner);
|
12540 | true ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
|
12541 | }
|
12542 | }
|
12543 | },
|
12544 |
|
12545 | /**
|
12546 | * @param {object} inputProps Props for form component
|
12547 | * @return {*} current value of the input either from value prop or link.
|
12548 | */
|
12549 | getValue: function (inputProps) {
|
12550 | if (inputProps.valueLink) {
|
12551 | _assertValueLink(inputProps);
|
12552 | return inputProps.valueLink.value;
|
12553 | }
|
12554 | return inputProps.value;
|
12555 | },
|
12556 |
|
12557 | /**
|
12558 | * @param {object} inputProps Props for form component
|
12559 | * @return {*} current checked status of the input either from checked prop
|
12560 | * or link.
|
12561 | */
|
12562 | getChecked: function (inputProps) {
|
12563 | if (inputProps.checkedLink) {
|
12564 | _assertCheckedLink(inputProps);
|
12565 | return inputProps.checkedLink.value;
|
12566 | }
|
12567 | return inputProps.checked;
|
12568 | },
|
12569 |
|
12570 | /**
|
12571 | * @param {object} inputProps Props for form component
|
12572 | * @param {SyntheticEvent} event change event to handle
|
12573 | */
|
12574 | executeOnChange: function (inputProps, event) {
|
12575 | if (inputProps.valueLink) {
|
12576 | _assertValueLink(inputProps);
|
12577 | return inputProps.valueLink.requestChange(event.target.value);
|
12578 | } else if (inputProps.checkedLink) {
|
12579 | _assertCheckedLink(inputProps);
|
12580 | return inputProps.checkedLink.requestChange(event.target.checked);
|
12581 | } else if (inputProps.onChange) {
|
12582 | return inputProps.onChange.call(undefined, event);
|
12583 | }
|
12584 | }
|
12585 | };
|
12586 |
|
12587 | module.exports = LinkedValueUtils;
|
12588 |
|
12589 | /***/ },
|
12590 | /* 106 */
|
12591 | /***/ function(module, exports, __webpack_require__) {
|
12592 |
|
12593 | /**
|
12594 | * Copyright 2013-2015, Facebook, Inc.
|
12595 | * All rights reserved.
|
12596 | *
|
12597 | * This source code is licensed under the BSD-style license found in the
|
12598 | * LICENSE file in the root directory of this source tree. An additional grant
|
12599 | * of patent rights can be found in the PATENTS file in the same directory.
|
12600 | *
|
12601 | * @providesModule ReactPropTypes
|
12602 | */
|
12603 |
|
12604 | 'use strict';
|
12605 |
|
12606 | var ReactElement = __webpack_require__(41);
|
12607 | var ReactPropTypeLocationNames = __webpack_require__(65);
|
12608 |
|
12609 | var emptyFunction = __webpack_require__(14);
|
12610 | var getIteratorFn = __webpack_require__(107);
|
12611 |
|
12612 | /**
|
12613 | * Collection of methods that allow declaration and validation of props that are
|
12614 | * supplied to React components. Example usage:
|
12615 | *
|
12616 | * var Props = require('ReactPropTypes');
|
12617 | * var MyArticle = React.createClass({
|
12618 | * propTypes: {
|
12619 | * // An optional string prop named "description".
|
12620 | * description: Props.string,
|
12621 | *
|
12622 | * // A required enum prop named "category".
|
12623 | * category: Props.oneOf(['News','Photos']).isRequired,
|
12624 | *
|
12625 | * // A prop named "dialog" that requires an instance of Dialog.
|
12626 | * dialog: Props.instanceOf(Dialog).isRequired
|
12627 | * },
|
12628 | * render: function() { ... }
|
12629 | * });
|
12630 | *
|
12631 | * A more formal specification of how these methods are used:
|
12632 | *
|
12633 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
12634 | * decl := ReactPropTypes.{type}(.isRequired)?
|
12635 | *
|
12636 | * Each and every declaration produces a function with the same signature. This
|
12637 | * allows the creation of custom validation functions. For example:
|
12638 | *
|
12639 | * var MyLink = React.createClass({
|
12640 | * propTypes: {
|
12641 | * // An optional string or URI prop named "href".
|
12642 | * href: function(props, propName, componentName) {
|
12643 | * var propValue = props[propName];
|
12644 | * if (propValue != null && typeof propValue !== 'string' &&
|
12645 | * !(propValue instanceof URI)) {
|
12646 | * return new Error(
|
12647 | * 'Expected a string or an URI for ' + propName + ' in ' +
|
12648 | * componentName
|
12649 | * );
|
12650 | * }
|
12651 | * }
|
12652 | * },
|
12653 | * render: function() {...}
|
12654 | * });
|
12655 | *
|
12656 | * @internal
|
12657 | */
|
12658 |
|
12659 | var ANONYMOUS = '<<anonymous>>';
|
12660 |
|
12661 | var ReactPropTypes = {
|
12662 | array: createPrimitiveTypeChecker('array'),
|
12663 | bool: createPrimitiveTypeChecker('boolean'),
|
12664 | func: createPrimitiveTypeChecker('function'),
|
12665 | number: createPrimitiveTypeChecker('number'),
|
12666 | object: createPrimitiveTypeChecker('object'),
|
12667 | string: createPrimitiveTypeChecker('string'),
|
12668 |
|
12669 | any: createAnyTypeChecker(),
|
12670 | arrayOf: createArrayOfTypeChecker,
|
12671 | element: createElementTypeChecker(),
|
12672 | instanceOf: createInstanceTypeChecker,
|
12673 | node: createNodeChecker(),
|
12674 | objectOf: createObjectOfTypeChecker,
|
12675 | oneOf: createEnumTypeChecker,
|
12676 | oneOfType: createUnionTypeChecker,
|
12677 | shape: createShapeTypeChecker
|
12678 | };
|
12679 |
|
12680 | function createChainableTypeChecker(validate) {
|
12681 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
12682 | componentName = componentName || ANONYMOUS;
|
12683 | propFullName = propFullName || propName;
|
12684 | if (props[propName] == null) {
|
12685 | var locationName = ReactPropTypeLocationNames[location];
|
12686 | if (isRequired) {
|
12687 | return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
|
12688 | }
|
12689 | return null;
|
12690 | } else {
|
12691 | return validate(props, propName, componentName, location, propFullName);
|
12692 | }
|
12693 | }
|
12694 |
|
12695 | var chainedCheckType = checkType.bind(null, false);
|
12696 | chainedCheckType.isRequired = checkType.bind(null, true);
|
12697 |
|
12698 | return chainedCheckType;
|
12699 | }
|
12700 |
|
12701 | function createPrimitiveTypeChecker(expectedType) {
|
12702 | function validate(props, propName, componentName, location, propFullName) {
|
12703 | var propValue = props[propName];
|
12704 | var propType = getPropType(propValue);
|
12705 | if (propType !== expectedType) {
|
12706 | var locationName = ReactPropTypeLocationNames[location];
|
12707 | // `propValue` being instance of, say, date/regexp, pass the 'object'
|
12708 | // check, but we can offer a more precise error message here rather than
|
12709 | // 'of type `object`'.
|
12710 | var preciseType = getPreciseType(propValue);
|
12711 |
|
12712 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
12713 | }
|
12714 | return null;
|
12715 | }
|
12716 | return createChainableTypeChecker(validate);
|
12717 | }
|
12718 |
|
12719 | function createAnyTypeChecker() {
|
12720 | return createChainableTypeChecker(emptyFunction.thatReturns(null));
|
12721 | }
|
12722 |
|
12723 | function createArrayOfTypeChecker(typeChecker) {
|
12724 | function validate(props, propName, componentName, location, propFullName) {
|
12725 | var propValue = props[propName];
|
12726 | if (!Array.isArray(propValue)) {
|
12727 | var locationName = ReactPropTypeLocationNames[location];
|
12728 | var propType = getPropType(propValue);
|
12729 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
12730 | }
|
12731 | for (var i = 0; i < propValue.length; i++) {
|
12732 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
|
12733 | if (error instanceof Error) {
|
12734 | return error;
|
12735 | }
|
12736 | }
|
12737 | return null;
|
12738 | }
|
12739 | return createChainableTypeChecker(validate);
|
12740 | }
|
12741 |
|
12742 | function createElementTypeChecker() {
|
12743 | function validate(props, propName, componentName, location, propFullName) {
|
12744 | if (!ReactElement.isValidElement(props[propName])) {
|
12745 | var locationName = ReactPropTypeLocationNames[location];
|
12746 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
|
12747 | }
|
12748 | return null;
|
12749 | }
|
12750 | return createChainableTypeChecker(validate);
|
12751 | }
|
12752 |
|
12753 | function createInstanceTypeChecker(expectedClass) {
|
12754 | function validate(props, propName, componentName, location, propFullName) {
|
12755 | if (!(props[propName] instanceof expectedClass)) {
|
12756 | var locationName = ReactPropTypeLocationNames[location];
|
12757 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
12758 | var actualClassName = getClassName(props[propName]);
|
12759 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
12760 | }
|
12761 | return null;
|
12762 | }
|
12763 | return createChainableTypeChecker(validate);
|
12764 | }
|
12765 |
|
12766 | function createEnumTypeChecker(expectedValues) {
|
12767 | if (!Array.isArray(expectedValues)) {
|
12768 | return createChainableTypeChecker(function () {
|
12769 | return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
|
12770 | });
|
12771 | }
|
12772 |
|
12773 | function validate(props, propName, componentName, location, propFullName) {
|
12774 | var propValue = props[propName];
|
12775 | for (var i = 0; i < expectedValues.length; i++) {
|
12776 | if (propValue === expectedValues[i]) {
|
12777 | return null;
|
12778 | }
|
12779 | }
|
12780 |
|
12781 | var locationName = ReactPropTypeLocationNames[location];
|
12782 | var valuesString = JSON.stringify(expectedValues);
|
12783 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
12784 | }
|
12785 | return createChainableTypeChecker(validate);
|
12786 | }
|
12787 |
|
12788 | function createObjectOfTypeChecker(typeChecker) {
|
12789 | function validate(props, propName, componentName, location, propFullName) {
|
12790 | var propValue = props[propName];
|
12791 | var propType = getPropType(propValue);
|
12792 | if (propType !== 'object') {
|
12793 | var locationName = ReactPropTypeLocationNames[location];
|
12794 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
12795 | }
|
12796 | for (var key in propValue) {
|
12797 | if (propValue.hasOwnProperty(key)) {
|
12798 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
|
12799 | if (error instanceof Error) {
|
12800 | return error;
|
12801 | }
|
12802 | }
|
12803 | }
|
12804 | return null;
|
12805 | }
|
12806 | return createChainableTypeChecker(validate);
|
12807 | }
|
12808 |
|
12809 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
12810 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
12811 | return createChainableTypeChecker(function () {
|
12812 | return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
|
12813 | });
|
12814 | }
|
12815 |
|
12816 | function validate(props, propName, componentName, location, propFullName) {
|
12817 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
12818 | var checker = arrayOfTypeCheckers[i];
|
12819 | if (checker(props, propName, componentName, location, propFullName) == null) {
|
12820 | return null;
|
12821 | }
|
12822 | }
|
12823 |
|
12824 | var locationName = ReactPropTypeLocationNames[location];
|
12825 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
12826 | }
|
12827 | return createChainableTypeChecker(validate);
|
12828 | }
|
12829 |
|
12830 | function createNodeChecker() {
|
12831 | function validate(props, propName, componentName, location, propFullName) {
|
12832 | if (!isNode(props[propName])) {
|
12833 | var locationName = ReactPropTypeLocationNames[location];
|
12834 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
12835 | }
|
12836 | return null;
|
12837 | }
|
12838 | return createChainableTypeChecker(validate);
|
12839 | }
|
12840 |
|
12841 | function createShapeTypeChecker(shapeTypes) {
|
12842 | function validate(props, propName, componentName, location, propFullName) {
|
12843 | var propValue = props[propName];
|
12844 | var propType = getPropType(propValue);
|
12845 | if (propType !== 'object') {
|
12846 | var locationName = ReactPropTypeLocationNames[location];
|
12847 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
12848 | }
|
12849 | for (var key in shapeTypes) {
|
12850 | var checker = shapeTypes[key];
|
12851 | if (!checker) {
|
12852 | continue;
|
12853 | }
|
12854 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
|
12855 | if (error) {
|
12856 | return error;
|
12857 | }
|
12858 | }
|
12859 | return null;
|
12860 | }
|
12861 | return createChainableTypeChecker(validate);
|
12862 | }
|
12863 |
|
12864 | function isNode(propValue) {
|
12865 | switch (typeof propValue) {
|
12866 | case 'number':
|
12867 | case 'string':
|
12868 | case 'undefined':
|
12869 | return true;
|
12870 | case 'boolean':
|
12871 | return !propValue;
|
12872 | case 'object':
|
12873 | if (Array.isArray(propValue)) {
|
12874 | return propValue.every(isNode);
|
12875 | }
|
12876 | if (propValue === null || ReactElement.isValidElement(propValue)) {
|
12877 | return true;
|
12878 | }
|
12879 |
|
12880 | var iteratorFn = getIteratorFn(propValue);
|
12881 | if (iteratorFn) {
|
12882 | var iterator = iteratorFn.call(propValue);
|
12883 | var step;
|
12884 | if (iteratorFn !== propValue.entries) {
|
12885 | while (!(step = iterator.next()).done) {
|
12886 | if (!isNode(step.value)) {
|
12887 | return false;
|
12888 | }
|
12889 | }
|
12890 | } else {
|
12891 | // Iterator will provide entry [k,v] tuples rather than values.
|
12892 | while (!(step = iterator.next()).done) {
|
12893 | var entry = step.value;
|
12894 | if (entry) {
|
12895 | if (!isNode(entry[1])) {
|
12896 | return false;
|
12897 | }
|
12898 | }
|
12899 | }
|
12900 | }
|
12901 | } else {
|
12902 | return false;
|
12903 | }
|
12904 |
|
12905 | return true;
|
12906 | default:
|
12907 | return false;
|
12908 | }
|
12909 | }
|
12910 |
|
12911 | // Equivalent of `typeof` but with special handling for array and regexp.
|
12912 | function getPropType(propValue) {
|
12913 | var propType = typeof propValue;
|
12914 | if (Array.isArray(propValue)) {
|
12915 | return 'array';
|
12916 | }
|
12917 | if (propValue instanceof RegExp) {
|
12918 | // Old webkits (at least until Android 4.0) return 'function' rather than
|
12919 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
12920 | // passes PropTypes.object.
|
12921 | return 'object';
|
12922 | }
|
12923 | return propType;
|
12924 | }
|
12925 |
|
12926 | // This handles more types than `getPropType`. Only used for error messages.
|
12927 | // See `createPrimitiveTypeChecker`.
|
12928 | function getPreciseType(propValue) {
|
12929 | var propType = getPropType(propValue);
|
12930 | if (propType === 'object') {
|
12931 | if (propValue instanceof Date) {
|
12932 | return 'date';
|
12933 | } else if (propValue instanceof RegExp) {
|
12934 | return 'regexp';
|
12935 | }
|
12936 | }
|
12937 | return propType;
|
12938 | }
|
12939 |
|
12940 | // Returns class name of the object, if any.
|
12941 | function getClassName(propValue) {
|
12942 | if (!propValue.constructor || !propValue.constructor.name) {
|
12943 | return '<<anonymous>>';
|
12944 | }
|
12945 | return propValue.constructor.name;
|
12946 | }
|
12947 |
|
12948 | module.exports = ReactPropTypes;
|
12949 |
|
12950 | /***/ },
|
12951 | /* 107 */
|
12952 | /***/ function(module, exports) {
|
12953 |
|
12954 | /**
|
12955 | * Copyright 2013-2015, Facebook, Inc.
|
12956 | * All rights reserved.
|
12957 | *
|
12958 | * This source code is licensed under the BSD-style license found in the
|
12959 | * LICENSE file in the root directory of this source tree. An additional grant
|
12960 | * of patent rights can be found in the PATENTS file in the same directory.
|
12961 | *
|
12962 | * @providesModule getIteratorFn
|
12963 | * @typechecks static-only
|
12964 | */
|
12965 |
|
12966 | 'use strict';
|
12967 |
|
12968 | /* global Symbol */
|
12969 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
12970 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
12971 |
|
12972 | /**
|
12973 | * Returns the iterator method function contained on the iterable object.
|
12974 | *
|
12975 | * Be sure to invoke the function with the iterable as context:
|
12976 | *
|
12977 | * var iteratorFn = getIteratorFn(myIterable);
|
12978 | * if (iteratorFn) {
|
12979 | * var iterator = iteratorFn.call(myIterable);
|
12980 | * ...
|
12981 | * }
|
12982 | *
|
12983 | * @param {?object} maybeIterable
|
12984 | * @return {?function}
|
12985 | */
|
12986 | function getIteratorFn(maybeIterable) {
|
12987 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
12988 | if (typeof iteratorFn === 'function') {
|
12989 | return iteratorFn;
|
12990 | }
|
12991 | }
|
12992 |
|
12993 | module.exports = getIteratorFn;
|
12994 |
|
12995 | /***/ },
|
12996 | /* 108 */
|
12997 | /***/ function(module, exports, __webpack_require__) {
|
12998 |
|
12999 | /**
|
13000 | * Copyright 2013-2015, Facebook, Inc.
|
13001 | * All rights reserved.
|
13002 | *
|
13003 | * This source code is licensed under the BSD-style license found in the
|
13004 | * LICENSE file in the root directory of this source tree. An additional grant
|
13005 | * of patent rights can be found in the PATENTS file in the same directory.
|
13006 | *
|
13007 | * @providesModule ReactDOMOption
|
13008 | */
|
13009 |
|
13010 | 'use strict';
|
13011 |
|
13012 | var ReactChildren = __webpack_require__(109);
|
13013 | var ReactDOMSelect = __webpack_require__(111);
|
13014 |
|
13015 | var assign = __webpack_require__(38);
|
13016 | var warning = __webpack_require__(24);
|
13017 |
|
13018 | var valueContextKey = ReactDOMSelect.valueContextKey;
|
13019 |
|
13020 | /**
|
13021 | * Implements an <option> native component that warns when `selected` is set.
|
13022 | */
|
13023 | var ReactDOMOption = {
|
13024 | mountWrapper: function (inst, props, context) {
|
13025 | // TODO (yungsters): Remove support for `selected` in <option>.
|
13026 | if (true) {
|
13027 | true ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
|
13028 | }
|
13029 |
|
13030 | // Look up whether this option is 'selected' via context
|
13031 | var selectValue = context[valueContextKey];
|
13032 |
|
13033 | // If context key is null (e.g., no specified value or after initial mount)
|
13034 | // or missing (e.g., for <datalist>), we don't change props.selected
|
13035 | var selected = null;
|
13036 | if (selectValue != null) {
|
13037 | selected = false;
|
13038 | if (Array.isArray(selectValue)) {
|
13039 | // multiple
|
13040 | for (var i = 0; i < selectValue.length; i++) {
|
13041 | if ('' + selectValue[i] === '' + props.value) {
|
13042 | selected = true;
|
13043 | break;
|
13044 | }
|
13045 | }
|
13046 | } else {
|
13047 | selected = '' + selectValue === '' + props.value;
|
13048 | }
|
13049 | }
|
13050 |
|
13051 | inst._wrapperState = { selected: selected };
|
13052 | },
|
13053 |
|
13054 | getNativeProps: function (inst, props, context) {
|
13055 | var nativeProps = assign({ selected: undefined, children: undefined }, props);
|
13056 |
|
13057 | // Read state only from initial mount because <select> updates value
|
13058 | // manually; we need the initial state only for server rendering
|
13059 | if (inst._wrapperState.selected != null) {
|
13060 | nativeProps.selected = inst._wrapperState.selected;
|
13061 | }
|
13062 |
|
13063 | var content = '';
|
13064 |
|
13065 | // Flatten children and warn if they aren't strings or numbers;
|
13066 | // invalid types are ignored.
|
13067 | ReactChildren.forEach(props.children, function (child) {
|
13068 | if (child == null) {
|
13069 | return;
|
13070 | }
|
13071 | if (typeof child === 'string' || typeof child === 'number') {
|
13072 | content += child;
|
13073 | } else {
|
13074 | true ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
|
13075 | }
|
13076 | });
|
13077 |
|
13078 | if (content) {
|
13079 | nativeProps.children = content;
|
13080 | }
|
13081 |
|
13082 | return nativeProps;
|
13083 | }
|
13084 |
|
13085 | };
|
13086 |
|
13087 | module.exports = ReactDOMOption;
|
13088 |
|
13089 | /***/ },
|
13090 | /* 109 */
|
13091 | /***/ function(module, exports, __webpack_require__) {
|
13092 |
|
13093 | /**
|
13094 | * Copyright 2013-2015, Facebook, Inc.
|
13095 | * All rights reserved.
|
13096 | *
|
13097 | * This source code is licensed under the BSD-style license found in the
|
13098 | * LICENSE file in the root directory of this source tree. An additional grant
|
13099 | * of patent rights can be found in the PATENTS file in the same directory.
|
13100 | *
|
13101 | * @providesModule ReactChildren
|
13102 | */
|
13103 |
|
13104 | 'use strict';
|
13105 |
|
13106 | var PooledClass = __webpack_require__(55);
|
13107 | var ReactElement = __webpack_require__(41);
|
13108 |
|
13109 | var emptyFunction = __webpack_require__(14);
|
13110 | var traverseAllChildren = __webpack_require__(110);
|
13111 |
|
13112 | var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
13113 | var fourArgumentPooler = PooledClass.fourArgumentPooler;
|
13114 |
|
13115 | var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
|
13116 | function escapeUserProvidedKey(text) {
|
13117 | return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
|
13118 | }
|
13119 |
|
13120 | /**
|
13121 | * PooledClass representing the bookkeeping associated with performing a child
|
13122 | * traversal. Allows avoiding binding callbacks.
|
13123 | *
|
13124 | * @constructor ForEachBookKeeping
|
13125 | * @param {!function} forEachFunction Function to perform traversal with.
|
13126 | * @param {?*} forEachContext Context to perform context with.
|
13127 | */
|
13128 | function ForEachBookKeeping(forEachFunction, forEachContext) {
|
13129 | this.func = forEachFunction;
|
13130 | this.context = forEachContext;
|
13131 | this.count = 0;
|
13132 | }
|
13133 | ForEachBookKeeping.prototype.destructor = function () {
|
13134 | this.func = null;
|
13135 | this.context = null;
|
13136 | this.count = 0;
|
13137 | };
|
13138 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
13139 |
|
13140 | function forEachSingleChild(bookKeeping, child, name) {
|
13141 | var func = bookKeeping.func;
|
13142 | var context = bookKeeping.context;
|
13143 |
|
13144 | func.call(context, child, bookKeeping.count++);
|
13145 | }
|
13146 |
|
13147 | /**
|
13148 | * Iterates through children that are typically specified as `props.children`.
|
13149 | *
|
13150 | * The provided forEachFunc(child, index) will be called for each
|
13151 | * leaf child.
|
13152 | *
|
13153 | * @param {?*} children Children tree container.
|
13154 | * @param {function(*, int)} forEachFunc
|
13155 | * @param {*} forEachContext Context for forEachContext.
|
13156 | */
|
13157 | function forEachChildren(children, forEachFunc, forEachContext) {
|
13158 | if (children == null) {
|
13159 | return children;
|
13160 | }
|
13161 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
13162 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
13163 | ForEachBookKeeping.release(traverseContext);
|
13164 | }
|
13165 |
|
13166 | /**
|
13167 | * PooledClass representing the bookkeeping associated with performing a child
|
13168 | * mapping. Allows avoiding binding callbacks.
|
13169 | *
|
13170 | * @constructor MapBookKeeping
|
13171 | * @param {!*} mapResult Object containing the ordered map of results.
|
13172 | * @param {!function} mapFunction Function to perform mapping with.
|
13173 | * @param {?*} mapContext Context to perform mapping with.
|
13174 | */
|
13175 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
13176 | this.result = mapResult;
|
13177 | this.keyPrefix = keyPrefix;
|
13178 | this.func = mapFunction;
|
13179 | this.context = mapContext;
|
13180 | this.count = 0;
|
13181 | }
|
13182 | MapBookKeeping.prototype.destructor = function () {
|
13183 | this.result = null;
|
13184 | this.keyPrefix = null;
|
13185 | this.func = null;
|
13186 | this.context = null;
|
13187 | this.count = 0;
|
13188 | };
|
13189 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
13190 |
|
13191 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
13192 | var result = bookKeeping.result;
|
13193 | var keyPrefix = bookKeeping.keyPrefix;
|
13194 | var func = bookKeeping.func;
|
13195 | var context = bookKeeping.context;
|
13196 |
|
13197 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
13198 | if (Array.isArray(mappedChild)) {
|
13199 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
13200 | } else if (mappedChild != null) {
|
13201 | if (ReactElement.isValidElement(mappedChild)) {
|
13202 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
|
13203 | // Keep both the (mapped) and old keys if they differ, just as
|
13204 | // traverseAllChildren used to do for objects as children
|
13205 | keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
|
13206 | }
|
13207 | result.push(mappedChild);
|
13208 | }
|
13209 | }
|
13210 |
|
13211 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
13212 | var escapedPrefix = '';
|
13213 | if (prefix != null) {
|
13214 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
13215 | }
|
13216 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
13217 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
13218 | MapBookKeeping.release(traverseContext);
|
13219 | }
|
13220 |
|
13221 | /**
|
13222 | * Maps children that are typically specified as `props.children`.
|
13223 | *
|
13224 | * The provided mapFunction(child, key, index) will be called for each
|
13225 | * leaf child.
|
13226 | *
|
13227 | * @param {?*} children Children tree container.
|
13228 | * @param {function(*, int)} func The map function.
|
13229 | * @param {*} context Context for mapFunction.
|
13230 | * @return {object} Object containing the ordered map of results.
|
13231 | */
|
13232 | function mapChildren(children, func, context) {
|
13233 | if (children == null) {
|
13234 | return children;
|
13235 | }
|
13236 | var result = [];
|
13237 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
13238 | return result;
|
13239 | }
|
13240 |
|
13241 | function forEachSingleChildDummy(traverseContext, child, name) {
|
13242 | return null;
|
13243 | }
|
13244 |
|
13245 | /**
|
13246 | * Count the number of children that are typically specified as
|
13247 | * `props.children`.
|
13248 | *
|
13249 | * @param {?*} children Children tree container.
|
13250 | * @return {number} The number of children.
|
13251 | */
|
13252 | function countChildren(children, context) {
|
13253 | return traverseAllChildren(children, forEachSingleChildDummy, null);
|
13254 | }
|
13255 |
|
13256 | /**
|
13257 | * Flatten a children object (typically specified as `props.children`) and
|
13258 | * return an array with appropriately re-keyed children.
|
13259 | */
|
13260 | function toArray(children) {
|
13261 | var result = [];
|
13262 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
13263 | return result;
|
13264 | }
|
13265 |
|
13266 | var ReactChildren = {
|
13267 | forEach: forEachChildren,
|
13268 | map: mapChildren,
|
13269 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
13270 | count: countChildren,
|
13271 | toArray: toArray
|
13272 | };
|
13273 |
|
13274 | module.exports = ReactChildren;
|
13275 |
|
13276 | /***/ },
|
13277 | /* 110 */
|
13278 | /***/ function(module, exports, __webpack_require__) {
|
13279 |
|
13280 | /**
|
13281 | * Copyright 2013-2015, Facebook, Inc.
|
13282 | * All rights reserved.
|
13283 | *
|
13284 | * This source code is licensed under the BSD-style license found in the
|
13285 | * LICENSE file in the root directory of this source tree. An additional grant
|
13286 | * of patent rights can be found in the PATENTS file in the same directory.
|
13287 | *
|
13288 | * @providesModule traverseAllChildren
|
13289 | */
|
13290 |
|
13291 | 'use strict';
|
13292 |
|
13293 | var ReactCurrentOwner = __webpack_require__(4);
|
13294 | var ReactElement = __webpack_require__(41);
|
13295 | var ReactInstanceHandles = __webpack_require__(44);
|
13296 |
|
13297 | var getIteratorFn = __webpack_require__(107);
|
13298 | var invariant = __webpack_require__(12);
|
13299 | var warning = __webpack_require__(24);
|
13300 |
|
13301 | var SEPARATOR = ReactInstanceHandles.SEPARATOR;
|
13302 | var SUBSEPARATOR = ':';
|
13303 |
|
13304 | /**
|
13305 | * TODO: Test that a single child and an array with one item have the same key
|
13306 | * pattern.
|
13307 | */
|
13308 |
|
13309 | var userProvidedKeyEscaperLookup = {
|
13310 | '=': '=0',
|
13311 | '.': '=1',
|
13312 | ':': '=2'
|
13313 | };
|
13314 |
|
13315 | var userProvidedKeyEscapeRegex = /[=.:]/g;
|
13316 |
|
13317 | var didWarnAboutMaps = false;
|
13318 |
|
13319 | function userProvidedKeyEscaper(match) {
|
13320 | return userProvidedKeyEscaperLookup[match];
|
13321 | }
|
13322 |
|
13323 | /**
|
13324 | * Generate a key string that identifies a component within a set.
|
13325 | *
|
13326 | * @param {*} component A component that could contain a manual key.
|
13327 | * @param {number} index Index that is used if a manual key is not provided.
|
13328 | * @return {string}
|
13329 | */
|
13330 | function getComponentKey(component, index) {
|
13331 | if (component && component.key != null) {
|
13332 | // Explicit key
|
13333 | return wrapUserProvidedKey(component.key);
|
13334 | }
|
13335 | // Implicit key determined by the index in the set
|
13336 | return index.toString(36);
|
13337 | }
|
13338 |
|
13339 | /**
|
13340 | * Escape a component key so that it is safe to use in a reactid.
|
13341 | *
|
13342 | * @param {*} text Component key to be escaped.
|
13343 | * @return {string} An escaped string.
|
13344 | */
|
13345 | function escapeUserProvidedKey(text) {
|
13346 | return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
|
13347 | }
|
13348 |
|
13349 | /**
|
13350 | * Wrap a `key` value explicitly provided by the user to distinguish it from
|
13351 | * implicitly-generated keys generated by a component's index in its parent.
|
13352 | *
|
13353 | * @param {string} key Value of a user-provided `key` attribute
|
13354 | * @return {string}
|
13355 | */
|
13356 | function wrapUserProvidedKey(key) {
|
13357 | return '$' + escapeUserProvidedKey(key);
|
13358 | }
|
13359 |
|
13360 | /**
|
13361 | * @param {?*} children Children tree container.
|
13362 | * @param {!string} nameSoFar Name of the key path so far.
|
13363 | * @param {!function} callback Callback to invoke with each child found.
|
13364 | * @param {?*} traverseContext Used to pass information throughout the traversal
|
13365 | * process.
|
13366 | * @return {!number} The number of children in this subtree.
|
13367 | */
|
13368 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
13369 | var type = typeof children;
|
13370 |
|
13371 | if (type === 'undefined' || type === 'boolean') {
|
13372 | // All of the above are perceived as null.
|
13373 | children = null;
|
13374 | }
|
13375 |
|
13376 | if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
|
13377 | callback(traverseContext, children,
|
13378 | // If it's the only child, treat the name as if it was wrapped in an array
|
13379 | // so that it's consistent if the number of children grows.
|
13380 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
13381 | return 1;
|
13382 | }
|
13383 |
|
13384 | var child;
|
13385 | var nextName;
|
13386 | var subtreeCount = 0; // Count of children found in the current subtree.
|
13387 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
13388 |
|
13389 | if (Array.isArray(children)) {
|
13390 | for (var i = 0; i < children.length; i++) {
|
13391 | child = children[i];
|
13392 | nextName = nextNamePrefix + getComponentKey(child, i);
|
13393 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13394 | }
|
13395 | } else {
|
13396 | var iteratorFn = getIteratorFn(children);
|
13397 | if (iteratorFn) {
|
13398 | var iterator = iteratorFn.call(children);
|
13399 | var step;
|
13400 | if (iteratorFn !== children.entries) {
|
13401 | var ii = 0;
|
13402 | while (!(step = iterator.next()).done) {
|
13403 | child = step.value;
|
13404 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
13405 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13406 | }
|
13407 | } else {
|
13408 | if (true) {
|
13409 | true ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
|
13410 | didWarnAboutMaps = true;
|
13411 | }
|
13412 | // Iterator will provide entry [k,v] tuples rather than values.
|
13413 | while (!(step = iterator.next()).done) {
|
13414 | var entry = step.value;
|
13415 | if (entry) {
|
13416 | child = entry[1];
|
13417 | nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
|
13418 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13419 | }
|
13420 | }
|
13421 | }
|
13422 | } else if (type === 'object') {
|
13423 | var addendum = '';
|
13424 | if (true) {
|
13425 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
|
13426 | if (children._isReactElement) {
|
13427 | addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
|
13428 | }
|
13429 | if (ReactCurrentOwner.current) {
|
13430 | var name = ReactCurrentOwner.current.getName();
|
13431 | if (name) {
|
13432 | addendum += ' Check the render method of `' + name + '`.';
|
13433 | }
|
13434 | }
|
13435 | }
|
13436 | var childrenString = String(children);
|
13437 | true ? true ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
|
13438 | }
|
13439 | }
|
13440 |
|
13441 | return subtreeCount;
|
13442 | }
|
13443 |
|
13444 | /**
|
13445 | * Traverses children that are typically specified as `props.children`, but
|
13446 | * might also be specified through attributes:
|
13447 | *
|
13448 | * - `traverseAllChildren(this.props.children, ...)`
|
13449 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
13450 | *
|
13451 | * The `traverseContext` is an optional argument that is passed through the
|
13452 | * entire traversal. It can be used to store accumulations or anything else that
|
13453 | * the callback might find relevant.
|
13454 | *
|
13455 | * @param {?*} children Children tree object.
|
13456 | * @param {!function} callback To invoke upon traversing each child.
|
13457 | * @param {?*} traverseContext Context for traversal.
|
13458 | * @return {!number} The number of children in this subtree.
|
13459 | */
|
13460 | function traverseAllChildren(children, callback, traverseContext) {
|
13461 | if (children == null) {
|
13462 | return 0;
|
13463 | }
|
13464 |
|
13465 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
13466 | }
|
13467 |
|
13468 | module.exports = traverseAllChildren;
|
13469 |
|
13470 | /***/ },
|
13471 | /* 111 */
|
13472 | /***/ function(module, exports, __webpack_require__) {
|
13473 |
|
13474 | /**
|
13475 | * Copyright 2013-2015, Facebook, Inc.
|
13476 | * All rights reserved.
|
13477 | *
|
13478 | * This source code is licensed under the BSD-style license found in the
|
13479 | * LICENSE file in the root directory of this source tree. An additional grant
|
13480 | * of patent rights can be found in the PATENTS file in the same directory.
|
13481 | *
|
13482 | * @providesModule ReactDOMSelect
|
13483 | */
|
13484 |
|
13485 | 'use strict';
|
13486 |
|
13487 | var LinkedValueUtils = __webpack_require__(105);
|
13488 | var ReactMount = __webpack_require__(27);
|
13489 | var ReactUpdates = __webpack_require__(53);
|
13490 |
|
13491 | var assign = __webpack_require__(38);
|
13492 | var warning = __webpack_require__(24);
|
13493 |
|
13494 | var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
|
13495 |
|
13496 | function updateOptionsIfPendingUpdateAndMounted() {
|
13497 | if (this._rootNodeID && this._wrapperState.pendingUpdate) {
|
13498 | this._wrapperState.pendingUpdate = false;
|
13499 |
|
13500 | var props = this._currentElement.props;
|
13501 | var value = LinkedValueUtils.getValue(props);
|
13502 |
|
13503 | if (value != null) {
|
13504 | updateOptions(this, Boolean(props.multiple), value);
|
13505 | }
|
13506 | }
|
13507 | }
|
13508 |
|
13509 | function getDeclarationErrorAddendum(owner) {
|
13510 | if (owner) {
|
13511 | var name = owner.getName();
|
13512 | if (name) {
|
13513 | return ' Check the render method of `' + name + '`.';
|
13514 | }
|
13515 | }
|
13516 | return '';
|
13517 | }
|
13518 |
|
13519 | var valuePropNames = ['value', 'defaultValue'];
|
13520 |
|
13521 | /**
|
13522 | * Validation function for `value` and `defaultValue`.
|
13523 | * @private
|
13524 | */
|
13525 | function checkSelectPropTypes(inst, props) {
|
13526 | var owner = inst._currentElement._owner;
|
13527 | LinkedValueUtils.checkPropTypes('select', props, owner);
|
13528 |
|
13529 | for (var i = 0; i < valuePropNames.length; i++) {
|
13530 | var propName = valuePropNames[i];
|
13531 | if (props[propName] == null) {
|
13532 | continue;
|
13533 | }
|
13534 | if (props.multiple) {
|
13535 | true ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
|
13536 | } else {
|
13537 | true ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
|
13538 | }
|
13539 | }
|
13540 | }
|
13541 |
|
13542 | /**
|
13543 | * @param {ReactDOMComponent} inst
|
13544 | * @param {boolean} multiple
|
13545 | * @param {*} propValue A stringable (with `multiple`, a list of stringables).
|
13546 | * @private
|
13547 | */
|
13548 | function updateOptions(inst, multiple, propValue) {
|
13549 | var selectedValue, i;
|
13550 | var options = ReactMount.getNode(inst._rootNodeID).options;
|
13551 |
|
13552 | if (multiple) {
|
13553 | selectedValue = {};
|
13554 | for (i = 0; i < propValue.length; i++) {
|
13555 | selectedValue['' + propValue[i]] = true;
|
13556 | }
|
13557 | for (i = 0; i < options.length; i++) {
|
13558 | var selected = selectedValue.hasOwnProperty(options[i].value);
|
13559 | if (options[i].selected !== selected) {
|
13560 | options[i].selected = selected;
|
13561 | }
|
13562 | }
|
13563 | } else {
|
13564 | // Do not set `select.value` as exact behavior isn't consistent across all
|
13565 | // browsers for all cases.
|
13566 | selectedValue = '' + propValue;
|
13567 | for (i = 0; i < options.length; i++) {
|
13568 | if (options[i].value === selectedValue) {
|
13569 | options[i].selected = true;
|
13570 | return;
|
13571 | }
|
13572 | }
|
13573 | if (options.length) {
|
13574 | options[0].selected = true;
|
13575 | }
|
13576 | }
|
13577 | }
|
13578 |
|
13579 | /**
|
13580 | * Implements a <select> native component that allows optionally setting the
|
13581 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
|
13582 | * stringable. If `multiple` is true, the prop must be an array of stringables.
|
13583 | *
|
13584 | * If `value` is not supplied (or null/undefined), user actions that change the
|
13585 | * selected option will trigger updates to the rendered options.
|
13586 | *
|
13587 | * If it is supplied (and not null/undefined), the rendered options will not
|
13588 | * update in response to user actions. Instead, the `value` prop must change in
|
13589 | * order for the rendered options to update.
|
13590 | *
|
13591 | * If `defaultValue` is provided, any options with the supplied values will be
|
13592 | * selected.
|
13593 | */
|
13594 | var ReactDOMSelect = {
|
13595 | valueContextKey: valueContextKey,
|
13596 |
|
13597 | getNativeProps: function (inst, props, context) {
|
13598 | return assign({}, props, {
|
13599 | onChange: inst._wrapperState.onChange,
|
13600 | value: undefined
|
13601 | });
|
13602 | },
|
13603 |
|
13604 | mountWrapper: function (inst, props) {
|
13605 | if (true) {
|
13606 | checkSelectPropTypes(inst, props);
|
13607 | }
|
13608 |
|
13609 | var value = LinkedValueUtils.getValue(props);
|
13610 | inst._wrapperState = {
|
13611 | pendingUpdate: false,
|
13612 | initialValue: value != null ? value : props.defaultValue,
|
13613 | onChange: _handleChange.bind(inst),
|
13614 | wasMultiple: Boolean(props.multiple)
|
13615 | };
|
13616 | },
|
13617 |
|
13618 | processChildContext: function (inst, props, context) {
|
13619 | // Pass down initial value so initial generated markup has correct
|
13620 | // `selected` attributes
|
13621 | var childContext = assign({}, context);
|
13622 | childContext[valueContextKey] = inst._wrapperState.initialValue;
|
13623 | return childContext;
|
13624 | },
|
13625 |
|
13626 | postUpdateWrapper: function (inst) {
|
13627 | var props = inst._currentElement.props;
|
13628 |
|
13629 | // After the initial mount, we control selected-ness manually so don't pass
|
13630 | // the context value down
|
13631 | inst._wrapperState.initialValue = undefined;
|
13632 |
|
13633 | var wasMultiple = inst._wrapperState.wasMultiple;
|
13634 | inst._wrapperState.wasMultiple = Boolean(props.multiple);
|
13635 |
|
13636 | var value = LinkedValueUtils.getValue(props);
|
13637 | if (value != null) {
|
13638 | inst._wrapperState.pendingUpdate = false;
|
13639 | updateOptions(inst, Boolean(props.multiple), value);
|
13640 | } else if (wasMultiple !== Boolean(props.multiple)) {
|
13641 | // For simplicity, reapply `defaultValue` if `multiple` is toggled.
|
13642 | if (props.defaultValue != null) {
|
13643 | updateOptions(inst, Boolean(props.multiple), props.defaultValue);
|
13644 | } else {
|
13645 | // Revert the select back to its default unselected state.
|
13646 | updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
|
13647 | }
|
13648 | }
|
13649 | }
|
13650 | };
|
13651 |
|
13652 | function _handleChange(event) {
|
13653 | var props = this._currentElement.props;
|
13654 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
13655 |
|
13656 | this._wrapperState.pendingUpdate = true;
|
13657 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
|
13658 | return returnValue;
|
13659 | }
|
13660 |
|
13661 | module.exports = ReactDOMSelect;
|
13662 |
|
13663 | /***/ },
|
13664 | /* 112 */
|
13665 | /***/ function(module, exports, __webpack_require__) {
|
13666 |
|
13667 | /**
|
13668 | * Copyright 2013-2015, Facebook, Inc.
|
13669 | * All rights reserved.
|
13670 | *
|
13671 | * This source code is licensed under the BSD-style license found in the
|
13672 | * LICENSE file in the root directory of this source tree. An additional grant
|
13673 | * of patent rights can be found in the PATENTS file in the same directory.
|
13674 | *
|
13675 | * @providesModule ReactDOMTextarea
|
13676 | */
|
13677 |
|
13678 | 'use strict';
|
13679 |
|
13680 | var LinkedValueUtils = __webpack_require__(105);
|
13681 | var ReactDOMIDOperations = __webpack_require__(26);
|
13682 | var ReactUpdates = __webpack_require__(53);
|
13683 |
|
13684 | var assign = __webpack_require__(38);
|
13685 | var invariant = __webpack_require__(12);
|
13686 | var warning = __webpack_require__(24);
|
13687 |
|
13688 | function forceUpdateIfMounted() {
|
13689 | if (this._rootNodeID) {
|
13690 | // DOM component is still mounted; update
|
13691 | ReactDOMTextarea.updateWrapper(this);
|
13692 | }
|
13693 | }
|
13694 |
|
13695 | /**
|
13696 | * Implements a <textarea> native component that allows setting `value`, and
|
13697 | * `defaultValue`. This differs from the traditional DOM API because value is
|
13698 | * usually set as PCDATA children.
|
13699 | *
|
13700 | * If `value` is not supplied (or null/undefined), user actions that affect the
|
13701 | * value will trigger updates to the element.
|
13702 | *
|
13703 | * If `value` is supplied (and not null/undefined), the rendered element will
|
13704 | * not trigger updates to the element. Instead, the `value` prop must change in
|
13705 | * order for the rendered element to be updated.
|
13706 | *
|
13707 | * The rendered element will be initialized with an empty value, the prop
|
13708 | * `defaultValue` if specified, or the children content (deprecated).
|
13709 | */
|
13710 | var ReactDOMTextarea = {
|
13711 | getNativeProps: function (inst, props, context) {
|
13712 | !(props.dangerouslySetInnerHTML == null) ? true ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
|
13713 |
|
13714 | // Always set children to the same thing. In IE9, the selection range will
|
13715 | // get reset if `textContent` is mutated.
|
13716 | var nativeProps = assign({}, props, {
|
13717 | defaultValue: undefined,
|
13718 | value: undefined,
|
13719 | children: inst._wrapperState.initialValue,
|
13720 | onChange: inst._wrapperState.onChange
|
13721 | });
|
13722 |
|
13723 | return nativeProps;
|
13724 | },
|
13725 |
|
13726 | mountWrapper: function (inst, props) {
|
13727 | if (true) {
|
13728 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
|
13729 | }
|
13730 |
|
13731 | var defaultValue = props.defaultValue;
|
13732 | // TODO (yungsters): Remove support for children content in <textarea>.
|
13733 | var children = props.children;
|
13734 | if (children != null) {
|
13735 | if (true) {
|
13736 | true ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
|
13737 | }
|
13738 | !(defaultValue == null) ? true ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
|
13739 | if (Array.isArray(children)) {
|
13740 | !(children.length <= 1) ? true ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
|
13741 | children = children[0];
|
13742 | }
|
13743 |
|
13744 | defaultValue = '' + children;
|
13745 | }
|
13746 | if (defaultValue == null) {
|
13747 | defaultValue = '';
|
13748 | }
|
13749 | var value = LinkedValueUtils.getValue(props);
|
13750 |
|
13751 | inst._wrapperState = {
|
13752 | // We save the initial value so that `ReactDOMComponent` doesn't update
|
13753 | // `textContent` (unnecessary since we update value).
|
13754 | // The initial value can be a boolean or object so that's why it's
|
13755 | // forced to be a string.
|
13756 | initialValue: '' + (value != null ? value : defaultValue),
|
13757 | onChange: _handleChange.bind(inst)
|
13758 | };
|
13759 | },
|
13760 |
|
13761 | updateWrapper: function (inst) {
|
13762 | var props = inst._currentElement.props;
|
13763 | var value = LinkedValueUtils.getValue(props);
|
13764 | if (value != null) {
|
13765 | // Cast `value` to a string to ensure the value is set correctly. While
|
13766 | // browsers typically do this as necessary, jsdom doesn't.
|
13767 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
|
13768 | }
|
13769 | }
|
13770 | };
|
13771 |
|
13772 | function _handleChange(event) {
|
13773 | var props = this._currentElement.props;
|
13774 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
13775 | ReactUpdates.asap(forceUpdateIfMounted, this);
|
13776 | return returnValue;
|
13777 | }
|
13778 |
|
13779 | module.exports = ReactDOMTextarea;
|
13780 |
|
13781 | /***/ },
|
13782 | /* 113 */
|
13783 | /***/ function(module, exports, __webpack_require__) {
|
13784 |
|
13785 | /**
|
13786 | * Copyright 2013-2015, Facebook, Inc.
|
13787 | * All rights reserved.
|
13788 | *
|
13789 | * This source code is licensed under the BSD-style license found in the
|
13790 | * LICENSE file in the root directory of this source tree. An additional grant
|
13791 | * of patent rights can be found in the PATENTS file in the same directory.
|
13792 | *
|
13793 | * @providesModule ReactMultiChild
|
13794 | * @typechecks static-only
|
13795 | */
|
13796 |
|
13797 | 'use strict';
|
13798 |
|
13799 | var ReactComponentEnvironment = __webpack_require__(63);
|
13800 | var ReactMultiChildUpdateTypes = __webpack_require__(15);
|
13801 |
|
13802 | var ReactCurrentOwner = __webpack_require__(4);
|
13803 | var ReactReconciler = __webpack_require__(49);
|
13804 | var ReactChildReconciler = __webpack_require__(114);
|
13805 |
|
13806 | var flattenChildren = __webpack_require__(115);
|
13807 |
|
13808 | /**
|
13809 | * Updating children of a component may trigger recursive updates. The depth is
|
13810 | * used to batch recursive updates to render markup more efficiently.
|
13811 | *
|
13812 | * @type {number}
|
13813 | * @private
|
13814 | */
|
13815 | var updateDepth = 0;
|
13816 |
|
13817 | /**
|
13818 | * Queue of update configuration objects.
|
13819 | *
|
13820 | * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
|
13821 | *
|
13822 | * @type {array<object>}
|
13823 | * @private
|
13824 | */
|
13825 | var updateQueue = [];
|
13826 |
|
13827 | /**
|
13828 | * Queue of markup to be rendered.
|
13829 | *
|
13830 | * @type {array<string>}
|
13831 | * @private
|
13832 | */
|
13833 | var markupQueue = [];
|
13834 |
|
13835 | /**
|
13836 | * Enqueues markup to be rendered and inserted at a supplied index.
|
13837 | *
|
13838 | * @param {string} parentID ID of the parent component.
|
13839 | * @param {string} markup Markup that renders into an element.
|
13840 | * @param {number} toIndex Destination index.
|
13841 | * @private
|
13842 | */
|
13843 | function enqueueInsertMarkup(parentID, markup, toIndex) {
|
13844 | // NOTE: Null values reduce hidden classes.
|
13845 | updateQueue.push({
|
13846 | parentID: parentID,
|
13847 | parentNode: null,
|
13848 | type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
|
13849 | markupIndex: markupQueue.push(markup) - 1,
|
13850 | content: null,
|
13851 | fromIndex: null,
|
13852 | toIndex: toIndex
|
13853 | });
|
13854 | }
|
13855 |
|
13856 | /**
|
13857 | * Enqueues moving an existing element to another index.
|
13858 | *
|
13859 | * @param {string} parentID ID of the parent component.
|
13860 | * @param {number} fromIndex Source index of the existing element.
|
13861 | * @param {number} toIndex Destination index of the element.
|
13862 | * @private
|
13863 | */
|
13864 | function enqueueMove(parentID, fromIndex, toIndex) {
|
13865 | // NOTE: Null values reduce hidden classes.
|
13866 | updateQueue.push({
|
13867 | parentID: parentID,
|
13868 | parentNode: null,
|
13869 | type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
|
13870 | markupIndex: null,
|
13871 | content: null,
|
13872 | fromIndex: fromIndex,
|
13873 | toIndex: toIndex
|
13874 | });
|
13875 | }
|
13876 |
|
13877 | /**
|
13878 | * Enqueues removing an element at an index.
|
13879 | *
|
13880 | * @param {string} parentID ID of the parent component.
|
13881 | * @param {number} fromIndex Index of the element to remove.
|
13882 | * @private
|
13883 | */
|
13884 | function enqueueRemove(parentID, fromIndex) {
|
13885 | // NOTE: Null values reduce hidden classes.
|
13886 | updateQueue.push({
|
13887 | parentID: parentID,
|
13888 | parentNode: null,
|
13889 | type: ReactMultiChildUpdateTypes.REMOVE_NODE,
|
13890 | markupIndex: null,
|
13891 | content: null,
|
13892 | fromIndex: fromIndex,
|
13893 | toIndex: null
|
13894 | });
|
13895 | }
|
13896 |
|
13897 | /**
|
13898 | * Enqueues setting the markup of a node.
|
13899 | *
|
13900 | * @param {string} parentID ID of the parent component.
|
13901 | * @param {string} markup Markup that renders into an element.
|
13902 | * @private
|
13903 | */
|
13904 | function enqueueSetMarkup(parentID, markup) {
|
13905 | // NOTE: Null values reduce hidden classes.
|
13906 | updateQueue.push({
|
13907 | parentID: parentID,
|
13908 | parentNode: null,
|
13909 | type: ReactMultiChildUpdateTypes.SET_MARKUP,
|
13910 | markupIndex: null,
|
13911 | content: markup,
|
13912 | fromIndex: null,
|
13913 | toIndex: null
|
13914 | });
|
13915 | }
|
13916 |
|
13917 | /**
|
13918 | * Enqueues setting the text content.
|
13919 | *
|
13920 | * @param {string} parentID ID of the parent component.
|
13921 | * @param {string} textContent Text content to set.
|
13922 | * @private
|
13923 | */
|
13924 | function enqueueTextContent(parentID, textContent) {
|
13925 | // NOTE: Null values reduce hidden classes.
|
13926 | updateQueue.push({
|
13927 | parentID: parentID,
|
13928 | parentNode: null,
|
13929 | type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
|
13930 | markupIndex: null,
|
13931 | content: textContent,
|
13932 | fromIndex: null,
|
13933 | toIndex: null
|
13934 | });
|
13935 | }
|
13936 |
|
13937 | /**
|
13938 | * Processes any enqueued updates.
|
13939 | *
|
13940 | * @private
|
13941 | */
|
13942 | function processQueue() {
|
13943 | if (updateQueue.length) {
|
13944 | ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
|
13945 | clearQueue();
|
13946 | }
|
13947 | }
|
13948 |
|
13949 | /**
|
13950 | * Clears any enqueued updates.
|
13951 | *
|
13952 | * @private
|
13953 | */
|
13954 | function clearQueue() {
|
13955 | updateQueue.length = 0;
|
13956 | markupQueue.length = 0;
|
13957 | }
|
13958 |
|
13959 | /**
|
13960 | * ReactMultiChild are capable of reconciling multiple children.
|
13961 | *
|
13962 | * @class ReactMultiChild
|
13963 | * @internal
|
13964 | */
|
13965 | var ReactMultiChild = {
|
13966 |
|
13967 | /**
|
13968 | * Provides common functionality for components that must reconcile multiple
|
13969 | * children. This is used by `ReactDOMComponent` to mount, update, and
|
13970 | * unmount child components.
|
13971 | *
|
13972 | * @lends {ReactMultiChild.prototype}
|
13973 | */
|
13974 | Mixin: {
|
13975 |
|
13976 | _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
|
13977 | if (true) {
|
13978 | if (this._currentElement) {
|
13979 | try {
|
13980 | ReactCurrentOwner.current = this._currentElement._owner;
|
13981 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
13982 | } finally {
|
13983 | ReactCurrentOwner.current = null;
|
13984 | }
|
13985 | }
|
13986 | }
|
13987 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
13988 | },
|
13989 |
|
13990 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
|
13991 | var nextChildren;
|
13992 | if (true) {
|
13993 | if (this._currentElement) {
|
13994 | try {
|
13995 | ReactCurrentOwner.current = this._currentElement._owner;
|
13996 | nextChildren = flattenChildren(nextNestedChildrenElements);
|
13997 | } finally {
|
13998 | ReactCurrentOwner.current = null;
|
13999 | }
|
14000 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
14001 | }
|
14002 | }
|
14003 | nextChildren = flattenChildren(nextNestedChildrenElements);
|
14004 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
14005 | },
|
14006 |
|
14007 | /**
|
14008 | * Generates a "mount image" for each of the supplied children. In the case
|
14009 | * of `ReactDOMComponent`, a mount image is a string of markup.
|
14010 | *
|
14011 | * @param {?object} nestedChildren Nested child maps.
|
14012 | * @return {array} An array of mounted representations.
|
14013 | * @internal
|
14014 | */
|
14015 | mountChildren: function (nestedChildren, transaction, context) {
|
14016 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
|
14017 | this._renderedChildren = children;
|
14018 | var mountImages = [];
|
14019 | var index = 0;
|
14020 | for (var name in children) {
|
14021 | if (children.hasOwnProperty(name)) {
|
14022 | var child = children[name];
|
14023 | // Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
14024 | var rootID = this._rootNodeID + name;
|
14025 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
|
14026 | child._mountIndex = index++;
|
14027 | mountImages.push(mountImage);
|
14028 | }
|
14029 | }
|
14030 | return mountImages;
|
14031 | },
|
14032 |
|
14033 | /**
|
14034 | * Replaces any rendered children with a text content string.
|
14035 | *
|
14036 | * @param {string} nextContent String of content.
|
14037 | * @internal
|
14038 | */
|
14039 | updateTextContent: function (nextContent) {
|
14040 | updateDepth++;
|
14041 | var errorThrown = true;
|
14042 | try {
|
14043 | var prevChildren = this._renderedChildren;
|
14044 | // Remove any rendered children.
|
14045 | ReactChildReconciler.unmountChildren(prevChildren);
|
14046 | // TODO: The setTextContent operation should be enough
|
14047 | for (var name in prevChildren) {
|
14048 | if (prevChildren.hasOwnProperty(name)) {
|
14049 | this._unmountChild(prevChildren[name]);
|
14050 | }
|
14051 | }
|
14052 | // Set new text content.
|
14053 | this.setTextContent(nextContent);
|
14054 | errorThrown = false;
|
14055 | } finally {
|
14056 | updateDepth--;
|
14057 | if (!updateDepth) {
|
14058 | if (errorThrown) {
|
14059 | clearQueue();
|
14060 | } else {
|
14061 | processQueue();
|
14062 | }
|
14063 | }
|
14064 | }
|
14065 | },
|
14066 |
|
14067 | /**
|
14068 | * Replaces any rendered children with a markup string.
|
14069 | *
|
14070 | * @param {string} nextMarkup String of markup.
|
14071 | * @internal
|
14072 | */
|
14073 | updateMarkup: function (nextMarkup) {
|
14074 | updateDepth++;
|
14075 | var errorThrown = true;
|
14076 | try {
|
14077 | var prevChildren = this._renderedChildren;
|
14078 | // Remove any rendered children.
|
14079 | ReactChildReconciler.unmountChildren(prevChildren);
|
14080 | for (var name in prevChildren) {
|
14081 | if (prevChildren.hasOwnProperty(name)) {
|
14082 | this._unmountChildByName(prevChildren[name], name);
|
14083 | }
|
14084 | }
|
14085 | this.setMarkup(nextMarkup);
|
14086 | errorThrown = false;
|
14087 | } finally {
|
14088 | updateDepth--;
|
14089 | if (!updateDepth) {
|
14090 | if (errorThrown) {
|
14091 | clearQueue();
|
14092 | } else {
|
14093 | processQueue();
|
14094 | }
|
14095 | }
|
14096 | }
|
14097 | },
|
14098 |
|
14099 | /**
|
14100 | * Updates the rendered children with new children.
|
14101 | *
|
14102 | * @param {?object} nextNestedChildrenElements Nested child element maps.
|
14103 | * @param {ReactReconcileTransaction} transaction
|
14104 | * @internal
|
14105 | */
|
14106 | updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
14107 | updateDepth++;
|
14108 | var errorThrown = true;
|
14109 | try {
|
14110 | this._updateChildren(nextNestedChildrenElements, transaction, context);
|
14111 | errorThrown = false;
|
14112 | } finally {
|
14113 | updateDepth--;
|
14114 | if (!updateDepth) {
|
14115 | if (errorThrown) {
|
14116 | clearQueue();
|
14117 | } else {
|
14118 | processQueue();
|
14119 | }
|
14120 | }
|
14121 | }
|
14122 | },
|
14123 |
|
14124 | /**
|
14125 | * Improve performance by isolating this hot code path from the try/catch
|
14126 | * block in `updateChildren`.
|
14127 | *
|
14128 | * @param {?object} nextNestedChildrenElements Nested child element maps.
|
14129 | * @param {ReactReconcileTransaction} transaction
|
14130 | * @final
|
14131 | * @protected
|
14132 | */
|
14133 | _updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
14134 | var prevChildren = this._renderedChildren;
|
14135 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
|
14136 | this._renderedChildren = nextChildren;
|
14137 | if (!nextChildren && !prevChildren) {
|
14138 | return;
|
14139 | }
|
14140 | var name;
|
14141 | // `nextIndex` will increment for each child in `nextChildren`, but
|
14142 | // `lastIndex` will be the last index visited in `prevChildren`.
|
14143 | var lastIndex = 0;
|
14144 | var nextIndex = 0;
|
14145 | for (name in nextChildren) {
|
14146 | if (!nextChildren.hasOwnProperty(name)) {
|
14147 | continue;
|
14148 | }
|
14149 | var prevChild = prevChildren && prevChildren[name];
|
14150 | var nextChild = nextChildren[name];
|
14151 | if (prevChild === nextChild) {
|
14152 | this.moveChild(prevChild, nextIndex, lastIndex);
|
14153 | lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
14154 | prevChild._mountIndex = nextIndex;
|
14155 | } else {
|
14156 | if (prevChild) {
|
14157 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
|
14158 | lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
14159 | this._unmountChild(prevChild);
|
14160 | }
|
14161 | // The child must be instantiated before it's mounted.
|
14162 | this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
|
14163 | }
|
14164 | nextIndex++;
|
14165 | }
|
14166 | // Remove children that are no longer present.
|
14167 | for (name in prevChildren) {
|
14168 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
14169 | this._unmountChild(prevChildren[name]);
|
14170 | }
|
14171 | }
|
14172 | },
|
14173 |
|
14174 | /**
|
14175 | * Unmounts all rendered children. This should be used to clean up children
|
14176 | * when this component is unmounted.
|
14177 | *
|
14178 | * @internal
|
14179 | */
|
14180 | unmountChildren: function () {
|
14181 | var renderedChildren = this._renderedChildren;
|
14182 | ReactChildReconciler.unmountChildren(renderedChildren);
|
14183 | this._renderedChildren = null;
|
14184 | },
|
14185 |
|
14186 | /**
|
14187 | * Moves a child component to the supplied index.
|
14188 | *
|
14189 | * @param {ReactComponent} child Component to move.
|
14190 | * @param {number} toIndex Destination index of the element.
|
14191 | * @param {number} lastIndex Last index visited of the siblings of `child`.
|
14192 | * @protected
|
14193 | */
|
14194 | moveChild: function (child, toIndex, lastIndex) {
|
14195 | // If the index of `child` is less than `lastIndex`, then it needs to
|
14196 | // be moved. Otherwise, we do not need to move it because a child will be
|
14197 | // inserted or moved before `child`.
|
14198 | if (child._mountIndex < lastIndex) {
|
14199 | enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
|
14200 | }
|
14201 | },
|
14202 |
|
14203 | /**
|
14204 | * Creates a child component.
|
14205 | *
|
14206 | * @param {ReactComponent} child Component to create.
|
14207 | * @param {string} mountImage Markup to insert.
|
14208 | * @protected
|
14209 | */
|
14210 | createChild: function (child, mountImage) {
|
14211 | enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
|
14212 | },
|
14213 |
|
14214 | /**
|
14215 | * Removes a child component.
|
14216 | *
|
14217 | * @param {ReactComponent} child Child to remove.
|
14218 | * @protected
|
14219 | */
|
14220 | removeChild: function (child) {
|
14221 | enqueueRemove(this._rootNodeID, child._mountIndex);
|
14222 | },
|
14223 |
|
14224 | /**
|
14225 | * Sets this text content string.
|
14226 | *
|
14227 | * @param {string} textContent Text content to set.
|
14228 | * @protected
|
14229 | */
|
14230 | setTextContent: function (textContent) {
|
14231 | enqueueTextContent(this._rootNodeID, textContent);
|
14232 | },
|
14233 |
|
14234 | /**
|
14235 | * Sets this markup string.
|
14236 | *
|
14237 | * @param {string} markup Markup to set.
|
14238 | * @protected
|
14239 | */
|
14240 | setMarkup: function (markup) {
|
14241 | enqueueSetMarkup(this._rootNodeID, markup);
|
14242 | },
|
14243 |
|
14244 | /**
|
14245 | * Mounts a child with the supplied name.
|
14246 | *
|
14247 | * NOTE: This is part of `updateChildren` and is here for readability.
|
14248 | *
|
14249 | * @param {ReactComponent} child Component to mount.
|
14250 | * @param {string} name Name of the child.
|
14251 | * @param {number} index Index at which to insert the child.
|
14252 | * @param {ReactReconcileTransaction} transaction
|
14253 | * @private
|
14254 | */
|
14255 | _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
|
14256 | // Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
14257 | var rootID = this._rootNodeID + name;
|
14258 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
|
14259 | child._mountIndex = index;
|
14260 | this.createChild(child, mountImage);
|
14261 | },
|
14262 |
|
14263 | /**
|
14264 | * Unmounts a rendered child.
|
14265 | *
|
14266 | * NOTE: This is part of `updateChildren` and is here for readability.
|
14267 | *
|
14268 | * @param {ReactComponent} child Component to unmount.
|
14269 | * @private
|
14270 | */
|
14271 | _unmountChild: function (child) {
|
14272 | this.removeChild(child);
|
14273 | child._mountIndex = null;
|
14274 | }
|
14275 |
|
14276 | }
|
14277 |
|
14278 | };
|
14279 |
|
14280 | module.exports = ReactMultiChild;
|
14281 |
|
14282 | /***/ },
|
14283 | /* 114 */
|
14284 | /***/ function(module, exports, __webpack_require__) {
|
14285 |
|
14286 | /**
|
14287 | * Copyright 2014-2015, Facebook, Inc.
|
14288 | * All rights reserved.
|
14289 | *
|
14290 | * This source code is licensed under the BSD-style license found in the
|
14291 | * LICENSE file in the root directory of this source tree. An additional grant
|
14292 | * of patent rights can be found in the PATENTS file in the same directory.
|
14293 | *
|
14294 | * @providesModule ReactChildReconciler
|
14295 | * @typechecks static-only
|
14296 | */
|
14297 |
|
14298 | 'use strict';
|
14299 |
|
14300 | var ReactReconciler = __webpack_require__(49);
|
14301 |
|
14302 | var instantiateReactComponent = __webpack_require__(61);
|
14303 | var shouldUpdateReactComponent = __webpack_require__(66);
|
14304 | var traverseAllChildren = __webpack_require__(110);
|
14305 | var warning = __webpack_require__(24);
|
14306 |
|
14307 | function instantiateChild(childInstances, child, name) {
|
14308 | // We found a component instance.
|
14309 | var keyUnique = childInstances[name] === undefined;
|
14310 | if (true) {
|
14311 | true ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
14312 | }
|
14313 | if (child != null && keyUnique) {
|
14314 | childInstances[name] = instantiateReactComponent(child, null);
|
14315 | }
|
14316 | }
|
14317 |
|
14318 | /**
|
14319 | * ReactChildReconciler provides helpers for initializing or updating a set of
|
14320 | * children. Its output is suitable for passing it onto ReactMultiChild which
|
14321 | * does diffed reordering and insertion.
|
14322 | */
|
14323 | var ReactChildReconciler = {
|
14324 | /**
|
14325 | * Generates a "mount image" for each of the supplied children. In the case
|
14326 | * of `ReactDOMComponent`, a mount image is a string of markup.
|
14327 | *
|
14328 | * @param {?object} nestedChildNodes Nested child maps.
|
14329 | * @return {?object} A set of child instances.
|
14330 | * @internal
|
14331 | */
|
14332 | instantiateChildren: function (nestedChildNodes, transaction, context) {
|
14333 | if (nestedChildNodes == null) {
|
14334 | return null;
|
14335 | }
|
14336 | var childInstances = {};
|
14337 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
|
14338 | return childInstances;
|
14339 | },
|
14340 |
|
14341 | /**
|
14342 | * Updates the rendered children and returns a new set of children.
|
14343 | *
|
14344 | * @param {?object} prevChildren Previously initialized set of children.
|
14345 | * @param {?object} nextChildren Flat child element maps.
|
14346 | * @param {ReactReconcileTransaction} transaction
|
14347 | * @param {object} context
|
14348 | * @return {?object} A new set of child instances.
|
14349 | * @internal
|
14350 | */
|
14351 | updateChildren: function (prevChildren, nextChildren, transaction, context) {
|
14352 | // We currently don't have a way to track moves here but if we use iterators
|
14353 | // instead of for..in we can zip the iterators and check if an item has
|
14354 | // moved.
|
14355 | // TODO: If nothing has changed, return the prevChildren object so that we
|
14356 | // can quickly bailout if nothing has changed.
|
14357 | if (!nextChildren && !prevChildren) {
|
14358 | return null;
|
14359 | }
|
14360 | var name;
|
14361 | for (name in nextChildren) {
|
14362 | if (!nextChildren.hasOwnProperty(name)) {
|
14363 | continue;
|
14364 | }
|
14365 | var prevChild = prevChildren && prevChildren[name];
|
14366 | var prevElement = prevChild && prevChild._currentElement;
|
14367 | var nextElement = nextChildren[name];
|
14368 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
|
14369 | ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
|
14370 | nextChildren[name] = prevChild;
|
14371 | } else {
|
14372 | if (prevChild) {
|
14373 | ReactReconciler.unmountComponent(prevChild, name);
|
14374 | }
|
14375 | // The child must be instantiated before it's mounted.
|
14376 | var nextChildInstance = instantiateReactComponent(nextElement, null);
|
14377 | nextChildren[name] = nextChildInstance;
|
14378 | }
|
14379 | }
|
14380 | // Unmount children that are no longer present.
|
14381 | for (name in prevChildren) {
|
14382 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
14383 | ReactReconciler.unmountComponent(prevChildren[name]);
|
14384 | }
|
14385 | }
|
14386 | return nextChildren;
|
14387 | },
|
14388 |
|
14389 | /**
|
14390 | * Unmounts all rendered children. This should be used to clean up children
|
14391 | * when this component is unmounted.
|
14392 | *
|
14393 | * @param {?object} renderedChildren Previously initialized set of children.
|
14394 | * @internal
|
14395 | */
|
14396 | unmountChildren: function (renderedChildren) {
|
14397 | for (var name in renderedChildren) {
|
14398 | if (renderedChildren.hasOwnProperty(name)) {
|
14399 | var renderedChild = renderedChildren[name];
|
14400 | ReactReconciler.unmountComponent(renderedChild);
|
14401 | }
|
14402 | }
|
14403 | }
|
14404 |
|
14405 | };
|
14406 |
|
14407 | module.exports = ReactChildReconciler;
|
14408 |
|
14409 | /***/ },
|
14410 | /* 115 */
|
14411 | /***/ function(module, exports, __webpack_require__) {
|
14412 |
|
14413 | /**
|
14414 | * Copyright 2013-2015, Facebook, Inc.
|
14415 | * All rights reserved.
|
14416 | *
|
14417 | * This source code is licensed under the BSD-style license found in the
|
14418 | * LICENSE file in the root directory of this source tree. An additional grant
|
14419 | * of patent rights can be found in the PATENTS file in the same directory.
|
14420 | *
|
14421 | * @providesModule flattenChildren
|
14422 | */
|
14423 |
|
14424 | 'use strict';
|
14425 |
|
14426 | var traverseAllChildren = __webpack_require__(110);
|
14427 | var warning = __webpack_require__(24);
|
14428 |
|
14429 | /**
|
14430 | * @param {function} traverseContext Context passed through traversal.
|
14431 | * @param {?ReactComponent} child React child component.
|
14432 | * @param {!string} name String name of key path to child.
|
14433 | */
|
14434 | function flattenSingleChildIntoContext(traverseContext, child, name) {
|
14435 | // We found a component instance.
|
14436 | var result = traverseContext;
|
14437 | var keyUnique = result[name] === undefined;
|
14438 | if (true) {
|
14439 | true ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
14440 | }
|
14441 | if (keyUnique && child != null) {
|
14442 | result[name] = child;
|
14443 | }
|
14444 | }
|
14445 |
|
14446 | /**
|
14447 | * Flattens children that are typically specified as `props.children`. Any null
|
14448 | * children will not be included in the resulting object.
|
14449 | * @return {!object} flattened children keyed by name.
|
14450 | */
|
14451 | function flattenChildren(children) {
|
14452 | if (children == null) {
|
14453 | return children;
|
14454 | }
|
14455 | var result = {};
|
14456 | traverseAllChildren(children, flattenSingleChildIntoContext, result);
|
14457 | return result;
|
14458 | }
|
14459 |
|
14460 | module.exports = flattenChildren;
|
14461 |
|
14462 | /***/ },
|
14463 | /* 116 */
|
14464 | /***/ function(module, exports) {
|
14465 |
|
14466 | /**
|
14467 | * Copyright 2013-2015, Facebook, Inc.
|
14468 | * All rights reserved.
|
14469 | *
|
14470 | * This source code is licensed under the BSD-style license found in the
|
14471 | * LICENSE file in the root directory of this source tree. An additional grant
|
14472 | * of patent rights can be found in the PATENTS file in the same directory.
|
14473 | *
|
14474 | * @providesModule shallowEqual
|
14475 | * @typechecks
|
14476 | *
|
14477 | */
|
14478 |
|
14479 | 'use strict';
|
14480 |
|
14481 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
14482 |
|
14483 | /**
|
14484 | * Performs equality by iterating through keys on an object and returning false
|
14485 | * when any key has values which are not strictly equal between the arguments.
|
14486 | * Returns true when the values of all keys are strictly equal.
|
14487 | */
|
14488 | function shallowEqual(objA, objB) {
|
14489 | if (objA === objB) {
|
14490 | return true;
|
14491 | }
|
14492 |
|
14493 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
14494 | return false;
|
14495 | }
|
14496 |
|
14497 | var keysA = Object.keys(objA);
|
14498 | var keysB = Object.keys(objB);
|
14499 |
|
14500 | if (keysA.length !== keysB.length) {
|
14501 | return false;
|
14502 | }
|
14503 |
|
14504 | // Test for A's keys different from B.
|
14505 | var bHasOwnProperty = hasOwnProperty.bind(objB);
|
14506 | for (var i = 0; i < keysA.length; i++) {
|
14507 | if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
14508 | return false;
|
14509 | }
|
14510 | }
|
14511 |
|
14512 | return true;
|
14513 | }
|
14514 |
|
14515 | module.exports = shallowEqual;
|
14516 |
|
14517 | /***/ },
|
14518 | /* 117 */
|
14519 | /***/ function(module, exports, __webpack_require__) {
|
14520 |
|
14521 | /**
|
14522 | * Copyright 2013-2015, Facebook, Inc.
|
14523 | * All rights reserved.
|
14524 | *
|
14525 | * This source code is licensed under the BSD-style license found in the
|
14526 | * LICENSE file in the root directory of this source tree. An additional grant
|
14527 | * of patent rights can be found in the PATENTS file in the same directory.
|
14528 | *
|
14529 | * @providesModule ReactEventListener
|
14530 | * @typechecks static-only
|
14531 | */
|
14532 |
|
14533 | 'use strict';
|
14534 |
|
14535 | var EventListener = __webpack_require__(118);
|
14536 | var ExecutionEnvironment = __webpack_require__(8);
|
14537 | var PooledClass = __webpack_require__(55);
|
14538 | var ReactInstanceHandles = __webpack_require__(44);
|
14539 | var ReactMount = __webpack_require__(27);
|
14540 | var ReactUpdates = __webpack_require__(53);
|
14541 |
|
14542 | var assign = __webpack_require__(38);
|
14543 | var getEventTarget = __webpack_require__(80);
|
14544 | var getUnboundedScrollPosition = __webpack_require__(119);
|
14545 |
|
14546 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
14547 |
|
14548 | /**
|
14549 | * Finds the parent React component of `node`.
|
14550 | *
|
14551 | * @param {*} node
|
14552 | * @return {?DOMEventTarget} Parent container, or `null` if the specified node
|
14553 | * is not nested.
|
14554 | */
|
14555 | function findParent(node) {
|
14556 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM
|
14557 | // traversal, but caching is difficult to do correctly without using a
|
14558 | // mutation observer to listen for all DOM changes.
|
14559 | var nodeID = ReactMount.getID(node);
|
14560 | var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
|
14561 | var container = ReactMount.findReactContainerForID(rootID);
|
14562 | var parent = ReactMount.getFirstReactDOM(container);
|
14563 | return parent;
|
14564 | }
|
14565 |
|
14566 | // Used to store ancestor hierarchy in top level callback
|
14567 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
|
14568 | this.topLevelType = topLevelType;
|
14569 | this.nativeEvent = nativeEvent;
|
14570 | this.ancestors = [];
|
14571 | }
|
14572 | assign(TopLevelCallbackBookKeeping.prototype, {
|
14573 | destructor: function () {
|
14574 | this.topLevelType = null;
|
14575 | this.nativeEvent = null;
|
14576 | this.ancestors.length = 0;
|
14577 | }
|
14578 | });
|
14579 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
14580 |
|
14581 | function handleTopLevelImpl(bookKeeping) {
|
14582 | // TODO: Re-enable event.path handling
|
14583 | //
|
14584 | // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
|
14585 | // // New browsers have a path attribute on native events
|
14586 | // handleTopLevelWithPath(bookKeeping);
|
14587 | // } else {
|
14588 | // // Legacy browsers don't have a path attribute on native events
|
14589 | // handleTopLevelWithoutPath(bookKeeping);
|
14590 | // }
|
14591 |
|
14592 | void handleTopLevelWithPath; // temporarily unused
|
14593 | handleTopLevelWithoutPath(bookKeeping);
|
14594 | }
|
14595 |
|
14596 | // Legacy browsers don't have a path attribute on native events
|
14597 | function handleTopLevelWithoutPath(bookKeeping) {
|
14598 | var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
|
14599 |
|
14600 | // Loop through the hierarchy, in case there's any nested components.
|
14601 | // It's important that we build the array of ancestors before calling any
|
14602 | // event handlers, because event handlers can modify the DOM, leading to
|
14603 | // inconsistencies with ReactMount's node cache. See #1105.
|
14604 | var ancestor = topLevelTarget;
|
14605 | while (ancestor) {
|
14606 | bookKeeping.ancestors.push(ancestor);
|
14607 | ancestor = findParent(ancestor);
|
14608 | }
|
14609 |
|
14610 | for (var i = 0; i < bookKeeping.ancestors.length; i++) {
|
14611 | topLevelTarget = bookKeeping.ancestors[i];
|
14612 | var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
14613 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
14614 | }
|
14615 | }
|
14616 |
|
14617 | // New browsers have a path attribute on native events
|
14618 | function handleTopLevelWithPath(bookKeeping) {
|
14619 | var path = bookKeeping.nativeEvent.path;
|
14620 | var currentNativeTarget = path[0];
|
14621 | var eventsFired = 0;
|
14622 | for (var i = 0; i < path.length; i++) {
|
14623 | var currentPathElement = path[i];
|
14624 | if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
14625 | currentNativeTarget = path[i + 1];
|
14626 | }
|
14627 | // TODO: slow
|
14628 | var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
|
14629 | if (reactParent === currentPathElement) {
|
14630 | var currentPathElementID = ReactMount.getID(currentPathElement);
|
14631 | var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
14632 | bookKeeping.ancestors.push(currentPathElement);
|
14633 |
|
14634 | var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
|
14635 | eventsFired++;
|
14636 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
|
14637 |
|
14638 | // Jump to the root of this React render tree
|
14639 | while (currentPathElementID !== newRootID) {
|
14640 | i++;
|
14641 | currentPathElement = path[i];
|
14642 | currentPathElementID = ReactMount.getID(currentPathElement);
|
14643 | }
|
14644 | }
|
14645 | }
|
14646 | if (eventsFired === 0) {
|
14647 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
14648 | }
|
14649 | }
|
14650 |
|
14651 | function scrollValueMonitor(cb) {
|
14652 | var scrollPosition = getUnboundedScrollPosition(window);
|
14653 | cb(scrollPosition);
|
14654 | }
|
14655 |
|
14656 | var ReactEventListener = {
|
14657 | _enabled: true,
|
14658 | _handleTopLevel: null,
|
14659 |
|
14660 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
|
14661 |
|
14662 | setHandleTopLevel: function (handleTopLevel) {
|
14663 | ReactEventListener._handleTopLevel = handleTopLevel;
|
14664 | },
|
14665 |
|
14666 | setEnabled: function (enabled) {
|
14667 | ReactEventListener._enabled = !!enabled;
|
14668 | },
|
14669 |
|
14670 | isEnabled: function () {
|
14671 | return ReactEventListener._enabled;
|
14672 | },
|
14673 |
|
14674 | /**
|
14675 | * Traps top-level events by using event bubbling.
|
14676 | *
|
14677 | * @param {string} topLevelType Record from `EventConstants`.
|
14678 | * @param {string} handlerBaseName Event name (e.g. "click").
|
14679 | * @param {object} handle Element on which to attach listener.
|
14680 | * @return {?object} An object with a remove function which will forcefully
|
14681 | * remove the listener.
|
14682 | * @internal
|
14683 | */
|
14684 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
|
14685 | var element = handle;
|
14686 | if (!element) {
|
14687 | return null;
|
14688 | }
|
14689 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
|
14690 | },
|
14691 |
|
14692 | /**
|
14693 | * Traps a top-level event by using event capturing.
|
14694 | *
|
14695 | * @param {string} topLevelType Record from `EventConstants`.
|
14696 | * @param {string} handlerBaseName Event name (e.g. "click").
|
14697 | * @param {object} handle Element on which to attach listener.
|
14698 | * @return {?object} An object with a remove function which will forcefully
|
14699 | * remove the listener.
|
14700 | * @internal
|
14701 | */
|
14702 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
|
14703 | var element = handle;
|
14704 | if (!element) {
|
14705 | return null;
|
14706 | }
|
14707 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
|
14708 | },
|
14709 |
|
14710 | monitorScrollValue: function (refresh) {
|
14711 | var callback = scrollValueMonitor.bind(null, refresh);
|
14712 | EventListener.listen(window, 'scroll', callback);
|
14713 | },
|
14714 |
|
14715 | dispatchEvent: function (topLevelType, nativeEvent) {
|
14716 | if (!ReactEventListener._enabled) {
|
14717 | return;
|
14718 | }
|
14719 |
|
14720 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
|
14721 | try {
|
14722 | // Event queue being processed in the same cycle allows
|
14723 | // `preventDefault`.
|
14724 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
|
14725 | } finally {
|
14726 | TopLevelCallbackBookKeeping.release(bookKeeping);
|
14727 | }
|
14728 | }
|
14729 | };
|
14730 |
|
14731 | module.exports = ReactEventListener;
|
14732 |
|
14733 | /***/ },
|
14734 | /* 118 */
|
14735 | /***/ function(module, exports, __webpack_require__) {
|
14736 |
|
14737 | /**
|
14738 | * Copyright 2013-2015, Facebook, Inc.
|
14739 | *
|
14740 | * Licensed under the Apache License, Version 2.0 (the "License");
|
14741 | * you may not use this file except in compliance with the License.
|
14742 | * You may obtain a copy of the License at
|
14743 | *
|
14744 | * http://www.apache.org/licenses/LICENSE-2.0
|
14745 | *
|
14746 | * Unless required by applicable law or agreed to in writing, software
|
14747 | * distributed under the License is distributed on an "AS IS" BASIS,
|
14748 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14749 | * See the License for the specific language governing permissions and
|
14750 | * limitations under the License.
|
14751 | *
|
14752 | * @providesModule EventListener
|
14753 | * @typechecks
|
14754 | */
|
14755 |
|
14756 | 'use strict';
|
14757 |
|
14758 | var emptyFunction = __webpack_require__(14);
|
14759 |
|
14760 | /**
|
14761 | * Upstream version of event listener. Does not take into account specific
|
14762 | * nature of platform.
|
14763 | */
|
14764 | var EventListener = {
|
14765 | /**
|
14766 | * Listen to DOM events during the bubble phase.
|
14767 | *
|
14768 | * @param {DOMEventTarget} target DOM element to register listener on.
|
14769 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
14770 | * @param {function} callback Callback function.
|
14771 | * @return {object} Object with a `remove` method.
|
14772 | */
|
14773 | listen: function (target, eventType, callback) {
|
14774 | if (target.addEventListener) {
|
14775 | target.addEventListener(eventType, callback, false);
|
14776 | return {
|
14777 | remove: function () {
|
14778 | target.removeEventListener(eventType, callback, false);
|
14779 | }
|
14780 | };
|
14781 | } else if (target.attachEvent) {
|
14782 | target.attachEvent('on' + eventType, callback);
|
14783 | return {
|
14784 | remove: function () {
|
14785 | target.detachEvent('on' + eventType, callback);
|
14786 | }
|
14787 | };
|
14788 | }
|
14789 | },
|
14790 |
|
14791 | /**
|
14792 | * Listen to DOM events during the capture phase.
|
14793 | *
|
14794 | * @param {DOMEventTarget} target DOM element to register listener on.
|
14795 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
14796 | * @param {function} callback Callback function.
|
14797 | * @return {object} Object with a `remove` method.
|
14798 | */
|
14799 | capture: function (target, eventType, callback) {
|
14800 | if (target.addEventListener) {
|
14801 | target.addEventListener(eventType, callback, true);
|
14802 | return {
|
14803 | remove: function () {
|
14804 | target.removeEventListener(eventType, callback, true);
|
14805 | }
|
14806 | };
|
14807 | } else {
|
14808 | if (true) {
|
14809 | console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
|
14810 | }
|
14811 | return {
|
14812 | remove: emptyFunction
|
14813 | };
|
14814 | }
|
14815 | },
|
14816 |
|
14817 | registerDefault: function () {}
|
14818 | };
|
14819 |
|
14820 | module.exports = EventListener;
|
14821 |
|
14822 | /***/ },
|
14823 | /* 119 */
|
14824 | /***/ function(module, exports) {
|
14825 |
|
14826 | /**
|
14827 | * Copyright 2013-2015, Facebook, Inc.
|
14828 | * All rights reserved.
|
14829 | *
|
14830 | * This source code is licensed under the BSD-style license found in the
|
14831 | * LICENSE file in the root directory of this source tree. An additional grant
|
14832 | * of patent rights can be found in the PATENTS file in the same directory.
|
14833 | *
|
14834 | * @providesModule getUnboundedScrollPosition
|
14835 | * @typechecks
|
14836 | */
|
14837 |
|
14838 | 'use strict';
|
14839 |
|
14840 | /**
|
14841 | * Gets the scroll position of the supplied element or window.
|
14842 | *
|
14843 | * The return values are unbounded, unlike `getScrollPosition`. This means they
|
14844 | * may be negative or exceed the element boundaries (which is possible using
|
14845 | * inertial scrolling).
|
14846 | *
|
14847 | * @param {DOMWindow|DOMElement} scrollable
|
14848 | * @return {object} Map with `x` and `y` keys.
|
14849 | */
|
14850 | function getUnboundedScrollPosition(scrollable) {
|
14851 | if (scrollable === window) {
|
14852 | return {
|
14853 | x: window.pageXOffset || document.documentElement.scrollLeft,
|
14854 | y: window.pageYOffset || document.documentElement.scrollTop
|
14855 | };
|
14856 | }
|
14857 | return {
|
14858 | x: scrollable.scrollLeft,
|
14859 | y: scrollable.scrollTop
|
14860 | };
|
14861 | }
|
14862 |
|
14863 | module.exports = getUnboundedScrollPosition;
|
14864 |
|
14865 | /***/ },
|
14866 | /* 120 */
|
14867 | /***/ function(module, exports, __webpack_require__) {
|
14868 |
|
14869 | /**
|
14870 | * Copyright 2013-2015, Facebook, Inc.
|
14871 | * All rights reserved.
|
14872 | *
|
14873 | * This source code is licensed under the BSD-style license found in the
|
14874 | * LICENSE file in the root directory of this source tree. An additional grant
|
14875 | * of patent rights can be found in the PATENTS file in the same directory.
|
14876 | *
|
14877 | * @providesModule ReactInjection
|
14878 | */
|
14879 |
|
14880 | 'use strict';
|
14881 |
|
14882 | var DOMProperty = __webpack_require__(22);
|
14883 | var EventPluginHub = __webpack_require__(30);
|
14884 | var ReactComponentEnvironment = __webpack_require__(63);
|
14885 | var ReactClass = __webpack_require__(121);
|
14886 | var ReactEmptyComponent = __webpack_require__(67);
|
14887 | var ReactBrowserEventEmitter = __webpack_require__(28);
|
14888 | var ReactNativeComponent = __webpack_require__(68);
|
14889 | var ReactPerf = __webpack_require__(17);
|
14890 | var ReactRootIndex = __webpack_require__(45);
|
14891 | var ReactUpdates = __webpack_require__(53);
|
14892 |
|
14893 | var ReactInjection = {
|
14894 | Component: ReactComponentEnvironment.injection,
|
14895 | Class: ReactClass.injection,
|
14896 | DOMProperty: DOMProperty.injection,
|
14897 | EmptyComponent: ReactEmptyComponent.injection,
|
14898 | EventPluginHub: EventPluginHub.injection,
|
14899 | EventEmitter: ReactBrowserEventEmitter.injection,
|
14900 | NativeComponent: ReactNativeComponent.injection,
|
14901 | Perf: ReactPerf.injection,
|
14902 | RootIndex: ReactRootIndex.injection,
|
14903 | Updates: ReactUpdates.injection
|
14904 | };
|
14905 |
|
14906 | module.exports = ReactInjection;
|
14907 |
|
14908 | /***/ },
|
14909 | /* 121 */
|
14910 | /***/ function(module, exports, __webpack_require__) {
|
14911 |
|
14912 | /**
|
14913 | * Copyright 2013-2015, Facebook, Inc.
|
14914 | * All rights reserved.
|
14915 | *
|
14916 | * This source code is licensed under the BSD-style license found in the
|
14917 | * LICENSE file in the root directory of this source tree. An additional grant
|
14918 | * of patent rights can be found in the PATENTS file in the same directory.
|
14919 | *
|
14920 | * @providesModule ReactClass
|
14921 | */
|
14922 |
|
14923 | 'use strict';
|
14924 |
|
14925 | var ReactComponent = __webpack_require__(122);
|
14926 | var ReactElement = __webpack_require__(41);
|
14927 | var ReactPropTypeLocations = __webpack_require__(64);
|
14928 | var ReactPropTypeLocationNames = __webpack_require__(65);
|
14929 | var ReactNoopUpdateQueue = __webpack_require__(123);
|
14930 |
|
14931 | var assign = __webpack_require__(38);
|
14932 | var emptyObject = __webpack_require__(57);
|
14933 | var invariant = __webpack_require__(12);
|
14934 | var keyMirror = __webpack_require__(16);
|
14935 | var keyOf = __webpack_require__(78);
|
14936 | var warning = __webpack_require__(24);
|
14937 |
|
14938 | var MIXINS_KEY = keyOf({ mixins: null });
|
14939 |
|
14940 | /**
|
14941 | * Policies that describe methods in `ReactClassInterface`.
|
14942 | */
|
14943 | var SpecPolicy = keyMirror({
|
14944 | /**
|
14945 | * These methods may be defined only once by the class specification or mixin.
|
14946 | */
|
14947 | DEFINE_ONCE: null,
|
14948 | /**
|
14949 | * These methods may be defined by both the class specification and mixins.
|
14950 | * Subsequent definitions will be chained. These methods must return void.
|
14951 | */
|
14952 | DEFINE_MANY: null,
|
14953 | /**
|
14954 | * These methods are overriding the base class.
|
14955 | */
|
14956 | OVERRIDE_BASE: null,
|
14957 | /**
|
14958 | * These methods are similar to DEFINE_MANY, except we assume they return
|
14959 | * objects. We try to merge the keys of the return values of all the mixed in
|
14960 | * functions. If there is a key conflict we throw.
|
14961 | */
|
14962 | DEFINE_MANY_MERGED: null
|
14963 | });
|
14964 |
|
14965 | var injectedMixins = [];
|
14966 |
|
14967 | var warnedSetProps = false;
|
14968 | function warnSetProps() {
|
14969 | if (!warnedSetProps) {
|
14970 | warnedSetProps = true;
|
14971 | true ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
|
14972 | }
|
14973 | }
|
14974 |
|
14975 | /**
|
14976 | * Composite components are higher-level components that compose other composite
|
14977 | * or native components.
|
14978 | *
|
14979 | * To create a new type of `ReactClass`, pass a specification of
|
14980 | * your new class to `React.createClass`. The only requirement of your class
|
14981 | * specification is that you implement a `render` method.
|
14982 | *
|
14983 | * var MyComponent = React.createClass({
|
14984 | * render: function() {
|
14985 | * return <div>Hello World</div>;
|
14986 | * }
|
14987 | * });
|
14988 | *
|
14989 | * The class specification supports a specific protocol of methods that have
|
14990 | * special meaning (e.g. `render`). See `ReactClassInterface` for
|
14991 | * more the comprehensive protocol. Any other properties and methods in the
|
14992 | * class specification will be available on the prototype.
|
14993 | *
|
14994 | * @interface ReactClassInterface
|
14995 | * @internal
|
14996 | */
|
14997 | var ReactClassInterface = {
|
14998 |
|
14999 | /**
|
15000 | * An array of Mixin objects to include when defining your component.
|
15001 | *
|
15002 | * @type {array}
|
15003 | * @optional
|
15004 | */
|
15005 | mixins: SpecPolicy.DEFINE_MANY,
|
15006 |
|
15007 | /**
|
15008 | * An object containing properties and methods that should be defined on
|
15009 | * the component's constructor instead of its prototype (static methods).
|
15010 | *
|
15011 | * @type {object}
|
15012 | * @optional
|
15013 | */
|
15014 | statics: SpecPolicy.DEFINE_MANY,
|
15015 |
|
15016 | /**
|
15017 | * Definition of prop types for this component.
|
15018 | *
|
15019 | * @type {object}
|
15020 | * @optional
|
15021 | */
|
15022 | propTypes: SpecPolicy.DEFINE_MANY,
|
15023 |
|
15024 | /**
|
15025 | * Definition of context types for this component.
|
15026 | *
|
15027 | * @type {object}
|
15028 | * @optional
|
15029 | */
|
15030 | contextTypes: SpecPolicy.DEFINE_MANY,
|
15031 |
|
15032 | /**
|
15033 | * Definition of context types this component sets for its children.
|
15034 | *
|
15035 | * @type {object}
|
15036 | * @optional
|
15037 | */
|
15038 | childContextTypes: SpecPolicy.DEFINE_MANY,
|
15039 |
|
15040 | // ==== Definition methods ====
|
15041 |
|
15042 | /**
|
15043 | * Invoked when the component is mounted. Values in the mapping will be set on
|
15044 | * `this.props` if that prop is not specified (i.e. using an `in` check).
|
15045 | *
|
15046 | * This method is invoked before `getInitialState` and therefore cannot rely
|
15047 | * on `this.state` or use `this.setState`.
|
15048 | *
|
15049 | * @return {object}
|
15050 | * @optional
|
15051 | */
|
15052 | getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
|
15053 |
|
15054 | /**
|
15055 | * Invoked once before the component is mounted. The return value will be used
|
15056 | * as the initial value of `this.state`.
|
15057 | *
|
15058 | * getInitialState: function() {
|
15059 | * return {
|
15060 | * isOn: false,
|
15061 | * fooBaz: new BazFoo()
|
15062 | * }
|
15063 | * }
|
15064 | *
|
15065 | * @return {object}
|
15066 | * @optional
|
15067 | */
|
15068 | getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
|
15069 |
|
15070 | /**
|
15071 | * @return {object}
|
15072 | * @optional
|
15073 | */
|
15074 | getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
|
15075 |
|
15076 | /**
|
15077 | * Uses props from `this.props` and state from `this.state` to render the
|
15078 | * structure of the component.
|
15079 | *
|
15080 | * No guarantees are made about when or how often this method is invoked, so
|
15081 | * it must not have side effects.
|
15082 | *
|
15083 | * render: function() {
|
15084 | * var name = this.props.name;
|
15085 | * return <div>Hello, {name}!</div>;
|
15086 | * }
|
15087 | *
|
15088 | * @return {ReactComponent}
|
15089 | * @nosideeffects
|
15090 | * @required
|
15091 | */
|
15092 | render: SpecPolicy.DEFINE_ONCE,
|
15093 |
|
15094 | // ==== Delegate methods ====
|
15095 |
|
15096 | /**
|
15097 | * Invoked when the component is initially created and about to be mounted.
|
15098 | * This may have side effects, but any external subscriptions or data created
|
15099 | * by this method must be cleaned up in `componentWillUnmount`.
|
15100 | *
|
15101 | * @optional
|
15102 | */
|
15103 | componentWillMount: SpecPolicy.DEFINE_MANY,
|
15104 |
|
15105 | /**
|
15106 | * Invoked when the component has been mounted and has a DOM representation.
|
15107 | * However, there is no guarantee that the DOM node is in the document.
|
15108 | *
|
15109 | * Use this as an opportunity to operate on the DOM when the component has
|
15110 | * been mounted (initialized and rendered) for the first time.
|
15111 | *
|
15112 | * @param {DOMElement} rootNode DOM element representing the component.
|
15113 | * @optional
|
15114 | */
|
15115 | componentDidMount: SpecPolicy.DEFINE_MANY,
|
15116 |
|
15117 | /**
|
15118 | * Invoked before the component receives new props.
|
15119 | *
|
15120 | * Use this as an opportunity to react to a prop transition by updating the
|
15121 | * state using `this.setState`. Current props are accessed via `this.props`.
|
15122 | *
|
15123 | * componentWillReceiveProps: function(nextProps, nextContext) {
|
15124 | * this.setState({
|
15125 | * likesIncreasing: nextProps.likeCount > this.props.likeCount
|
15126 | * });
|
15127 | * }
|
15128 | *
|
15129 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
15130 | * transition may cause a state change, but the opposite is not true. If you
|
15131 | * need it, you are probably looking for `componentWillUpdate`.
|
15132 | *
|
15133 | * @param {object} nextProps
|
15134 | * @optional
|
15135 | */
|
15136 | componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
|
15137 |
|
15138 | /**
|
15139 | * Invoked while deciding if the component should be updated as a result of
|
15140 | * receiving new props, state and/or context.
|
15141 | *
|
15142 | * Use this as an opportunity to `return false` when you're certain that the
|
15143 | * transition to the new props/state/context will not require a component
|
15144 | * update.
|
15145 | *
|
15146 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
15147 | * return !equal(nextProps, this.props) ||
|
15148 | * !equal(nextState, this.state) ||
|
15149 | * !equal(nextContext, this.context);
|
15150 | * }
|
15151 | *
|
15152 | * @param {object} nextProps
|
15153 | * @param {?object} nextState
|
15154 | * @param {?object} nextContext
|
15155 | * @return {boolean} True if the component should update.
|
15156 | * @optional
|
15157 | */
|
15158 | shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
|
15159 |
|
15160 | /**
|
15161 | * Invoked when the component is about to update due to a transition from
|
15162 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
15163 | * and `nextContext`.
|
15164 | *
|
15165 | * Use this as an opportunity to perform preparation before an update occurs.
|
15166 | *
|
15167 | * NOTE: You **cannot** use `this.setState()` in this method.
|
15168 | *
|
15169 | * @param {object} nextProps
|
15170 | * @param {?object} nextState
|
15171 | * @param {?object} nextContext
|
15172 | * @param {ReactReconcileTransaction} transaction
|
15173 | * @optional
|
15174 | */
|
15175 | componentWillUpdate: SpecPolicy.DEFINE_MANY,
|
15176 |
|
15177 | /**
|
15178 | * Invoked when the component's DOM representation has been updated.
|
15179 | *
|
15180 | * Use this as an opportunity to operate on the DOM when the component has
|
15181 | * been updated.
|
15182 | *
|
15183 | * @param {object} prevProps
|
15184 | * @param {?object} prevState
|
15185 | * @param {?object} prevContext
|
15186 | * @param {DOMElement} rootNode DOM element representing the component.
|
15187 | * @optional
|
15188 | */
|
15189 | componentDidUpdate: SpecPolicy.DEFINE_MANY,
|
15190 |
|
15191 | /**
|
15192 | * Invoked when the component is about to be removed from its parent and have
|
15193 | * its DOM representation destroyed.
|
15194 | *
|
15195 | * Use this as an opportunity to deallocate any external resources.
|
15196 | *
|
15197 | * NOTE: There is no `componentDidUnmount` since your component will have been
|
15198 | * destroyed by that point.
|
15199 | *
|
15200 | * @optional
|
15201 | */
|
15202 | componentWillUnmount: SpecPolicy.DEFINE_MANY,
|
15203 |
|
15204 | // ==== Advanced methods ====
|
15205 |
|
15206 | /**
|
15207 | * Updates the component's currently mounted DOM representation.
|
15208 | *
|
15209 | * By default, this implements React's rendering and reconciliation algorithm.
|
15210 | * Sophisticated clients may wish to override this.
|
15211 | *
|
15212 | * @param {ReactReconcileTransaction} transaction
|
15213 | * @internal
|
15214 | * @overridable
|
15215 | */
|
15216 | updateComponent: SpecPolicy.OVERRIDE_BASE
|
15217 |
|
15218 | };
|
15219 |
|
15220 | /**
|
15221 | * Mapping from class specification keys to special processing functions.
|
15222 | *
|
15223 | * Although these are declared like instance properties in the specification
|
15224 | * when defining classes using `React.createClass`, they are actually static
|
15225 | * and are accessible on the constructor instead of the prototype. Despite
|
15226 | * being static, they must be defined outside of the "statics" key under
|
15227 | * which all other static methods are defined.
|
15228 | */
|
15229 | var RESERVED_SPEC_KEYS = {
|
15230 | displayName: function (Constructor, displayName) {
|
15231 | Constructor.displayName = displayName;
|
15232 | },
|
15233 | mixins: function (Constructor, mixins) {
|
15234 | if (mixins) {
|
15235 | for (var i = 0; i < mixins.length; i++) {
|
15236 | mixSpecIntoComponent(Constructor, mixins[i]);
|
15237 | }
|
15238 | }
|
15239 | },
|
15240 | childContextTypes: function (Constructor, childContextTypes) {
|
15241 | if (true) {
|
15242 | validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
|
15243 | }
|
15244 | Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
|
15245 | },
|
15246 | contextTypes: function (Constructor, contextTypes) {
|
15247 | if (true) {
|
15248 | validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
|
15249 | }
|
15250 | Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
|
15251 | },
|
15252 | /**
|
15253 | * Special case getDefaultProps which should move into statics but requires
|
15254 | * automatic merging.
|
15255 | */
|
15256 | getDefaultProps: function (Constructor, getDefaultProps) {
|
15257 | if (Constructor.getDefaultProps) {
|
15258 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
15259 | } else {
|
15260 | Constructor.getDefaultProps = getDefaultProps;
|
15261 | }
|
15262 | },
|
15263 | propTypes: function (Constructor, propTypes) {
|
15264 | if (true) {
|
15265 | validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
|
15266 | }
|
15267 | Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
|
15268 | },
|
15269 | statics: function (Constructor, statics) {
|
15270 | mixStaticSpecIntoComponent(Constructor, statics);
|
15271 | },
|
15272 | autobind: function () {} };
|
15273 |
|
15274 | // noop
|
15275 | function validateTypeDef(Constructor, typeDef, location) {
|
15276 | for (var propName in typeDef) {
|
15277 | if (typeDef.hasOwnProperty(propName)) {
|
15278 | // use a warning instead of an invariant so components
|
15279 | // don't show up in prod but not in __DEV__
|
15280 | true ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
|
15281 | }
|
15282 | }
|
15283 | }
|
15284 |
|
15285 | function validateMethodOverride(proto, name) {
|
15286 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
15287 |
|
15288 | // Disallow overriding of base class methods unless explicitly allowed.
|
15289 | if (ReactClassMixin.hasOwnProperty(name)) {
|
15290 | !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? true ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
|
15291 | }
|
15292 |
|
15293 | // Disallow defining methods more than once unless explicitly allowed.
|
15294 | if (proto.hasOwnProperty(name)) {
|
15295 | !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? true ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
|
15296 | }
|
15297 | }
|
15298 |
|
15299 | /**
|
15300 | * Mixin helper which handles policy validation and reserved
|
15301 | * specification keys when building React classses.
|
15302 | */
|
15303 | function mixSpecIntoComponent(Constructor, spec) {
|
15304 | if (!spec) {
|
15305 | return;
|
15306 | }
|
15307 |
|
15308 | !(typeof spec !== 'function') ? true ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
|
15309 | !!ReactElement.isValidElement(spec) ? true ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
|
15310 |
|
15311 | var proto = Constructor.prototype;
|
15312 |
|
15313 | // By handling mixins before any other properties, we ensure the same
|
15314 | // chaining order is applied to methods with DEFINE_MANY policy, whether
|
15315 | // mixins are listed before or after these methods in the spec.
|
15316 | if (spec.hasOwnProperty(MIXINS_KEY)) {
|
15317 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
15318 | }
|
15319 |
|
15320 | for (var name in spec) {
|
15321 | if (!spec.hasOwnProperty(name)) {
|
15322 | continue;
|
15323 | }
|
15324 |
|
15325 | if (name === MIXINS_KEY) {
|
15326 | // We have already handled mixins in a special case above.
|
15327 | continue;
|
15328 | }
|
15329 |
|
15330 | var property = spec[name];
|
15331 | validateMethodOverride(proto, name);
|
15332 |
|
15333 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
15334 | RESERVED_SPEC_KEYS[name](Constructor, property);
|
15335 | } else {
|
15336 | // Setup methods on prototype:
|
15337 | // The following member methods should not be automatically bound:
|
15338 | // 1. Expected ReactClass methods (in the "interface").
|
15339 | // 2. Overridden methods (that were mixed in).
|
15340 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
15341 | var isAlreadyDefined = proto.hasOwnProperty(name);
|
15342 | var isFunction = typeof property === 'function';
|
15343 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
15344 |
|
15345 | if (shouldAutoBind) {
|
15346 | if (!proto.__reactAutoBindMap) {
|
15347 | proto.__reactAutoBindMap = {};
|
15348 | }
|
15349 | proto.__reactAutoBindMap[name] = property;
|
15350 | proto[name] = property;
|
15351 | } else {
|
15352 | if (isAlreadyDefined) {
|
15353 | var specPolicy = ReactClassInterface[name];
|
15354 |
|
15355 | // These cases should already be caught by validateMethodOverride.
|
15356 | !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? true ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
|
15357 |
|
15358 | // For methods which are defined more than once, call the existing
|
15359 | // methods before calling the new property, merging if appropriate.
|
15360 | if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
|
15361 | proto[name] = createMergedResultFunction(proto[name], property);
|
15362 | } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
|
15363 | proto[name] = createChainedFunction(proto[name], property);
|
15364 | }
|
15365 | } else {
|
15366 | proto[name] = property;
|
15367 | if (true) {
|
15368 | // Add verbose displayName to the function, which helps when looking
|
15369 | // at profiling tools.
|
15370 | if (typeof property === 'function' && spec.displayName) {
|
15371 | proto[name].displayName = spec.displayName + '_' + name;
|
15372 | }
|
15373 | }
|
15374 | }
|
15375 | }
|
15376 | }
|
15377 | }
|
15378 | }
|
15379 |
|
15380 | function mixStaticSpecIntoComponent(Constructor, statics) {
|
15381 | if (!statics) {
|
15382 | return;
|
15383 | }
|
15384 | for (var name in statics) {
|
15385 | var property = statics[name];
|
15386 | if (!statics.hasOwnProperty(name)) {
|
15387 | continue;
|
15388 | }
|
15389 |
|
15390 | var isReserved = (name in RESERVED_SPEC_KEYS);
|
15391 | !!isReserved ? true ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
|
15392 |
|
15393 | var isInherited = (name in Constructor);
|
15394 | !!isInherited ? true ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
|
15395 | Constructor[name] = property;
|
15396 | }
|
15397 | }
|
15398 |
|
15399 | /**
|
15400 | * Merge two objects, but throw if both contain the same key.
|
15401 | *
|
15402 | * @param {object} one The first object, which is mutated.
|
15403 | * @param {object} two The second object
|
15404 | * @return {object} one after it has been mutated to contain everything in two.
|
15405 | */
|
15406 | function mergeIntoWithNoDuplicateKeys(one, two) {
|
15407 | !(one && two && typeof one === 'object' && typeof two === 'object') ? true ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
|
15408 |
|
15409 | for (var key in two) {
|
15410 | if (two.hasOwnProperty(key)) {
|
15411 | !(one[key] === undefined) ? true ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
|
15412 | one[key] = two[key];
|
15413 | }
|
15414 | }
|
15415 | return one;
|
15416 | }
|
15417 |
|
15418 | /**
|
15419 | * Creates a function that invokes two functions and merges their return values.
|
15420 | *
|
15421 | * @param {function} one Function to invoke first.
|
15422 | * @param {function} two Function to invoke second.
|
15423 | * @return {function} Function that invokes the two argument functions.
|
15424 | * @private
|
15425 | */
|
15426 | function createMergedResultFunction(one, two) {
|
15427 | return function mergedResult() {
|
15428 | var a = one.apply(this, arguments);
|
15429 | var b = two.apply(this, arguments);
|
15430 | if (a == null) {
|
15431 | return b;
|
15432 | } else if (b == null) {
|
15433 | return a;
|
15434 | }
|
15435 | var c = {};
|
15436 | mergeIntoWithNoDuplicateKeys(c, a);
|
15437 | mergeIntoWithNoDuplicateKeys(c, b);
|
15438 | return c;
|
15439 | };
|
15440 | }
|
15441 |
|
15442 | /**
|
15443 | * Creates a function that invokes two functions and ignores their return vales.
|
15444 | *
|
15445 | * @param {function} one Function to invoke first.
|
15446 | * @param {function} two Function to invoke second.
|
15447 | * @return {function} Function that invokes the two argument functions.
|
15448 | * @private
|
15449 | */
|
15450 | function createChainedFunction(one, two) {
|
15451 | return function chainedFunction() {
|
15452 | one.apply(this, arguments);
|
15453 | two.apply(this, arguments);
|
15454 | };
|
15455 | }
|
15456 |
|
15457 | /**
|
15458 | * Binds a method to the component.
|
15459 | *
|
15460 | * @param {object} component Component whose method is going to be bound.
|
15461 | * @param {function} method Method to be bound.
|
15462 | * @return {function} The bound method.
|
15463 | */
|
15464 | function bindAutoBindMethod(component, method) {
|
15465 | var boundMethod = method.bind(component);
|
15466 | if (true) {
|
15467 | boundMethod.__reactBoundContext = component;
|
15468 | boundMethod.__reactBoundMethod = method;
|
15469 | boundMethod.__reactBoundArguments = null;
|
15470 | var componentName = component.constructor.displayName;
|
15471 | var _bind = boundMethod.bind;
|
15472 | /* eslint-disable block-scoped-var, no-undef */
|
15473 | boundMethod.bind = function (newThis) {
|
15474 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
15475 | args[_key - 1] = arguments[_key];
|
15476 | }
|
15477 |
|
15478 | // User is trying to bind() an autobound method; we effectively will
|
15479 | // ignore the value of "this" that the user is trying to use, so
|
15480 | // let's warn.
|
15481 | if (newThis !== component && newThis !== null) {
|
15482 | true ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
|
15483 | } else if (!args.length) {
|
15484 | true ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
|
15485 | return boundMethod;
|
15486 | }
|
15487 | var reboundMethod = _bind.apply(boundMethod, arguments);
|
15488 | reboundMethod.__reactBoundContext = component;
|
15489 | reboundMethod.__reactBoundMethod = method;
|
15490 | reboundMethod.__reactBoundArguments = args;
|
15491 | return reboundMethod;
|
15492 | /* eslint-enable */
|
15493 | };
|
15494 | }
|
15495 | return boundMethod;
|
15496 | }
|
15497 |
|
15498 | /**
|
15499 | * Binds all auto-bound methods in a component.
|
15500 | *
|
15501 | * @param {object} component Component whose method is going to be bound.
|
15502 | */
|
15503 | function bindAutoBindMethods(component) {
|
15504 | for (var autoBindKey in component.__reactAutoBindMap) {
|
15505 | if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
|
15506 | var method = component.__reactAutoBindMap[autoBindKey];
|
15507 | component[autoBindKey] = bindAutoBindMethod(component, method);
|
15508 | }
|
15509 | }
|
15510 | }
|
15511 |
|
15512 | /**
|
15513 | * Add more to the ReactClass base class. These are all legacy features and
|
15514 | * therefore not already part of the modern ReactComponent.
|
15515 | */
|
15516 | var ReactClassMixin = {
|
15517 |
|
15518 | /**
|
15519 | * TODO: This will be deprecated because state should always keep a consistent
|
15520 | * type signature and the only use case for this, is to avoid that.
|
15521 | */
|
15522 | replaceState: function (newState, callback) {
|
15523 | this.updater.enqueueReplaceState(this, newState);
|
15524 | if (callback) {
|
15525 | this.updater.enqueueCallback(this, callback);
|
15526 | }
|
15527 | },
|
15528 |
|
15529 | /**
|
15530 | * Checks whether or not this composite component is mounted.
|
15531 | * @return {boolean} True if mounted, false otherwise.
|
15532 | * @protected
|
15533 | * @final
|
15534 | */
|
15535 | isMounted: function () {
|
15536 | return this.updater.isMounted(this);
|
15537 | },
|
15538 |
|
15539 | /**
|
15540 | * Sets a subset of the props.
|
15541 | *
|
15542 | * @param {object} partialProps Subset of the next props.
|
15543 | * @param {?function} callback Called after props are updated.
|
15544 | * @final
|
15545 | * @public
|
15546 | * @deprecated
|
15547 | */
|
15548 | setProps: function (partialProps, callback) {
|
15549 | if (true) {
|
15550 | warnSetProps();
|
15551 | }
|
15552 | this.updater.enqueueSetProps(this, partialProps);
|
15553 | if (callback) {
|
15554 | this.updater.enqueueCallback(this, callback);
|
15555 | }
|
15556 | },
|
15557 |
|
15558 | /**
|
15559 | * Replace all the props.
|
15560 | *
|
15561 | * @param {object} newProps Subset of the next props.
|
15562 | * @param {?function} callback Called after props are updated.
|
15563 | * @final
|
15564 | * @public
|
15565 | * @deprecated
|
15566 | */
|
15567 | replaceProps: function (newProps, callback) {
|
15568 | if (true) {
|
15569 | warnSetProps();
|
15570 | }
|
15571 | this.updater.enqueueReplaceProps(this, newProps);
|
15572 | if (callback) {
|
15573 | this.updater.enqueueCallback(this, callback);
|
15574 | }
|
15575 | }
|
15576 | };
|
15577 |
|
15578 | var ReactClassComponent = function () {};
|
15579 | assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
15580 |
|
15581 | /**
|
15582 | * Module for creating composite components.
|
15583 | *
|
15584 | * @class ReactClass
|
15585 | */
|
15586 | var ReactClass = {
|
15587 |
|
15588 | /**
|
15589 | * Creates a composite component class given a class specification.
|
15590 | *
|
15591 | * @param {object} spec Class specification (which must define `render`).
|
15592 | * @return {function} Component constructor function.
|
15593 | * @public
|
15594 | */
|
15595 | createClass: function (spec) {
|
15596 | var Constructor = function (props, context, updater) {
|
15597 | // This constructor is overridden by mocks. The argument is used
|
15598 | // by mocks to assert on what gets mounted.
|
15599 |
|
15600 | if (true) {
|
15601 | true ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
|
15602 | }
|
15603 |
|
15604 | // Wire up auto-binding
|
15605 | if (this.__reactAutoBindMap) {
|
15606 | bindAutoBindMethods(this);
|
15607 | }
|
15608 |
|
15609 | this.props = props;
|
15610 | this.context = context;
|
15611 | this.refs = emptyObject;
|
15612 | this.updater = updater || ReactNoopUpdateQueue;
|
15613 |
|
15614 | this.state = null;
|
15615 |
|
15616 | // ReactClasses doesn't have constructors. Instead, they use the
|
15617 | // getInitialState and componentWillMount methods for initialization.
|
15618 |
|
15619 | var initialState = this.getInitialState ? this.getInitialState() : null;
|
15620 | if (true) {
|
15621 | // We allow auto-mocks to proceed as if they're returning null.
|
15622 | if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
|
15623 | // This is probably bad practice. Consider warning here and
|
15624 | // deprecating this convenience.
|
15625 | initialState = null;
|
15626 | }
|
15627 | }
|
15628 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? true ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
|
15629 |
|
15630 | this.state = initialState;
|
15631 | };
|
15632 | Constructor.prototype = new ReactClassComponent();
|
15633 | Constructor.prototype.constructor = Constructor;
|
15634 |
|
15635 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
15636 |
|
15637 | mixSpecIntoComponent(Constructor, spec);
|
15638 |
|
15639 | // Initialize the defaultProps property after all mixins have been merged.
|
15640 | if (Constructor.getDefaultProps) {
|
15641 | Constructor.defaultProps = Constructor.getDefaultProps();
|
15642 | }
|
15643 |
|
15644 | if (true) {
|
15645 | // This is a tag to indicate that the use of these method names is ok,
|
15646 | // since it's used with createClass. If it's not, then it's likely a
|
15647 | // mistake so we'll warn you to use the static property, property
|
15648 | // initializer or constructor respectively.
|
15649 | if (Constructor.getDefaultProps) {
|
15650 | Constructor.getDefaultProps.isReactClassApproved = {};
|
15651 | }
|
15652 | if (Constructor.prototype.getInitialState) {
|
15653 | Constructor.prototype.getInitialState.isReactClassApproved = {};
|
15654 | }
|
15655 | }
|
15656 |
|
15657 | !Constructor.prototype.render ? true ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
|
15658 |
|
15659 | if (true) {
|
15660 | true ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
|
15661 | true ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
|
15662 | }
|
15663 |
|
15664 | // Reduce time spent doing lookups by setting these on the prototype.
|
15665 | for (var methodName in ReactClassInterface) {
|
15666 | if (!Constructor.prototype[methodName]) {
|
15667 | Constructor.prototype[methodName] = null;
|
15668 | }
|
15669 | }
|
15670 |
|
15671 | return Constructor;
|
15672 | },
|
15673 |
|
15674 | injection: {
|
15675 | injectMixin: function (mixin) {
|
15676 | injectedMixins.push(mixin);
|
15677 | }
|
15678 | }
|
15679 |
|
15680 | };
|
15681 |
|
15682 | module.exports = ReactClass;
|
15683 |
|
15684 | /***/ },
|
15685 | /* 122 */
|
15686 | /***/ function(module, exports, __webpack_require__) {
|
15687 |
|
15688 | /**
|
15689 | * Copyright 2013-2015, Facebook, Inc.
|
15690 | * All rights reserved.
|
15691 | *
|
15692 | * This source code is licensed under the BSD-style license found in the
|
15693 | * LICENSE file in the root directory of this source tree. An additional grant
|
15694 | * of patent rights can be found in the PATENTS file in the same directory.
|
15695 | *
|
15696 | * @providesModule ReactComponent
|
15697 | */
|
15698 |
|
15699 | 'use strict';
|
15700 |
|
15701 | var ReactNoopUpdateQueue = __webpack_require__(123);
|
15702 |
|
15703 | var canDefineProperty = __webpack_require__(42);
|
15704 | var emptyObject = __webpack_require__(57);
|
15705 | var invariant = __webpack_require__(12);
|
15706 | var warning = __webpack_require__(24);
|
15707 |
|
15708 | /**
|
15709 | * Base class helpers for the updating state of a component.
|
15710 | */
|
15711 | function ReactComponent(props, context, updater) {
|
15712 | this.props = props;
|
15713 | this.context = context;
|
15714 | this.refs = emptyObject;
|
15715 | // We initialize the default updater but the real one gets injected by the
|
15716 | // renderer.
|
15717 | this.updater = updater || ReactNoopUpdateQueue;
|
15718 | }
|
15719 |
|
15720 | ReactComponent.prototype.isReactComponent = {};
|
15721 |
|
15722 | /**
|
15723 | * Sets a subset of the state. Always use this to mutate
|
15724 | * state. You should treat `this.state` as immutable.
|
15725 | *
|
15726 | * There is no guarantee that `this.state` will be immediately updated, so
|
15727 | * accessing `this.state` after calling this method may return the old value.
|
15728 | *
|
15729 | * There is no guarantee that calls to `setState` will run synchronously,
|
15730 | * as they may eventually be batched together. You can provide an optional
|
15731 | * callback that will be executed when the call to setState is actually
|
15732 | * completed.
|
15733 | *
|
15734 | * When a function is provided to setState, it will be called at some point in
|
15735 | * the future (not synchronously). It will be called with the up to date
|
15736 | * component arguments (state, props, context). These values can be different
|
15737 | * from this.* because your function may be called after receiveProps but before
|
15738 | * shouldComponentUpdate, and this new state, props, and context will not yet be
|
15739 | * assigned to this.
|
15740 | *
|
15741 | * @param {object|function} partialState Next partial state or function to
|
15742 | * produce next partial state to be merged with current state.
|
15743 | * @param {?function} callback Called after state is updated.
|
15744 | * @final
|
15745 | * @protected
|
15746 | */
|
15747 | ReactComponent.prototype.setState = function (partialState, callback) {
|
15748 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? true ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
|
15749 | if (true) {
|
15750 | true ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
|
15751 | }
|
15752 | this.updater.enqueueSetState(this, partialState);
|
15753 | if (callback) {
|
15754 | this.updater.enqueueCallback(this, callback);
|
15755 | }
|
15756 | };
|
15757 |
|
15758 | /**
|
15759 | * Forces an update. This should only be invoked when it is known with
|
15760 | * certainty that we are **not** in a DOM transaction.
|
15761 | *
|
15762 | * You may want to call this when you know that some deeper aspect of the
|
15763 | * component's state has changed but `setState` was not called.
|
15764 | *
|
15765 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
15766 | * `componentWillUpdate` and `componentDidUpdate`.
|
15767 | *
|
15768 | * @param {?function} callback Called after update is complete.
|
15769 | * @final
|
15770 | * @protected
|
15771 | */
|
15772 | ReactComponent.prototype.forceUpdate = function (callback) {
|
15773 | this.updater.enqueueForceUpdate(this);
|
15774 | if (callback) {
|
15775 | this.updater.enqueueCallback(this, callback);
|
15776 | }
|
15777 | };
|
15778 |
|
15779 | /**
|
15780 | * Deprecated APIs. These APIs used to exist on classic React classes but since
|
15781 | * we would like to deprecate them, we're not going to move them over to this
|
15782 | * modern base class. Instead, we define a getter that warns if it's accessed.
|
15783 | */
|
15784 | if (true) {
|
15785 | var deprecatedAPIs = {
|
15786 | getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
|
15787 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
15788 | replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
|
15789 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
|
15790 | setProps: ['setProps', 'Instead, call render again at the top level.']
|
15791 | };
|
15792 | var defineDeprecationWarning = function (methodName, info) {
|
15793 | if (canDefineProperty) {
|
15794 | Object.defineProperty(ReactComponent.prototype, methodName, {
|
15795 | get: function () {
|
15796 | true ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
|
15797 | return undefined;
|
15798 | }
|
15799 | });
|
15800 | }
|
15801 | };
|
15802 | for (var fnName in deprecatedAPIs) {
|
15803 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
15804 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
15805 | }
|
15806 | }
|
15807 | }
|
15808 |
|
15809 | module.exports = ReactComponent;
|
15810 |
|
15811 | /***/ },
|
15812 | /* 123 */
|
15813 | /***/ function(module, exports, __webpack_require__) {
|
15814 |
|
15815 | /**
|
15816 | * Copyright 2015, Facebook, Inc.
|
15817 | * All rights reserved.
|
15818 | *
|
15819 | * This source code is licensed under the BSD-style license found in the
|
15820 | * LICENSE file in the root directory of this source tree. An additional grant
|
15821 | * of patent rights can be found in the PATENTS file in the same directory.
|
15822 | *
|
15823 | * @providesModule ReactNoopUpdateQueue
|
15824 | */
|
15825 |
|
15826 | 'use strict';
|
15827 |
|
15828 | var warning = __webpack_require__(24);
|
15829 |
|
15830 | function warnTDZ(publicInstance, callerName) {
|
15831 | if (true) {
|
15832 | true ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
|
15833 | }
|
15834 | }
|
15835 |
|
15836 | /**
|
15837 | * This is the abstract API for an update queue.
|
15838 | */
|
15839 | var ReactNoopUpdateQueue = {
|
15840 |
|
15841 | /**
|
15842 | * Checks whether or not this composite component is mounted.
|
15843 | * @param {ReactClass} publicInstance The instance we want to test.
|
15844 | * @return {boolean} True if mounted, false otherwise.
|
15845 | * @protected
|
15846 | * @final
|
15847 | */
|
15848 | isMounted: function (publicInstance) {
|
15849 | return false;
|
15850 | },
|
15851 |
|
15852 | /**
|
15853 | * Enqueue a callback that will be executed after all the pending updates
|
15854 | * have processed.
|
15855 | *
|
15856 | * @param {ReactClass} publicInstance The instance to use as `this` context.
|
15857 | * @param {?function} callback Called after state is updated.
|
15858 | * @internal
|
15859 | */
|
15860 | enqueueCallback: function (publicInstance, callback) {},
|
15861 |
|
15862 | /**
|
15863 | * Forces an update. This should only be invoked when it is known with
|
15864 | * certainty that we are **not** in a DOM transaction.
|
15865 | *
|
15866 | * You may want to call this when you know that some deeper aspect of the
|
15867 | * component's state has changed but `setState` was not called.
|
15868 | *
|
15869 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
15870 | * `componentWillUpdate` and `componentDidUpdate`.
|
15871 | *
|
15872 | * @param {ReactClass} publicInstance The instance that should rerender.
|
15873 | * @internal
|
15874 | */
|
15875 | enqueueForceUpdate: function (publicInstance) {
|
15876 | warnTDZ(publicInstance, 'forceUpdate');
|
15877 | },
|
15878 |
|
15879 | /**
|
15880 | * Replaces all of the state. Always use this or `setState` to mutate state.
|
15881 | * You should treat `this.state` as immutable.
|
15882 | *
|
15883 | * There is no guarantee that `this.state` will be immediately updated, so
|
15884 | * accessing `this.state` after calling this method may return the old value.
|
15885 | *
|
15886 | * @param {ReactClass} publicInstance The instance that should rerender.
|
15887 | * @param {object} completeState Next state.
|
15888 | * @internal
|
15889 | */
|
15890 | enqueueReplaceState: function (publicInstance, completeState) {
|
15891 | warnTDZ(publicInstance, 'replaceState');
|
15892 | },
|
15893 |
|
15894 | /**
|
15895 | * Sets a subset of the state. This only exists because _pendingState is
|
15896 | * internal. This provides a merging strategy that is not available to deep
|
15897 | * properties which is confusing. TODO: Expose pendingState or don't use it
|
15898 | * during the merge.
|
15899 | *
|
15900 | * @param {ReactClass} publicInstance The instance that should rerender.
|
15901 | * @param {object} partialState Next partial state to be merged with state.
|
15902 | * @internal
|
15903 | */
|
15904 | enqueueSetState: function (publicInstance, partialState) {
|
15905 | warnTDZ(publicInstance, 'setState');
|
15906 | },
|
15907 |
|
15908 | /**
|
15909 | * Sets a subset of the props.
|
15910 | *
|
15911 | * @param {ReactClass} publicInstance The instance that should rerender.
|
15912 | * @param {object} partialProps Subset of the next props.
|
15913 | * @internal
|
15914 | */
|
15915 | enqueueSetProps: function (publicInstance, partialProps) {
|
15916 | warnTDZ(publicInstance, 'setProps');
|
15917 | },
|
15918 |
|
15919 | /**
|
15920 | * Replaces all of the props.
|
15921 | *
|
15922 | * @param {ReactClass} publicInstance The instance that should rerender.
|
15923 | * @param {object} props New props.
|
15924 | * @internal
|
15925 | */
|
15926 | enqueueReplaceProps: function (publicInstance, props) {
|
15927 | warnTDZ(publicInstance, 'replaceProps');
|
15928 | }
|
15929 |
|
15930 | };
|
15931 |
|
15932 | module.exports = ReactNoopUpdateQueue;
|
15933 |
|
15934 | /***/ },
|
15935 | /* 124 */
|
15936 | /***/ function(module, exports, __webpack_require__) {
|
15937 |
|
15938 | /**
|
15939 | * Copyright 2013-2015, Facebook, Inc.
|
15940 | * All rights reserved.
|
15941 | *
|
15942 | * This source code is licensed under the BSD-style license found in the
|
15943 | * LICENSE file in the root directory of this source tree. An additional grant
|
15944 | * of patent rights can be found in the PATENTS file in the same directory.
|
15945 | *
|
15946 | * @providesModule ReactReconcileTransaction
|
15947 | * @typechecks static-only
|
15948 | */
|
15949 |
|
15950 | 'use strict';
|
15951 |
|
15952 | var CallbackQueue = __webpack_require__(54);
|
15953 | var PooledClass = __webpack_require__(55);
|
15954 | var ReactBrowserEventEmitter = __webpack_require__(28);
|
15955 | var ReactDOMFeatureFlags = __webpack_require__(40);
|
15956 | var ReactInputSelection = __webpack_require__(125);
|
15957 | var Transaction = __webpack_require__(56);
|
15958 |
|
15959 | var assign = __webpack_require__(38);
|
15960 |
|
15961 | /**
|
15962 | * Ensures that, when possible, the selection range (currently selected text
|
15963 | * input) is not disturbed by performing the transaction.
|
15964 | */
|
15965 | var SELECTION_RESTORATION = {
|
15966 | /**
|
15967 | * @return {Selection} Selection information.
|
15968 | */
|
15969 | initialize: ReactInputSelection.getSelectionInformation,
|
15970 | /**
|
15971 | * @param {Selection} sel Selection information returned from `initialize`.
|
15972 | */
|
15973 | close: ReactInputSelection.restoreSelection
|
15974 | };
|
15975 |
|
15976 | /**
|
15977 | * Suppresses events (blur/focus) that could be inadvertently dispatched due to
|
15978 | * high level DOM manipulations (like temporarily removing a text input from the
|
15979 | * DOM).
|
15980 | */
|
15981 | var EVENT_SUPPRESSION = {
|
15982 | /**
|
15983 | * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
|
15984 | * the reconciliation.
|
15985 | */
|
15986 | initialize: function () {
|
15987 | var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
|
15988 | ReactBrowserEventEmitter.setEnabled(false);
|
15989 | return currentlyEnabled;
|
15990 | },
|
15991 |
|
15992 | /**
|
15993 | * @param {boolean} previouslyEnabled Enabled status of
|
15994 | * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
|
15995 | * restores the previous value.
|
15996 | */
|
15997 | close: function (previouslyEnabled) {
|
15998 | ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
|
15999 | }
|
16000 | };
|
16001 |
|
16002 | /**
|
16003 | * Provides a queue for collecting `componentDidMount` and
|
16004 | * `componentDidUpdate` callbacks during the the transaction.
|
16005 | */
|
16006 | var ON_DOM_READY_QUEUEING = {
|
16007 | /**
|
16008 | * Initializes the internal `onDOMReady` queue.
|
16009 | */
|
16010 | initialize: function () {
|
16011 | this.reactMountReady.reset();
|
16012 | },
|
16013 |
|
16014 | /**
|
16015 | * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
|
16016 | */
|
16017 | close: function () {
|
16018 | this.reactMountReady.notifyAll();
|
16019 | }
|
16020 | };
|
16021 |
|
16022 | /**
|
16023 | * Executed within the scope of the `Transaction` instance. Consider these as
|
16024 | * being member methods, but with an implied ordering while being isolated from
|
16025 | * each other.
|
16026 | */
|
16027 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
|
16028 |
|
16029 | /**
|
16030 | * Currently:
|
16031 | * - The order that these are listed in the transaction is critical:
|
16032 | * - Suppresses events.
|
16033 | * - Restores selection range.
|
16034 | *
|
16035 | * Future:
|
16036 | * - Restore document/overflow scroll positions that were unintentionally
|
16037 | * modified via DOM insertions above the top viewport boundary.
|
16038 | * - Implement/integrate with customized constraint based layout system and keep
|
16039 | * track of which dimensions must be remeasured.
|
16040 | *
|
16041 | * @class ReactReconcileTransaction
|
16042 | */
|
16043 | function ReactReconcileTransaction(forceHTML) {
|
16044 | this.reinitializeTransaction();
|
16045 | // Only server-side rendering really needs this option (see
|
16046 | // `ReactServerRendering`), but server-side uses
|
16047 | // `ReactServerRenderingTransaction` instead. This option is here so that it's
|
16048 | // accessible and defaults to false when `ReactDOMComponent` and
|
16049 | // `ReactTextComponent` checks it in `mountComponent`.`
|
16050 | this.renderToStaticMarkup = false;
|
16051 | this.reactMountReady = CallbackQueue.getPooled(null);
|
16052 | this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
|
16053 | }
|
16054 |
|
16055 | var Mixin = {
|
16056 | /**
|
16057 | * @see Transaction
|
16058 | * @abstract
|
16059 | * @final
|
16060 | * @return {array<object>} List of operation wrap procedures.
|
16061 | * TODO: convert to array<TransactionWrapper>
|
16062 | */
|
16063 | getTransactionWrappers: function () {
|
16064 | return TRANSACTION_WRAPPERS;
|
16065 | },
|
16066 |
|
16067 | /**
|
16068 | * @return {object} The queue to collect `onDOMReady` callbacks with.
|
16069 | */
|
16070 | getReactMountReady: function () {
|
16071 | return this.reactMountReady;
|
16072 | },
|
16073 |
|
16074 | /**
|
16075 | * `PooledClass` looks for this, and will invoke this before allowing this
|
16076 | * instance to be reused.
|
16077 | */
|
16078 | destructor: function () {
|
16079 | CallbackQueue.release(this.reactMountReady);
|
16080 | this.reactMountReady = null;
|
16081 | }
|
16082 | };
|
16083 |
|
16084 | assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
|
16085 |
|
16086 | PooledClass.addPoolingTo(ReactReconcileTransaction);
|
16087 |
|
16088 | module.exports = ReactReconcileTransaction;
|
16089 |
|
16090 | /***/ },
|
16091 | /* 125 */
|
16092 | /***/ function(module, exports, __webpack_require__) {
|
16093 |
|
16094 | /**
|
16095 | * Copyright 2013-2015, Facebook, Inc.
|
16096 | * All rights reserved.
|
16097 | *
|
16098 | * This source code is licensed under the BSD-style license found in the
|
16099 | * LICENSE file in the root directory of this source tree. An additional grant
|
16100 | * of patent rights can be found in the PATENTS file in the same directory.
|
16101 | *
|
16102 | * @providesModule ReactInputSelection
|
16103 | */
|
16104 |
|
16105 | 'use strict';
|
16106 |
|
16107 | var ReactDOMSelection = __webpack_require__(126);
|
16108 |
|
16109 | var containsNode = __webpack_require__(58);
|
16110 | var focusNode = __webpack_require__(94);
|
16111 | var getActiveElement = __webpack_require__(128);
|
16112 |
|
16113 | function isInDocument(node) {
|
16114 | return containsNode(document.documentElement, node);
|
16115 | }
|
16116 |
|
16117 | /**
|
16118 | * @ReactInputSelection: React input selection module. Based on Selection.js,
|
16119 | * but modified to be suitable for react and has a couple of bug fixes (doesn't
|
16120 | * assume buttons have range selections allowed).
|
16121 | * Input selection module for React.
|
16122 | */
|
16123 | var ReactInputSelection = {
|
16124 |
|
16125 | hasSelectionCapabilities: function (elem) {
|
16126 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
16127 | return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
|
16128 | },
|
16129 |
|
16130 | getSelectionInformation: function () {
|
16131 | var focusedElem = getActiveElement();
|
16132 | return {
|
16133 | focusedElem: focusedElem,
|
16134 | selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
|
16135 | };
|
16136 | },
|
16137 |
|
16138 | /**
|
16139 | * @restoreSelection: If any selection information was potentially lost,
|
16140 | * restore it. This is useful when performing operations that could remove dom
|
16141 | * nodes and place them back in, resulting in focus being lost.
|
16142 | */
|
16143 | restoreSelection: function (priorSelectionInformation) {
|
16144 | var curFocusedElem = getActiveElement();
|
16145 | var priorFocusedElem = priorSelectionInformation.focusedElem;
|
16146 | var priorSelectionRange = priorSelectionInformation.selectionRange;
|
16147 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
|
16148 | if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
|
16149 | ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
|
16150 | }
|
16151 | focusNode(priorFocusedElem);
|
16152 | }
|
16153 | },
|
16154 |
|
16155 | /**
|
16156 | * @getSelection: Gets the selection bounds of a focused textarea, input or
|
16157 | * contentEditable node.
|
16158 | * -@input: Look up selection bounds of this input
|
16159 | * -@return {start: selectionStart, end: selectionEnd}
|
16160 | */
|
16161 | getSelection: function (input) {
|
16162 | var selection;
|
16163 |
|
16164 | if ('selectionStart' in input) {
|
16165 | // Modern browser with input or textarea.
|
16166 | selection = {
|
16167 | start: input.selectionStart,
|
16168 | end: input.selectionEnd
|
16169 | };
|
16170 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
16171 | // IE8 input.
|
16172 | var range = document.selection.createRange();
|
16173 | // There can only be one selection per document in IE, so it must
|
16174 | // be in our element.
|
16175 | if (range.parentElement() === input) {
|
16176 | selection = {
|
16177 | start: -range.moveStart('character', -input.value.length),
|
16178 | end: -range.moveEnd('character', -input.value.length)
|
16179 | };
|
16180 | }
|
16181 | } else {
|
16182 | // Content editable or old IE textarea.
|
16183 | selection = ReactDOMSelection.getOffsets(input);
|
16184 | }
|
16185 |
|
16186 | return selection || { start: 0, end: 0 };
|
16187 | },
|
16188 |
|
16189 | /**
|
16190 | * @setSelection: Sets the selection bounds of a textarea or input and focuses
|
16191 | * the input.
|
16192 | * -@input Set selection bounds of this input or textarea
|
16193 | * -@offsets Object of same form that is returned from get*
|
16194 | */
|
16195 | setSelection: function (input, offsets) {
|
16196 | var start = offsets.start;
|
16197 | var end = offsets.end;
|
16198 | if (typeof end === 'undefined') {
|
16199 | end = start;
|
16200 | }
|
16201 |
|
16202 | if ('selectionStart' in input) {
|
16203 | input.selectionStart = start;
|
16204 | input.selectionEnd = Math.min(end, input.value.length);
|
16205 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
16206 | var range = input.createTextRange();
|
16207 | range.collapse(true);
|
16208 | range.moveStart('character', start);
|
16209 | range.moveEnd('character', end - start);
|
16210 | range.select();
|
16211 | } else {
|
16212 | ReactDOMSelection.setOffsets(input, offsets);
|
16213 | }
|
16214 | }
|
16215 | };
|
16216 |
|
16217 | module.exports = ReactInputSelection;
|
16218 |
|
16219 | /***/ },
|
16220 | /* 126 */
|
16221 | /***/ function(module, exports, __webpack_require__) {
|
16222 |
|
16223 | /**
|
16224 | * Copyright 2013-2015, Facebook, Inc.
|
16225 | * All rights reserved.
|
16226 | *
|
16227 | * This source code is licensed under the BSD-style license found in the
|
16228 | * LICENSE file in the root directory of this source tree. An additional grant
|
16229 | * of patent rights can be found in the PATENTS file in the same directory.
|
16230 | *
|
16231 | * @providesModule ReactDOMSelection
|
16232 | */
|
16233 |
|
16234 | 'use strict';
|
16235 |
|
16236 | var ExecutionEnvironment = __webpack_require__(8);
|
16237 |
|
16238 | var getNodeForCharacterOffset = __webpack_require__(127);
|
16239 | var getTextContentAccessor = __webpack_require__(74);
|
16240 |
|
16241 | /**
|
16242 | * While `isCollapsed` is available on the Selection object and `collapsed`
|
16243 | * is available on the Range object, IE11 sometimes gets them wrong.
|
16244 | * If the anchor/focus nodes and offsets are the same, the range is collapsed.
|
16245 | */
|
16246 | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
|
16247 | return anchorNode === focusNode && anchorOffset === focusOffset;
|
16248 | }
|
16249 |
|
16250 | /**
|
16251 | * Get the appropriate anchor and focus node/offset pairs for IE.
|
16252 | *
|
16253 | * The catch here is that IE's selection API doesn't provide information
|
16254 | * about whether the selection is forward or backward, so we have to
|
16255 | * behave as though it's always forward.
|
16256 | *
|
16257 | * IE text differs from modern selection in that it behaves as though
|
16258 | * block elements end with a new line. This means character offsets will
|
16259 | * differ between the two APIs.
|
16260 | *
|
16261 | * @param {DOMElement} node
|
16262 | * @return {object}
|
16263 | */
|
16264 | function getIEOffsets(node) {
|
16265 | var selection = document.selection;
|
16266 | var selectedRange = selection.createRange();
|
16267 | var selectedLength = selectedRange.text.length;
|
16268 |
|
16269 | // Duplicate selection so we can move range without breaking user selection.
|
16270 | var fromStart = selectedRange.duplicate();
|
16271 | fromStart.moveToElementText(node);
|
16272 | fromStart.setEndPoint('EndToStart', selectedRange);
|
16273 |
|
16274 | var startOffset = fromStart.text.length;
|
16275 | var endOffset = startOffset + selectedLength;
|
16276 |
|
16277 | return {
|
16278 | start: startOffset,
|
16279 | end: endOffset
|
16280 | };
|
16281 | }
|
16282 |
|
16283 | /**
|
16284 | * @param {DOMElement} node
|
16285 | * @return {?object}
|
16286 | */
|
16287 | function getModernOffsets(node) {
|
16288 | var selection = window.getSelection && window.getSelection();
|
16289 |
|
16290 | if (!selection || selection.rangeCount === 0) {
|
16291 | return null;
|
16292 | }
|
16293 |
|
16294 | var anchorNode = selection.anchorNode;
|
16295 | var anchorOffset = selection.anchorOffset;
|
16296 | var focusNode = selection.focusNode;
|
16297 | var focusOffset = selection.focusOffset;
|
16298 |
|
16299 | var currentRange = selection.getRangeAt(0);
|
16300 |
|
16301 | // In Firefox, range.startContainer and range.endContainer can be "anonymous
|
16302 | // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
|
16303 | // divs do not seem to expose properties, triggering a "Permission denied
|
16304 | // error" if any of its properties are accessed. The only seemingly possible
|
16305 | // way to avoid erroring is to access a property that typically works for
|
16306 | // non-anonymous divs and catch any error that may otherwise arise. See
|
16307 | // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
|
16308 | try {
|
16309 | /* eslint-disable no-unused-expressions */
|
16310 | currentRange.startContainer.nodeType;
|
16311 | currentRange.endContainer.nodeType;
|
16312 | /* eslint-enable no-unused-expressions */
|
16313 | } catch (e) {
|
16314 | return null;
|
16315 | }
|
16316 |
|
16317 | // If the node and offset values are the same, the selection is collapsed.
|
16318 | // `Selection.isCollapsed` is available natively, but IE sometimes gets
|
16319 | // this value wrong.
|
16320 | var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
|
16321 |
|
16322 | var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
|
16323 |
|
16324 | var tempRange = currentRange.cloneRange();
|
16325 | tempRange.selectNodeContents(node);
|
16326 | tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
|
16327 |
|
16328 | var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
|
16329 |
|
16330 | var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
|
16331 | var end = start + rangeLength;
|
16332 |
|
16333 | // Detect whether the selection is backward.
|
16334 | var detectionRange = document.createRange();
|
16335 | detectionRange.setStart(anchorNode, anchorOffset);
|
16336 | detectionRange.setEnd(focusNode, focusOffset);
|
16337 | var isBackward = detectionRange.collapsed;
|
16338 |
|
16339 | return {
|
16340 | start: isBackward ? end : start,
|
16341 | end: isBackward ? start : end
|
16342 | };
|
16343 | }
|
16344 |
|
16345 | /**
|
16346 | * @param {DOMElement|DOMTextNode} node
|
16347 | * @param {object} offsets
|
16348 | */
|
16349 | function setIEOffsets(node, offsets) {
|
16350 | var range = document.selection.createRange().duplicate();
|
16351 | var start, end;
|
16352 |
|
16353 | if (typeof offsets.end === 'undefined') {
|
16354 | start = offsets.start;
|
16355 | end = start;
|
16356 | } else if (offsets.start > offsets.end) {
|
16357 | start = offsets.end;
|
16358 | end = offsets.start;
|
16359 | } else {
|
16360 | start = offsets.start;
|
16361 | end = offsets.end;
|
16362 | }
|
16363 |
|
16364 | range.moveToElementText(node);
|
16365 | range.moveStart('character', start);
|
16366 | range.setEndPoint('EndToStart', range);
|
16367 | range.moveEnd('character', end - start);
|
16368 | range.select();
|
16369 | }
|
16370 |
|
16371 | /**
|
16372 | * In modern non-IE browsers, we can support both forward and backward
|
16373 | * selections.
|
16374 | *
|
16375 | * Note: IE10+ supports the Selection object, but it does not support
|
16376 | * the `extend` method, which means that even in modern IE, it's not possible
|
16377 | * to programatically create a backward selection. Thus, for all IE
|
16378 | * versions, we use the old IE API to create our selections.
|
16379 | *
|
16380 | * @param {DOMElement|DOMTextNode} node
|
16381 | * @param {object} offsets
|
16382 | */
|
16383 | function setModernOffsets(node, offsets) {
|
16384 | if (!window.getSelection) {
|
16385 | return;
|
16386 | }
|
16387 |
|
16388 | var selection = window.getSelection();
|
16389 | var length = node[getTextContentAccessor()].length;
|
16390 | var start = Math.min(offsets.start, length);
|
16391 | var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
|
16392 |
|
16393 | // IE 11 uses modern selection, but doesn't support the extend method.
|
16394 | // Flip backward selections, so we can set with a single range.
|
16395 | if (!selection.extend && start > end) {
|
16396 | var temp = end;
|
16397 | end = start;
|
16398 | start = temp;
|
16399 | }
|
16400 |
|
16401 | var startMarker = getNodeForCharacterOffset(node, start);
|
16402 | var endMarker = getNodeForCharacterOffset(node, end);
|
16403 |
|
16404 | if (startMarker && endMarker) {
|
16405 | var range = document.createRange();
|
16406 | range.setStart(startMarker.node, startMarker.offset);
|
16407 | selection.removeAllRanges();
|
16408 |
|
16409 | if (start > end) {
|
16410 | selection.addRange(range);
|
16411 | selection.extend(endMarker.node, endMarker.offset);
|
16412 | } else {
|
16413 | range.setEnd(endMarker.node, endMarker.offset);
|
16414 | selection.addRange(range);
|
16415 | }
|
16416 | }
|
16417 | }
|
16418 |
|
16419 | var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
|
16420 |
|
16421 | var ReactDOMSelection = {
|
16422 | /**
|
16423 | * @param {DOMElement} node
|
16424 | */
|
16425 | getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
|
16426 |
|
16427 | /**
|
16428 | * @param {DOMElement|DOMTextNode} node
|
16429 | * @param {object} offsets
|
16430 | */
|
16431 | setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
|
16432 | };
|
16433 |
|
16434 | module.exports = ReactDOMSelection;
|
16435 |
|
16436 | /***/ },
|
16437 | /* 127 */
|
16438 | /***/ function(module, exports) {
|
16439 |
|
16440 | /**
|
16441 | * Copyright 2013-2015, Facebook, Inc.
|
16442 | * All rights reserved.
|
16443 | *
|
16444 | * This source code is licensed under the BSD-style license found in the
|
16445 | * LICENSE file in the root directory of this source tree. An additional grant
|
16446 | * of patent rights can be found in the PATENTS file in the same directory.
|
16447 | *
|
16448 | * @providesModule getNodeForCharacterOffset
|
16449 | */
|
16450 |
|
16451 | 'use strict';
|
16452 |
|
16453 | /**
|
16454 | * Given any node return the first leaf node without children.
|
16455 | *
|
16456 | * @param {DOMElement|DOMTextNode} node
|
16457 | * @return {DOMElement|DOMTextNode}
|
16458 | */
|
16459 | function getLeafNode(node) {
|
16460 | while (node && node.firstChild) {
|
16461 | node = node.firstChild;
|
16462 | }
|
16463 | return node;
|
16464 | }
|
16465 |
|
16466 | /**
|
16467 | * Get the next sibling within a container. This will walk up the
|
16468 | * DOM if a node's siblings have been exhausted.
|
16469 | *
|
16470 | * @param {DOMElement|DOMTextNode} node
|
16471 | * @return {?DOMElement|DOMTextNode}
|
16472 | */
|
16473 | function getSiblingNode(node) {
|
16474 | while (node) {
|
16475 | if (node.nextSibling) {
|
16476 | return node.nextSibling;
|
16477 | }
|
16478 | node = node.parentNode;
|
16479 | }
|
16480 | }
|
16481 |
|
16482 | /**
|
16483 | * Get object describing the nodes which contain characters at offset.
|
16484 | *
|
16485 | * @param {DOMElement|DOMTextNode} root
|
16486 | * @param {number} offset
|
16487 | * @return {?object}
|
16488 | */
|
16489 | function getNodeForCharacterOffset(root, offset) {
|
16490 | var node = getLeafNode(root);
|
16491 | var nodeStart = 0;
|
16492 | var nodeEnd = 0;
|
16493 |
|
16494 | while (node) {
|
16495 | if (node.nodeType === 3) {
|
16496 | nodeEnd = nodeStart + node.textContent.length;
|
16497 |
|
16498 | if (nodeStart <= offset && nodeEnd >= offset) {
|
16499 | return {
|
16500 | node: node,
|
16501 | offset: offset - nodeStart
|
16502 | };
|
16503 | }
|
16504 |
|
16505 | nodeStart = nodeEnd;
|
16506 | }
|
16507 |
|
16508 | node = getLeafNode(getSiblingNode(node));
|
16509 | }
|
16510 | }
|
16511 |
|
16512 | module.exports = getNodeForCharacterOffset;
|
16513 |
|
16514 | /***/ },
|
16515 | /* 128 */
|
16516 | /***/ function(module, exports) {
|
16517 |
|
16518 | /**
|
16519 | * Copyright 2013-2015, Facebook, Inc.
|
16520 | * All rights reserved.
|
16521 | *
|
16522 | * This source code is licensed under the BSD-style license found in the
|
16523 | * LICENSE file in the root directory of this source tree. An additional grant
|
16524 | * of patent rights can be found in the PATENTS file in the same directory.
|
16525 | *
|
16526 | * @providesModule getActiveElement
|
16527 | * @typechecks
|
16528 | */
|
16529 |
|
16530 | /* eslint-disable fb-www/typeof-undefined */
|
16531 |
|
16532 | /**
|
16533 | * Same as document.activeElement but wraps in a try-catch block. In IE it is
|
16534 | * not safe to call document.activeElement if there is nothing focused.
|
16535 | *
|
16536 | * The activeElement will be null only if the document or document body is not
|
16537 | * yet defined.
|
16538 | */
|
16539 | 'use strict';
|
16540 |
|
16541 | function getActiveElement() /*?DOMElement*/{
|
16542 | if (typeof document === 'undefined') {
|
16543 | return null;
|
16544 | }
|
16545 | try {
|
16546 | return document.activeElement || document.body;
|
16547 | } catch (e) {
|
16548 | return document.body;
|
16549 | }
|
16550 | }
|
16551 |
|
16552 | module.exports = getActiveElement;
|
16553 |
|
16554 | /***/ },
|
16555 | /* 129 */
|
16556 | /***/ function(module, exports, __webpack_require__) {
|
16557 |
|
16558 | /**
|
16559 | * Copyright 2013-2015, Facebook, Inc.
|
16560 | * All rights reserved.
|
16561 | *
|
16562 | * This source code is licensed under the BSD-style license found in the
|
16563 | * LICENSE file in the root directory of this source tree. An additional grant
|
16564 | * of patent rights can be found in the PATENTS file in the same directory.
|
16565 | *
|
16566 | * @providesModule SelectEventPlugin
|
16567 | */
|
16568 |
|
16569 | 'use strict';
|
16570 |
|
16571 | var EventConstants = __webpack_require__(29);
|
16572 | var EventPropagators = __webpack_require__(72);
|
16573 | var ExecutionEnvironment = __webpack_require__(8);
|
16574 | var ReactInputSelection = __webpack_require__(125);
|
16575 | var SyntheticEvent = __webpack_require__(76);
|
16576 |
|
16577 | var getActiveElement = __webpack_require__(128);
|
16578 | var isTextInputElement = __webpack_require__(81);
|
16579 | var keyOf = __webpack_require__(78);
|
16580 | var shallowEqual = __webpack_require__(116);
|
16581 |
|
16582 | var topLevelTypes = EventConstants.topLevelTypes;
|
16583 |
|
16584 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
|
16585 |
|
16586 | var eventTypes = {
|
16587 | select: {
|
16588 | phasedRegistrationNames: {
|
16589 | bubbled: keyOf({ onSelect: null }),
|
16590 | captured: keyOf({ onSelectCapture: null })
|
16591 | },
|
16592 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
|
16593 | }
|
16594 | };
|
16595 |
|
16596 | var activeElement = null;
|
16597 | var activeElementID = null;
|
16598 | var lastSelection = null;
|
16599 | var mouseDown = false;
|
16600 |
|
16601 | // Track whether a listener exists for this plugin. If none exist, we do
|
16602 | // not extract events.
|
16603 | var hasListener = false;
|
16604 | var ON_SELECT_KEY = keyOf({ onSelect: null });
|
16605 |
|
16606 | /**
|
16607 | * Get an object which is a unique representation of the current selection.
|
16608 | *
|
16609 | * The return value will not be consistent across nodes or browsers, but
|
16610 | * two identical selections on the same node will return identical objects.
|
16611 | *
|
16612 | * @param {DOMElement} node
|
16613 | * @return {object}
|
16614 | */
|
16615 | function getSelection(node) {
|
16616 | if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
16617 | return {
|
16618 | start: node.selectionStart,
|
16619 | end: node.selectionEnd
|
16620 | };
|
16621 | } else if (window.getSelection) {
|
16622 | var selection = window.getSelection();
|
16623 | return {
|
16624 | anchorNode: selection.anchorNode,
|
16625 | anchorOffset: selection.anchorOffset,
|
16626 | focusNode: selection.focusNode,
|
16627 | focusOffset: selection.focusOffset
|
16628 | };
|
16629 | } else if (document.selection) {
|
16630 | var range = document.selection.createRange();
|
16631 | return {
|
16632 | parentElement: range.parentElement(),
|
16633 | text: range.text,
|
16634 | top: range.boundingTop,
|
16635 | left: range.boundingLeft
|
16636 | };
|
16637 | }
|
16638 | }
|
16639 |
|
16640 | /**
|
16641 | * Poll selection to see whether it's changed.
|
16642 | *
|
16643 | * @param {object} nativeEvent
|
16644 | * @return {?SyntheticEvent}
|
16645 | */
|
16646 | function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
16647 | // Ensure we have the right element, and that the user is not dragging a
|
16648 | // selection (this matches native `select` event behavior). In HTML5, select
|
16649 | // fires only on input and textarea thus if there's no focused element we
|
16650 | // won't dispatch.
|
16651 | if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
|
16652 | return null;
|
16653 | }
|
16654 |
|
16655 | // Only fire when selection has actually changed.
|
16656 | var currentSelection = getSelection(activeElement);
|
16657 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
16658 | lastSelection = currentSelection;
|
16659 |
|
16660 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
|
16661 |
|
16662 | syntheticEvent.type = 'select';
|
16663 | syntheticEvent.target = activeElement;
|
16664 |
|
16665 | EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
|
16666 |
|
16667 | return syntheticEvent;
|
16668 | }
|
16669 |
|
16670 | return null;
|
16671 | }
|
16672 |
|
16673 | /**
|
16674 | * This plugin creates an `onSelect` event that normalizes select events
|
16675 | * across form elements.
|
16676 | *
|
16677 | * Supported elements are:
|
16678 | * - input (see `isTextInputElement`)
|
16679 | * - textarea
|
16680 | * - contentEditable
|
16681 | *
|
16682 | * This differs from native browser implementations in the following ways:
|
16683 | * - Fires on contentEditable fields as well as inputs.
|
16684 | * - Fires for collapsed selection.
|
16685 | * - Fires after user input.
|
16686 | */
|
16687 | var SelectEventPlugin = {
|
16688 |
|
16689 | eventTypes: eventTypes,
|
16690 |
|
16691 | /**
|
16692 | * @param {string} topLevelType Record from `EventConstants`.
|
16693 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
16694 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
16695 | * @param {object} nativeEvent Native browser event.
|
16696 | * @return {*} An accumulation of synthetic events.
|
16697 | * @see {EventPluginHub.extractEvents}
|
16698 | */
|
16699 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
16700 | if (!hasListener) {
|
16701 | return null;
|
16702 | }
|
16703 |
|
16704 | switch (topLevelType) {
|
16705 | // Track the input node that has focus.
|
16706 | case topLevelTypes.topFocus:
|
16707 | if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
|
16708 | activeElement = topLevelTarget;
|
16709 | activeElementID = topLevelTargetID;
|
16710 | lastSelection = null;
|
16711 | }
|
16712 | break;
|
16713 | case topLevelTypes.topBlur:
|
16714 | activeElement = null;
|
16715 | activeElementID = null;
|
16716 | lastSelection = null;
|
16717 | break;
|
16718 |
|
16719 | // Don't fire the event while the user is dragging. This matches the
|
16720 | // semantics of the native select event.
|
16721 | case topLevelTypes.topMouseDown:
|
16722 | mouseDown = true;
|
16723 | break;
|
16724 | case topLevelTypes.topContextMenu:
|
16725 | case topLevelTypes.topMouseUp:
|
16726 | mouseDown = false;
|
16727 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
16728 |
|
16729 | // Chrome and IE fire non-standard event when selection is changed (and
|
16730 | // sometimes when it hasn't). IE's event fires out of order with respect
|
16731 | // to key and input events on deletion, so we discard it.
|
16732 | //
|
16733 | // Firefox doesn't support selectionchange, so check selection status
|
16734 | // after each key entry. The selection changes after keydown and before
|
16735 | // keyup, but we check on keydown as well in the case of holding down a
|
16736 | // key, when multiple keydown events are fired but only one keyup is.
|
16737 | // This is also our approach for IE handling, for the reason above.
|
16738 | case topLevelTypes.topSelectionChange:
|
16739 | if (skipSelectionChangeEvent) {
|
16740 | break;
|
16741 | }
|
16742 | // falls through
|
16743 | case topLevelTypes.topKeyDown:
|
16744 | case topLevelTypes.topKeyUp:
|
16745 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
16746 | }
|
16747 |
|
16748 | return null;
|
16749 | },
|
16750 |
|
16751 | didPutListener: function (id, registrationName, listener) {
|
16752 | if (registrationName === ON_SELECT_KEY) {
|
16753 | hasListener = true;
|
16754 | }
|
16755 | }
|
16756 | };
|
16757 |
|
16758 | module.exports = SelectEventPlugin;
|
16759 |
|
16760 | /***/ },
|
16761 | /* 130 */
|
16762 | /***/ function(module, exports) {
|
16763 |
|
16764 | /**
|
16765 | * Copyright 2013-2015, Facebook, Inc.
|
16766 | * All rights reserved.
|
16767 | *
|
16768 | * This source code is licensed under the BSD-style license found in the
|
16769 | * LICENSE file in the root directory of this source tree. An additional grant
|
16770 | * of patent rights can be found in the PATENTS file in the same directory.
|
16771 | *
|
16772 | * @providesModule ServerReactRootIndex
|
16773 | * @typechecks
|
16774 | */
|
16775 |
|
16776 | 'use strict';
|
16777 |
|
16778 | /**
|
16779 | * Size of the reactRoot ID space. We generate random numbers for React root
|
16780 | * IDs and if there's a collision the events and DOM update system will
|
16781 | * get confused. In the future we need a way to generate GUIDs but for
|
16782 | * now this will work on a smaller scale.
|
16783 | */
|
16784 | var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
|
16785 |
|
16786 | var ServerReactRootIndex = {
|
16787 | createReactRootIndex: function () {
|
16788 | return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
|
16789 | }
|
16790 | };
|
16791 |
|
16792 | module.exports = ServerReactRootIndex;
|
16793 |
|
16794 | /***/ },
|
16795 | /* 131 */
|
16796 | /***/ function(module, exports, __webpack_require__) {
|
16797 |
|
16798 | /**
|
16799 | * Copyright 2013-2015, Facebook, Inc.
|
16800 | * All rights reserved.
|
16801 | *
|
16802 | * This source code is licensed under the BSD-style license found in the
|
16803 | * LICENSE file in the root directory of this source tree. An additional grant
|
16804 | * of patent rights can be found in the PATENTS file in the same directory.
|
16805 | *
|
16806 | * @providesModule SimpleEventPlugin
|
16807 | */
|
16808 |
|
16809 | 'use strict';
|
16810 |
|
16811 | var EventConstants = __webpack_require__(29);
|
16812 | var EventListener = __webpack_require__(118);
|
16813 | var EventPropagators = __webpack_require__(72);
|
16814 | var ReactMount = __webpack_require__(27);
|
16815 | var SyntheticClipboardEvent = __webpack_require__(132);
|
16816 | var SyntheticEvent = __webpack_require__(76);
|
16817 | var SyntheticFocusEvent = __webpack_require__(133);
|
16818 | var SyntheticKeyboardEvent = __webpack_require__(134);
|
16819 | var SyntheticMouseEvent = __webpack_require__(85);
|
16820 | var SyntheticDragEvent = __webpack_require__(137);
|
16821 | var SyntheticTouchEvent = __webpack_require__(138);
|
16822 | var SyntheticUIEvent = __webpack_require__(86);
|
16823 | var SyntheticWheelEvent = __webpack_require__(139);
|
16824 |
|
16825 | var emptyFunction = __webpack_require__(14);
|
16826 | var getEventCharCode = __webpack_require__(135);
|
16827 | var invariant = __webpack_require__(12);
|
16828 | var keyOf = __webpack_require__(78);
|
16829 |
|
16830 | var topLevelTypes = EventConstants.topLevelTypes;
|
16831 |
|
16832 | var eventTypes = {
|
16833 | abort: {
|
16834 | phasedRegistrationNames: {
|
16835 | bubbled: keyOf({ onAbort: true }),
|
16836 | captured: keyOf({ onAbortCapture: true })
|
16837 | }
|
16838 | },
|
16839 | blur: {
|
16840 | phasedRegistrationNames: {
|
16841 | bubbled: keyOf({ onBlur: true }),
|
16842 | captured: keyOf({ onBlurCapture: true })
|
16843 | }
|
16844 | },
|
16845 | canPlay: {
|
16846 | phasedRegistrationNames: {
|
16847 | bubbled: keyOf({ onCanPlay: true }),
|
16848 | captured: keyOf({ onCanPlayCapture: true })
|
16849 | }
|
16850 | },
|
16851 | canPlayThrough: {
|
16852 | phasedRegistrationNames: {
|
16853 | bubbled: keyOf({ onCanPlayThrough: true }),
|
16854 | captured: keyOf({ onCanPlayThroughCapture: true })
|
16855 | }
|
16856 | },
|
16857 | click: {
|
16858 | phasedRegistrationNames: {
|
16859 | bubbled: keyOf({ onClick: true }),
|
16860 | captured: keyOf({ onClickCapture: true })
|
16861 | }
|
16862 | },
|
16863 | contextMenu: {
|
16864 | phasedRegistrationNames: {
|
16865 | bubbled: keyOf({ onContextMenu: true }),
|
16866 | captured: keyOf({ onContextMenuCapture: true })
|
16867 | }
|
16868 | },
|
16869 | copy: {
|
16870 | phasedRegistrationNames: {
|
16871 | bubbled: keyOf({ onCopy: true }),
|
16872 | captured: keyOf({ onCopyCapture: true })
|
16873 | }
|
16874 | },
|
16875 | cut: {
|
16876 | phasedRegistrationNames: {
|
16877 | bubbled: keyOf({ onCut: true }),
|
16878 | captured: keyOf({ onCutCapture: true })
|
16879 | }
|
16880 | },
|
16881 | doubleClick: {
|
16882 | phasedRegistrationNames: {
|
16883 | bubbled: keyOf({ onDoubleClick: true }),
|
16884 | captured: keyOf({ onDoubleClickCapture: true })
|
16885 | }
|
16886 | },
|
16887 | drag: {
|
16888 | phasedRegistrationNames: {
|
16889 | bubbled: keyOf({ onDrag: true }),
|
16890 | captured: keyOf({ onDragCapture: true })
|
16891 | }
|
16892 | },
|
16893 | dragEnd: {
|
16894 | phasedRegistrationNames: {
|
16895 | bubbled: keyOf({ onDragEnd: true }),
|
16896 | captured: keyOf({ onDragEndCapture: true })
|
16897 | }
|
16898 | },
|
16899 | dragEnter: {
|
16900 | phasedRegistrationNames: {
|
16901 | bubbled: keyOf({ onDragEnter: true }),
|
16902 | captured: keyOf({ onDragEnterCapture: true })
|
16903 | }
|
16904 | },
|
16905 | dragExit: {
|
16906 | phasedRegistrationNames: {
|
16907 | bubbled: keyOf({ onDragExit: true }),
|
16908 | captured: keyOf({ onDragExitCapture: true })
|
16909 | }
|
16910 | },
|
16911 | dragLeave: {
|
16912 | phasedRegistrationNames: {
|
16913 | bubbled: keyOf({ onDragLeave: true }),
|
16914 | captured: keyOf({ onDragLeaveCapture: true })
|
16915 | }
|
16916 | },
|
16917 | dragOver: {
|
16918 | phasedRegistrationNames: {
|
16919 | bubbled: keyOf({ onDragOver: true }),
|
16920 | captured: keyOf({ onDragOverCapture: true })
|
16921 | }
|
16922 | },
|
16923 | dragStart: {
|
16924 | phasedRegistrationNames: {
|
16925 | bubbled: keyOf({ onDragStart: true }),
|
16926 | captured: keyOf({ onDragStartCapture: true })
|
16927 | }
|
16928 | },
|
16929 | drop: {
|
16930 | phasedRegistrationNames: {
|
16931 | bubbled: keyOf({ onDrop: true }),
|
16932 | captured: keyOf({ onDropCapture: true })
|
16933 | }
|
16934 | },
|
16935 | durationChange: {
|
16936 | phasedRegistrationNames: {
|
16937 | bubbled: keyOf({ onDurationChange: true }),
|
16938 | captured: keyOf({ onDurationChangeCapture: true })
|
16939 | }
|
16940 | },
|
16941 | emptied: {
|
16942 | phasedRegistrationNames: {
|
16943 | bubbled: keyOf({ onEmptied: true }),
|
16944 | captured: keyOf({ onEmptiedCapture: true })
|
16945 | }
|
16946 | },
|
16947 | encrypted: {
|
16948 | phasedRegistrationNames: {
|
16949 | bubbled: keyOf({ onEncrypted: true }),
|
16950 | captured: keyOf({ onEncryptedCapture: true })
|
16951 | }
|
16952 | },
|
16953 | ended: {
|
16954 | phasedRegistrationNames: {
|
16955 | bubbled: keyOf({ onEnded: true }),
|
16956 | captured: keyOf({ onEndedCapture: true })
|
16957 | }
|
16958 | },
|
16959 | error: {
|
16960 | phasedRegistrationNames: {
|
16961 | bubbled: keyOf({ onError: true }),
|
16962 | captured: keyOf({ onErrorCapture: true })
|
16963 | }
|
16964 | },
|
16965 | focus: {
|
16966 | phasedRegistrationNames: {
|
16967 | bubbled: keyOf({ onFocus: true }),
|
16968 | captured: keyOf({ onFocusCapture: true })
|
16969 | }
|
16970 | },
|
16971 | input: {
|
16972 | phasedRegistrationNames: {
|
16973 | bubbled: keyOf({ onInput: true }),
|
16974 | captured: keyOf({ onInputCapture: true })
|
16975 | }
|
16976 | },
|
16977 | keyDown: {
|
16978 | phasedRegistrationNames: {
|
16979 | bubbled: keyOf({ onKeyDown: true }),
|
16980 | captured: keyOf({ onKeyDownCapture: true })
|
16981 | }
|
16982 | },
|
16983 | keyPress: {
|
16984 | phasedRegistrationNames: {
|
16985 | bubbled: keyOf({ onKeyPress: true }),
|
16986 | captured: keyOf({ onKeyPressCapture: true })
|
16987 | }
|
16988 | },
|
16989 | keyUp: {
|
16990 | phasedRegistrationNames: {
|
16991 | bubbled: keyOf({ onKeyUp: true }),
|
16992 | captured: keyOf({ onKeyUpCapture: true })
|
16993 | }
|
16994 | },
|
16995 | load: {
|
16996 | phasedRegistrationNames: {
|
16997 | bubbled: keyOf({ onLoad: true }),
|
16998 | captured: keyOf({ onLoadCapture: true })
|
16999 | }
|
17000 | },
|
17001 | loadedData: {
|
17002 | phasedRegistrationNames: {
|
17003 | bubbled: keyOf({ onLoadedData: true }),
|
17004 | captured: keyOf({ onLoadedDataCapture: true })
|
17005 | }
|
17006 | },
|
17007 | loadedMetadata: {
|
17008 | phasedRegistrationNames: {
|
17009 | bubbled: keyOf({ onLoadedMetadata: true }),
|
17010 | captured: keyOf({ onLoadedMetadataCapture: true })
|
17011 | }
|
17012 | },
|
17013 | loadStart: {
|
17014 | phasedRegistrationNames: {
|
17015 | bubbled: keyOf({ onLoadStart: true }),
|
17016 | captured: keyOf({ onLoadStartCapture: true })
|
17017 | }
|
17018 | },
|
17019 | // Note: We do not allow listening to mouseOver events. Instead, use the
|
17020 | // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
17021 | mouseDown: {
|
17022 | phasedRegistrationNames: {
|
17023 | bubbled: keyOf({ onMouseDown: true }),
|
17024 | captured: keyOf({ onMouseDownCapture: true })
|
17025 | }
|
17026 | },
|
17027 | mouseMove: {
|
17028 | phasedRegistrationNames: {
|
17029 | bubbled: keyOf({ onMouseMove: true }),
|
17030 | captured: keyOf({ onMouseMoveCapture: true })
|
17031 | }
|
17032 | },
|
17033 | mouseOut: {
|
17034 | phasedRegistrationNames: {
|
17035 | bubbled: keyOf({ onMouseOut: true }),
|
17036 | captured: keyOf({ onMouseOutCapture: true })
|
17037 | }
|
17038 | },
|
17039 | mouseOver: {
|
17040 | phasedRegistrationNames: {
|
17041 | bubbled: keyOf({ onMouseOver: true }),
|
17042 | captured: keyOf({ onMouseOverCapture: true })
|
17043 | }
|
17044 | },
|
17045 | mouseUp: {
|
17046 | phasedRegistrationNames: {
|
17047 | bubbled: keyOf({ onMouseUp: true }),
|
17048 | captured: keyOf({ onMouseUpCapture: true })
|
17049 | }
|
17050 | },
|
17051 | paste: {
|
17052 | phasedRegistrationNames: {
|
17053 | bubbled: keyOf({ onPaste: true }),
|
17054 | captured: keyOf({ onPasteCapture: true })
|
17055 | }
|
17056 | },
|
17057 | pause: {
|
17058 | phasedRegistrationNames: {
|
17059 | bubbled: keyOf({ onPause: true }),
|
17060 | captured: keyOf({ onPauseCapture: true })
|
17061 | }
|
17062 | },
|
17063 | play: {
|
17064 | phasedRegistrationNames: {
|
17065 | bubbled: keyOf({ onPlay: true }),
|
17066 | captured: keyOf({ onPlayCapture: true })
|
17067 | }
|
17068 | },
|
17069 | playing: {
|
17070 | phasedRegistrationNames: {
|
17071 | bubbled: keyOf({ onPlaying: true }),
|
17072 | captured: keyOf({ onPlayingCapture: true })
|
17073 | }
|
17074 | },
|
17075 | progress: {
|
17076 | phasedRegistrationNames: {
|
17077 | bubbled: keyOf({ onProgress: true }),
|
17078 | captured: keyOf({ onProgressCapture: true })
|
17079 | }
|
17080 | },
|
17081 | rateChange: {
|
17082 | phasedRegistrationNames: {
|
17083 | bubbled: keyOf({ onRateChange: true }),
|
17084 | captured: keyOf({ onRateChangeCapture: true })
|
17085 | }
|
17086 | },
|
17087 | reset: {
|
17088 | phasedRegistrationNames: {
|
17089 | bubbled: keyOf({ onReset: true }),
|
17090 | captured: keyOf({ onResetCapture: true })
|
17091 | }
|
17092 | },
|
17093 | scroll: {
|
17094 | phasedRegistrationNames: {
|
17095 | bubbled: keyOf({ onScroll: true }),
|
17096 | captured: keyOf({ onScrollCapture: true })
|
17097 | }
|
17098 | },
|
17099 | seeked: {
|
17100 | phasedRegistrationNames: {
|
17101 | bubbled: keyOf({ onSeeked: true }),
|
17102 | captured: keyOf({ onSeekedCapture: true })
|
17103 | }
|
17104 | },
|
17105 | seeking: {
|
17106 | phasedRegistrationNames: {
|
17107 | bubbled: keyOf({ onSeeking: true }),
|
17108 | captured: keyOf({ onSeekingCapture: true })
|
17109 | }
|
17110 | },
|
17111 | stalled: {
|
17112 | phasedRegistrationNames: {
|
17113 | bubbled: keyOf({ onStalled: true }),
|
17114 | captured: keyOf({ onStalledCapture: true })
|
17115 | }
|
17116 | },
|
17117 | submit: {
|
17118 | phasedRegistrationNames: {
|
17119 | bubbled: keyOf({ onSubmit: true }),
|
17120 | captured: keyOf({ onSubmitCapture: true })
|
17121 | }
|
17122 | },
|
17123 | suspend: {
|
17124 | phasedRegistrationNames: {
|
17125 | bubbled: keyOf({ onSuspend: true }),
|
17126 | captured: keyOf({ onSuspendCapture: true })
|
17127 | }
|
17128 | },
|
17129 | timeUpdate: {
|
17130 | phasedRegistrationNames: {
|
17131 | bubbled: keyOf({ onTimeUpdate: true }),
|
17132 | captured: keyOf({ onTimeUpdateCapture: true })
|
17133 | }
|
17134 | },
|
17135 | touchCancel: {
|
17136 | phasedRegistrationNames: {
|
17137 | bubbled: keyOf({ onTouchCancel: true }),
|
17138 | captured: keyOf({ onTouchCancelCapture: true })
|
17139 | }
|
17140 | },
|
17141 | touchEnd: {
|
17142 | phasedRegistrationNames: {
|
17143 | bubbled: keyOf({ onTouchEnd: true }),
|
17144 | captured: keyOf({ onTouchEndCapture: true })
|
17145 | }
|
17146 | },
|
17147 | touchMove: {
|
17148 | phasedRegistrationNames: {
|
17149 | bubbled: keyOf({ onTouchMove: true }),
|
17150 | captured: keyOf({ onTouchMoveCapture: true })
|
17151 | }
|
17152 | },
|
17153 | touchStart: {
|
17154 | phasedRegistrationNames: {
|
17155 | bubbled: keyOf({ onTouchStart: true }),
|
17156 | captured: keyOf({ onTouchStartCapture: true })
|
17157 | }
|
17158 | },
|
17159 | volumeChange: {
|
17160 | phasedRegistrationNames: {
|
17161 | bubbled: keyOf({ onVolumeChange: true }),
|
17162 | captured: keyOf({ onVolumeChangeCapture: true })
|
17163 | }
|
17164 | },
|
17165 | waiting: {
|
17166 | phasedRegistrationNames: {
|
17167 | bubbled: keyOf({ onWaiting: true }),
|
17168 | captured: keyOf({ onWaitingCapture: true })
|
17169 | }
|
17170 | },
|
17171 | wheel: {
|
17172 | phasedRegistrationNames: {
|
17173 | bubbled: keyOf({ onWheel: true }),
|
17174 | captured: keyOf({ onWheelCapture: true })
|
17175 | }
|
17176 | }
|
17177 | };
|
17178 |
|
17179 | var topLevelEventsToDispatchConfig = {
|
17180 | topAbort: eventTypes.abort,
|
17181 | topBlur: eventTypes.blur,
|
17182 | topCanPlay: eventTypes.canPlay,
|
17183 | topCanPlayThrough: eventTypes.canPlayThrough,
|
17184 | topClick: eventTypes.click,
|
17185 | topContextMenu: eventTypes.contextMenu,
|
17186 | topCopy: eventTypes.copy,
|
17187 | topCut: eventTypes.cut,
|
17188 | topDoubleClick: eventTypes.doubleClick,
|
17189 | topDrag: eventTypes.drag,
|
17190 | topDragEnd: eventTypes.dragEnd,
|
17191 | topDragEnter: eventTypes.dragEnter,
|
17192 | topDragExit: eventTypes.dragExit,
|
17193 | topDragLeave: eventTypes.dragLeave,
|
17194 | topDragOver: eventTypes.dragOver,
|
17195 | topDragStart: eventTypes.dragStart,
|
17196 | topDrop: eventTypes.drop,
|
17197 | topDurationChange: eventTypes.durationChange,
|
17198 | topEmptied: eventTypes.emptied,
|
17199 | topEncrypted: eventTypes.encrypted,
|
17200 | topEnded: eventTypes.ended,
|
17201 | topError: eventTypes.error,
|
17202 | topFocus: eventTypes.focus,
|
17203 | topInput: eventTypes.input,
|
17204 | topKeyDown: eventTypes.keyDown,
|
17205 | topKeyPress: eventTypes.keyPress,
|
17206 | topKeyUp: eventTypes.keyUp,
|
17207 | topLoad: eventTypes.load,
|
17208 | topLoadedData: eventTypes.loadedData,
|
17209 | topLoadedMetadata: eventTypes.loadedMetadata,
|
17210 | topLoadStart: eventTypes.loadStart,
|
17211 | topMouseDown: eventTypes.mouseDown,
|
17212 | topMouseMove: eventTypes.mouseMove,
|
17213 | topMouseOut: eventTypes.mouseOut,
|
17214 | topMouseOver: eventTypes.mouseOver,
|
17215 | topMouseUp: eventTypes.mouseUp,
|
17216 | topPaste: eventTypes.paste,
|
17217 | topPause: eventTypes.pause,
|
17218 | topPlay: eventTypes.play,
|
17219 | topPlaying: eventTypes.playing,
|
17220 | topProgress: eventTypes.progress,
|
17221 | topRateChange: eventTypes.rateChange,
|
17222 | topReset: eventTypes.reset,
|
17223 | topScroll: eventTypes.scroll,
|
17224 | topSeeked: eventTypes.seeked,
|
17225 | topSeeking: eventTypes.seeking,
|
17226 | topStalled: eventTypes.stalled,
|
17227 | topSubmit: eventTypes.submit,
|
17228 | topSuspend: eventTypes.suspend,
|
17229 | topTimeUpdate: eventTypes.timeUpdate,
|
17230 | topTouchCancel: eventTypes.touchCancel,
|
17231 | topTouchEnd: eventTypes.touchEnd,
|
17232 | topTouchMove: eventTypes.touchMove,
|
17233 | topTouchStart: eventTypes.touchStart,
|
17234 | topVolumeChange: eventTypes.volumeChange,
|
17235 | topWaiting: eventTypes.waiting,
|
17236 | topWheel: eventTypes.wheel
|
17237 | };
|
17238 |
|
17239 | for (var type in topLevelEventsToDispatchConfig) {
|
17240 | topLevelEventsToDispatchConfig[type].dependencies = [type];
|
17241 | }
|
17242 |
|
17243 | var ON_CLICK_KEY = keyOf({ onClick: null });
|
17244 | var onClickListeners = {};
|
17245 |
|
17246 | var SimpleEventPlugin = {
|
17247 |
|
17248 | eventTypes: eventTypes,
|
17249 |
|
17250 | /**
|
17251 | * @param {string} topLevelType Record from `EventConstants`.
|
17252 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
17253 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
17254 | * @param {object} nativeEvent Native browser event.
|
17255 | * @return {*} An accumulation of synthetic events.
|
17256 | * @see {EventPluginHub.extractEvents}
|
17257 | */
|
17258 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
17259 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
17260 | if (!dispatchConfig) {
|
17261 | return null;
|
17262 | }
|
17263 | var EventConstructor;
|
17264 | switch (topLevelType) {
|
17265 | case topLevelTypes.topAbort:
|
17266 | case topLevelTypes.topCanPlay:
|
17267 | case topLevelTypes.topCanPlayThrough:
|
17268 | case topLevelTypes.topDurationChange:
|
17269 | case topLevelTypes.topEmptied:
|
17270 | case topLevelTypes.topEncrypted:
|
17271 | case topLevelTypes.topEnded:
|
17272 | case topLevelTypes.topError:
|
17273 | case topLevelTypes.topInput:
|
17274 | case topLevelTypes.topLoad:
|
17275 | case topLevelTypes.topLoadedData:
|
17276 | case topLevelTypes.topLoadedMetadata:
|
17277 | case topLevelTypes.topLoadStart:
|
17278 | case topLevelTypes.topPause:
|
17279 | case topLevelTypes.topPlay:
|
17280 | case topLevelTypes.topPlaying:
|
17281 | case topLevelTypes.topProgress:
|
17282 | case topLevelTypes.topRateChange:
|
17283 | case topLevelTypes.topReset:
|
17284 | case topLevelTypes.topSeeked:
|
17285 | case topLevelTypes.topSeeking:
|
17286 | case topLevelTypes.topStalled:
|
17287 | case topLevelTypes.topSubmit:
|
17288 | case topLevelTypes.topSuspend:
|
17289 | case topLevelTypes.topTimeUpdate:
|
17290 | case topLevelTypes.topVolumeChange:
|
17291 | case topLevelTypes.topWaiting:
|
17292 | // HTML Events
|
17293 | // @see http://www.w3.org/TR/html5/index.html#events-0
|
17294 | EventConstructor = SyntheticEvent;
|
17295 | break;
|
17296 | case topLevelTypes.topKeyPress:
|
17297 | // FireFox creates a keypress event for function keys too. This removes
|
17298 | // the unwanted keypress events. Enter is however both printable and
|
17299 | // non-printable. One would expect Tab to be as well (but it isn't).
|
17300 | if (getEventCharCode(nativeEvent) === 0) {
|
17301 | return null;
|
17302 | }
|
17303 | /* falls through */
|
17304 | case topLevelTypes.topKeyDown:
|
17305 | case topLevelTypes.topKeyUp:
|
17306 | EventConstructor = SyntheticKeyboardEvent;
|
17307 | break;
|
17308 | case topLevelTypes.topBlur:
|
17309 | case topLevelTypes.topFocus:
|
17310 | EventConstructor = SyntheticFocusEvent;
|
17311 | break;
|
17312 | case topLevelTypes.topClick:
|
17313 | // Firefox creates a click event on right mouse clicks. This removes the
|
17314 | // unwanted click events.
|
17315 | if (nativeEvent.button === 2) {
|
17316 | return null;
|
17317 | }
|
17318 | /* falls through */
|
17319 | case topLevelTypes.topContextMenu:
|
17320 | case topLevelTypes.topDoubleClick:
|
17321 | case topLevelTypes.topMouseDown:
|
17322 | case topLevelTypes.topMouseMove:
|
17323 | case topLevelTypes.topMouseOut:
|
17324 | case topLevelTypes.topMouseOver:
|
17325 | case topLevelTypes.topMouseUp:
|
17326 | EventConstructor = SyntheticMouseEvent;
|
17327 | break;
|
17328 | case topLevelTypes.topDrag:
|
17329 | case topLevelTypes.topDragEnd:
|
17330 | case topLevelTypes.topDragEnter:
|
17331 | case topLevelTypes.topDragExit:
|
17332 | case topLevelTypes.topDragLeave:
|
17333 | case topLevelTypes.topDragOver:
|
17334 | case topLevelTypes.topDragStart:
|
17335 | case topLevelTypes.topDrop:
|
17336 | EventConstructor = SyntheticDragEvent;
|
17337 | break;
|
17338 | case topLevelTypes.topTouchCancel:
|
17339 | case topLevelTypes.topTouchEnd:
|
17340 | case topLevelTypes.topTouchMove:
|
17341 | case topLevelTypes.topTouchStart:
|
17342 | EventConstructor = SyntheticTouchEvent;
|
17343 | break;
|
17344 | case topLevelTypes.topScroll:
|
17345 | EventConstructor = SyntheticUIEvent;
|
17346 | break;
|
17347 | case topLevelTypes.topWheel:
|
17348 | EventConstructor = SyntheticWheelEvent;
|
17349 | break;
|
17350 | case topLevelTypes.topCopy:
|
17351 | case topLevelTypes.topCut:
|
17352 | case topLevelTypes.topPaste:
|
17353 | EventConstructor = SyntheticClipboardEvent;
|
17354 | break;
|
17355 | }
|
17356 | !EventConstructor ? true ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
17357 | var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
17358 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
17359 | return event;
|
17360 | },
|
17361 |
|
17362 | didPutListener: function (id, registrationName, listener) {
|
17363 | // Mobile Safari does not fire properly bubble click events on
|
17364 | // non-interactive elements, which means delegated click listeners do not
|
17365 | // fire. The workaround for this bug involves attaching an empty click
|
17366 | // listener on the target node.
|
17367 | if (registrationName === ON_CLICK_KEY) {
|
17368 | var node = ReactMount.getNode(id);
|
17369 | if (!onClickListeners[id]) {
|
17370 | onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
|
17371 | }
|
17372 | }
|
17373 | },
|
17374 |
|
17375 | willDeleteListener: function (id, registrationName) {
|
17376 | if (registrationName === ON_CLICK_KEY) {
|
17377 | onClickListeners[id].remove();
|
17378 | delete onClickListeners[id];
|
17379 | }
|
17380 | }
|
17381 |
|
17382 | };
|
17383 |
|
17384 | module.exports = SimpleEventPlugin;
|
17385 |
|
17386 | /***/ },
|
17387 | /* 132 */
|
17388 | /***/ function(module, exports, __webpack_require__) {
|
17389 |
|
17390 | /**
|
17391 | * Copyright 2013-2015, Facebook, Inc.
|
17392 | * All rights reserved.
|
17393 | *
|
17394 | * This source code is licensed under the BSD-style license found in the
|
17395 | * LICENSE file in the root directory of this source tree. An additional grant
|
17396 | * of patent rights can be found in the PATENTS file in the same directory.
|
17397 | *
|
17398 | * @providesModule SyntheticClipboardEvent
|
17399 | * @typechecks static-only
|
17400 | */
|
17401 |
|
17402 | 'use strict';
|
17403 |
|
17404 | var SyntheticEvent = __webpack_require__(76);
|
17405 |
|
17406 | /**
|
17407 | * @interface Event
|
17408 | * @see http://www.w3.org/TR/clipboard-apis/
|
17409 | */
|
17410 | var ClipboardEventInterface = {
|
17411 | clipboardData: function (event) {
|
17412 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
17413 | }
|
17414 | };
|
17415 |
|
17416 | /**
|
17417 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17418 | * @param {string} dispatchMarker Marker identifying the event target.
|
17419 | * @param {object} nativeEvent Native browser event.
|
17420 | * @extends {SyntheticUIEvent}
|
17421 | */
|
17422 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17423 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17424 | }
|
17425 |
|
17426 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
17427 |
|
17428 | module.exports = SyntheticClipboardEvent;
|
17429 |
|
17430 | /***/ },
|
17431 | /* 133 */
|
17432 | /***/ function(module, exports, __webpack_require__) {
|
17433 |
|
17434 | /**
|
17435 | * Copyright 2013-2015, Facebook, Inc.
|
17436 | * All rights reserved.
|
17437 | *
|
17438 | * This source code is licensed under the BSD-style license found in the
|
17439 | * LICENSE file in the root directory of this source tree. An additional grant
|
17440 | * of patent rights can be found in the PATENTS file in the same directory.
|
17441 | *
|
17442 | * @providesModule SyntheticFocusEvent
|
17443 | * @typechecks static-only
|
17444 | */
|
17445 |
|
17446 | 'use strict';
|
17447 |
|
17448 | var SyntheticUIEvent = __webpack_require__(86);
|
17449 |
|
17450 | /**
|
17451 | * @interface FocusEvent
|
17452 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17453 | */
|
17454 | var FocusEventInterface = {
|
17455 | relatedTarget: null
|
17456 | };
|
17457 |
|
17458 | /**
|
17459 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17460 | * @param {string} dispatchMarker Marker identifying the event target.
|
17461 | * @param {object} nativeEvent Native browser event.
|
17462 | * @extends {SyntheticUIEvent}
|
17463 | */
|
17464 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17465 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17466 | }
|
17467 |
|
17468 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
|
17469 |
|
17470 | module.exports = SyntheticFocusEvent;
|
17471 |
|
17472 | /***/ },
|
17473 | /* 134 */
|
17474 | /***/ function(module, exports, __webpack_require__) {
|
17475 |
|
17476 | /**
|
17477 | * Copyright 2013-2015, Facebook, Inc.
|
17478 | * All rights reserved.
|
17479 | *
|
17480 | * This source code is licensed under the BSD-style license found in the
|
17481 | * LICENSE file in the root directory of this source tree. An additional grant
|
17482 | * of patent rights can be found in the PATENTS file in the same directory.
|
17483 | *
|
17484 | * @providesModule SyntheticKeyboardEvent
|
17485 | * @typechecks static-only
|
17486 | */
|
17487 |
|
17488 | 'use strict';
|
17489 |
|
17490 | var SyntheticUIEvent = __webpack_require__(86);
|
17491 |
|
17492 | var getEventCharCode = __webpack_require__(135);
|
17493 | var getEventKey = __webpack_require__(136);
|
17494 | var getEventModifierState = __webpack_require__(87);
|
17495 |
|
17496 | /**
|
17497 | * @interface KeyboardEvent
|
17498 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17499 | */
|
17500 | var KeyboardEventInterface = {
|
17501 | key: getEventKey,
|
17502 | location: null,
|
17503 | ctrlKey: null,
|
17504 | shiftKey: null,
|
17505 | altKey: null,
|
17506 | metaKey: null,
|
17507 | repeat: null,
|
17508 | locale: null,
|
17509 | getModifierState: getEventModifierState,
|
17510 | // Legacy Interface
|
17511 | charCode: function (event) {
|
17512 | // `charCode` is the result of a KeyPress event and represents the value of
|
17513 | // the actual printable character.
|
17514 |
|
17515 | // KeyPress is deprecated, but its replacement is not yet final and not
|
17516 | // implemented in any major browser. Only KeyPress has charCode.
|
17517 | if (event.type === 'keypress') {
|
17518 | return getEventCharCode(event);
|
17519 | }
|
17520 | return 0;
|
17521 | },
|
17522 | keyCode: function (event) {
|
17523 | // `keyCode` is the result of a KeyDown/Up event and represents the value of
|
17524 | // physical keyboard key.
|
17525 |
|
17526 | // The actual meaning of the value depends on the users' keyboard layout
|
17527 | // which cannot be detected. Assuming that it is a US keyboard layout
|
17528 | // provides a surprisingly accurate mapping for US and European users.
|
17529 | // Due to this, it is left to the user to implement at this time.
|
17530 | if (event.type === 'keydown' || event.type === 'keyup') {
|
17531 | return event.keyCode;
|
17532 | }
|
17533 | return 0;
|
17534 | },
|
17535 | which: function (event) {
|
17536 | // `which` is an alias for either `keyCode` or `charCode` depending on the
|
17537 | // type of the event.
|
17538 | if (event.type === 'keypress') {
|
17539 | return getEventCharCode(event);
|
17540 | }
|
17541 | if (event.type === 'keydown' || event.type === 'keyup') {
|
17542 | return event.keyCode;
|
17543 | }
|
17544 | return 0;
|
17545 | }
|
17546 | };
|
17547 |
|
17548 | /**
|
17549 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17550 | * @param {string} dispatchMarker Marker identifying the event target.
|
17551 | * @param {object} nativeEvent Native browser event.
|
17552 | * @extends {SyntheticUIEvent}
|
17553 | */
|
17554 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17555 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17556 | }
|
17557 |
|
17558 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
|
17559 |
|
17560 | module.exports = SyntheticKeyboardEvent;
|
17561 |
|
17562 | /***/ },
|
17563 | /* 135 */
|
17564 | /***/ function(module, exports) {
|
17565 |
|
17566 | /**
|
17567 | * Copyright 2013-2015, Facebook, Inc.
|
17568 | * All rights reserved.
|
17569 | *
|
17570 | * This source code is licensed under the BSD-style license found in the
|
17571 | * LICENSE file in the root directory of this source tree. An additional grant
|
17572 | * of patent rights can be found in the PATENTS file in the same directory.
|
17573 | *
|
17574 | * @providesModule getEventCharCode
|
17575 | * @typechecks static-only
|
17576 | */
|
17577 |
|
17578 | 'use strict';
|
17579 |
|
17580 | /**
|
17581 | * `charCode` represents the actual "character code" and is safe to use with
|
17582 | * `String.fromCharCode`. As such, only keys that correspond to printable
|
17583 | * characters produce a valid `charCode`, the only exception to this is Enter.
|
17584 | * The Tab-key is considered non-printable and does not have a `charCode`,
|
17585 | * presumably because it does not produce a tab-character in browsers.
|
17586 | *
|
17587 | * @param {object} nativeEvent Native browser event.
|
17588 | * @return {number} Normalized `charCode` property.
|
17589 | */
|
17590 | function getEventCharCode(nativeEvent) {
|
17591 | var charCode;
|
17592 | var keyCode = nativeEvent.keyCode;
|
17593 |
|
17594 | if ('charCode' in nativeEvent) {
|
17595 | charCode = nativeEvent.charCode;
|
17596 |
|
17597 | // FF does not set `charCode` for the Enter-key, check against `keyCode`.
|
17598 | if (charCode === 0 && keyCode === 13) {
|
17599 | charCode = 13;
|
17600 | }
|
17601 | } else {
|
17602 | // IE8 does not implement `charCode`, but `keyCode` has the correct value.
|
17603 | charCode = keyCode;
|
17604 | }
|
17605 |
|
17606 | // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
|
17607 | // Must not discard the (non-)printable Enter-key.
|
17608 | if (charCode >= 32 || charCode === 13) {
|
17609 | return charCode;
|
17610 | }
|
17611 |
|
17612 | return 0;
|
17613 | }
|
17614 |
|
17615 | module.exports = getEventCharCode;
|
17616 |
|
17617 | /***/ },
|
17618 | /* 136 */
|
17619 | /***/ function(module, exports, __webpack_require__) {
|
17620 |
|
17621 | /**
|
17622 | * Copyright 2013-2015, Facebook, Inc.
|
17623 | * All rights reserved.
|
17624 | *
|
17625 | * This source code is licensed under the BSD-style license found in the
|
17626 | * LICENSE file in the root directory of this source tree. An additional grant
|
17627 | * of patent rights can be found in the PATENTS file in the same directory.
|
17628 | *
|
17629 | * @providesModule getEventKey
|
17630 | * @typechecks static-only
|
17631 | */
|
17632 |
|
17633 | 'use strict';
|
17634 |
|
17635 | var getEventCharCode = __webpack_require__(135);
|
17636 |
|
17637 | /**
|
17638 | * Normalization of deprecated HTML5 `key` values
|
17639 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
17640 | */
|
17641 | var normalizeKey = {
|
17642 | 'Esc': 'Escape',
|
17643 | 'Spacebar': ' ',
|
17644 | 'Left': 'ArrowLeft',
|
17645 | 'Up': 'ArrowUp',
|
17646 | 'Right': 'ArrowRight',
|
17647 | 'Down': 'ArrowDown',
|
17648 | 'Del': 'Delete',
|
17649 | 'Win': 'OS',
|
17650 | 'Menu': 'ContextMenu',
|
17651 | 'Apps': 'ContextMenu',
|
17652 | 'Scroll': 'ScrollLock',
|
17653 | 'MozPrintableKey': 'Unidentified'
|
17654 | };
|
17655 |
|
17656 | /**
|
17657 | * Translation from legacy `keyCode` to HTML5 `key`
|
17658 | * Only special keys supported, all others depend on keyboard layout or browser
|
17659 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
17660 | */
|
17661 | var translateToKey = {
|
17662 | 8: 'Backspace',
|
17663 | 9: 'Tab',
|
17664 | 12: 'Clear',
|
17665 | 13: 'Enter',
|
17666 | 16: 'Shift',
|
17667 | 17: 'Control',
|
17668 | 18: 'Alt',
|
17669 | 19: 'Pause',
|
17670 | 20: 'CapsLock',
|
17671 | 27: 'Escape',
|
17672 | 32: ' ',
|
17673 | 33: 'PageUp',
|
17674 | 34: 'PageDown',
|
17675 | 35: 'End',
|
17676 | 36: 'Home',
|
17677 | 37: 'ArrowLeft',
|
17678 | 38: 'ArrowUp',
|
17679 | 39: 'ArrowRight',
|
17680 | 40: 'ArrowDown',
|
17681 | 45: 'Insert',
|
17682 | 46: 'Delete',
|
17683 | 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
|
17684 | 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
|
17685 | 144: 'NumLock',
|
17686 | 145: 'ScrollLock',
|
17687 | 224: 'Meta'
|
17688 | };
|
17689 |
|
17690 | /**
|
17691 | * @param {object} nativeEvent Native browser event.
|
17692 | * @return {string} Normalized `key` property.
|
17693 | */
|
17694 | function getEventKey(nativeEvent) {
|
17695 | if (nativeEvent.key) {
|
17696 | // Normalize inconsistent values reported by browsers due to
|
17697 | // implementations of a working draft specification.
|
17698 |
|
17699 | // FireFox implements `key` but returns `MozPrintableKey` for all
|
17700 | // printable characters (normalized to `Unidentified`), ignore it.
|
17701 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
17702 | if (key !== 'Unidentified') {
|
17703 | return key;
|
17704 | }
|
17705 | }
|
17706 |
|
17707 | // Browser does not implement `key`, polyfill as much of it as we can.
|
17708 | if (nativeEvent.type === 'keypress') {
|
17709 | var charCode = getEventCharCode(nativeEvent);
|
17710 |
|
17711 | // The enter-key is technically both printable and non-printable and can
|
17712 | // thus be captured by `keypress`, no other non-printable key should.
|
17713 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
|
17714 | }
|
17715 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
|
17716 | // While user keyboard layout determines the actual meaning of each
|
17717 | // `keyCode` value, almost all function keys have a universal value.
|
17718 | return translateToKey[nativeEvent.keyCode] || 'Unidentified';
|
17719 | }
|
17720 | return '';
|
17721 | }
|
17722 |
|
17723 | module.exports = getEventKey;
|
17724 |
|
17725 | /***/ },
|
17726 | /* 137 */
|
17727 | /***/ function(module, exports, __webpack_require__) {
|
17728 |
|
17729 | /**
|
17730 | * Copyright 2013-2015, Facebook, Inc.
|
17731 | * All rights reserved.
|
17732 | *
|
17733 | * This source code is licensed under the BSD-style license found in the
|
17734 | * LICENSE file in the root directory of this source tree. An additional grant
|
17735 | * of patent rights can be found in the PATENTS file in the same directory.
|
17736 | *
|
17737 | * @providesModule SyntheticDragEvent
|
17738 | * @typechecks static-only
|
17739 | */
|
17740 |
|
17741 | 'use strict';
|
17742 |
|
17743 | var SyntheticMouseEvent = __webpack_require__(85);
|
17744 |
|
17745 | /**
|
17746 | * @interface DragEvent
|
17747 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17748 | */
|
17749 | var DragEventInterface = {
|
17750 | dataTransfer: null
|
17751 | };
|
17752 |
|
17753 | /**
|
17754 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17755 | * @param {string} dispatchMarker Marker identifying the event target.
|
17756 | * @param {object} nativeEvent Native browser event.
|
17757 | * @extends {SyntheticUIEvent}
|
17758 | */
|
17759 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17760 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17761 | }
|
17762 |
|
17763 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
|
17764 |
|
17765 | module.exports = SyntheticDragEvent;
|
17766 |
|
17767 | /***/ },
|
17768 | /* 138 */
|
17769 | /***/ function(module, exports, __webpack_require__) {
|
17770 |
|
17771 | /**
|
17772 | * Copyright 2013-2015, Facebook, Inc.
|
17773 | * All rights reserved.
|
17774 | *
|
17775 | * This source code is licensed under the BSD-style license found in the
|
17776 | * LICENSE file in the root directory of this source tree. An additional grant
|
17777 | * of patent rights can be found in the PATENTS file in the same directory.
|
17778 | *
|
17779 | * @providesModule SyntheticTouchEvent
|
17780 | * @typechecks static-only
|
17781 | */
|
17782 |
|
17783 | 'use strict';
|
17784 |
|
17785 | var SyntheticUIEvent = __webpack_require__(86);
|
17786 |
|
17787 | var getEventModifierState = __webpack_require__(87);
|
17788 |
|
17789 | /**
|
17790 | * @interface TouchEvent
|
17791 | * @see http://www.w3.org/TR/touch-events/
|
17792 | */
|
17793 | var TouchEventInterface = {
|
17794 | touches: null,
|
17795 | targetTouches: null,
|
17796 | changedTouches: null,
|
17797 | altKey: null,
|
17798 | metaKey: null,
|
17799 | ctrlKey: null,
|
17800 | shiftKey: null,
|
17801 | getModifierState: getEventModifierState
|
17802 | };
|
17803 |
|
17804 | /**
|
17805 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17806 | * @param {string} dispatchMarker Marker identifying the event target.
|
17807 | * @param {object} nativeEvent Native browser event.
|
17808 | * @extends {SyntheticUIEvent}
|
17809 | */
|
17810 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17811 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17812 | }
|
17813 |
|
17814 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
|
17815 |
|
17816 | module.exports = SyntheticTouchEvent;
|
17817 |
|
17818 | /***/ },
|
17819 | /* 139 */
|
17820 | /***/ function(module, exports, __webpack_require__) {
|
17821 |
|
17822 | /**
|
17823 | * Copyright 2013-2015, Facebook, Inc.
|
17824 | * All rights reserved.
|
17825 | *
|
17826 | * This source code is licensed under the BSD-style license found in the
|
17827 | * LICENSE file in the root directory of this source tree. An additional grant
|
17828 | * of patent rights can be found in the PATENTS file in the same directory.
|
17829 | *
|
17830 | * @providesModule SyntheticWheelEvent
|
17831 | * @typechecks static-only
|
17832 | */
|
17833 |
|
17834 | 'use strict';
|
17835 |
|
17836 | var SyntheticMouseEvent = __webpack_require__(85);
|
17837 |
|
17838 | /**
|
17839 | * @interface WheelEvent
|
17840 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17841 | */
|
17842 | var WheelEventInterface = {
|
17843 | deltaX: function (event) {
|
17844 | return 'deltaX' in event ? event.deltaX :
|
17845 | // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
|
17846 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
|
17847 | },
|
17848 | deltaY: function (event) {
|
17849 | return 'deltaY' in event ? event.deltaY :
|
17850 | // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
|
17851 | 'wheelDeltaY' in event ? -event.wheelDeltaY :
|
17852 | // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
|
17853 | 'wheelDelta' in event ? -event.wheelDelta : 0;
|
17854 | },
|
17855 | deltaZ: null,
|
17856 |
|
17857 | // Browsers without "deltaMode" is reporting in raw wheel delta where one
|
17858 | // notch on the scroll is always +/- 120, roughly equivalent to pixels.
|
17859 | // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
|
17860 | // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
|
17861 | deltaMode: null
|
17862 | };
|
17863 |
|
17864 | /**
|
17865 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17866 | * @param {string} dispatchMarker Marker identifying the event target.
|
17867 | * @param {object} nativeEvent Native browser event.
|
17868 | * @extends {SyntheticMouseEvent}
|
17869 | */
|
17870 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17871 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17872 | }
|
17873 |
|
17874 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
|
17875 |
|
17876 | module.exports = SyntheticWheelEvent;
|
17877 |
|
17878 | /***/ },
|
17879 | /* 140 */
|
17880 | /***/ function(module, exports, __webpack_require__) {
|
17881 |
|
17882 | /**
|
17883 | * Copyright 2013-2015, Facebook, Inc.
|
17884 | * All rights reserved.
|
17885 | *
|
17886 | * This source code is licensed under the BSD-style license found in the
|
17887 | * LICENSE file in the root directory of this source tree. An additional grant
|
17888 | * of patent rights can be found in the PATENTS file in the same directory.
|
17889 | *
|
17890 | * @providesModule SVGDOMPropertyConfig
|
17891 | */
|
17892 |
|
17893 | 'use strict';
|
17894 |
|
17895 | var DOMProperty = __webpack_require__(22);
|
17896 |
|
17897 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
17898 |
|
17899 | var NS = {
|
17900 | xlink: 'http://www.w3.org/1999/xlink',
|
17901 | xml: 'http://www.w3.org/XML/1998/namespace'
|
17902 | };
|
17903 |
|
17904 | var SVGDOMPropertyConfig = {
|
17905 | Properties: {
|
17906 | clipPath: MUST_USE_ATTRIBUTE,
|
17907 | cx: MUST_USE_ATTRIBUTE,
|
17908 | cy: MUST_USE_ATTRIBUTE,
|
17909 | d: MUST_USE_ATTRIBUTE,
|
17910 | dx: MUST_USE_ATTRIBUTE,
|
17911 | dy: MUST_USE_ATTRIBUTE,
|
17912 | fill: MUST_USE_ATTRIBUTE,
|
17913 | fillOpacity: MUST_USE_ATTRIBUTE,
|
17914 | fontFamily: MUST_USE_ATTRIBUTE,
|
17915 | fontSize: MUST_USE_ATTRIBUTE,
|
17916 | fx: MUST_USE_ATTRIBUTE,
|
17917 | fy: MUST_USE_ATTRIBUTE,
|
17918 | gradientTransform: MUST_USE_ATTRIBUTE,
|
17919 | gradientUnits: MUST_USE_ATTRIBUTE,
|
17920 | markerEnd: MUST_USE_ATTRIBUTE,
|
17921 | markerMid: MUST_USE_ATTRIBUTE,
|
17922 | markerStart: MUST_USE_ATTRIBUTE,
|
17923 | offset: MUST_USE_ATTRIBUTE,
|
17924 | opacity: MUST_USE_ATTRIBUTE,
|
17925 | patternContentUnits: MUST_USE_ATTRIBUTE,
|
17926 | patternUnits: MUST_USE_ATTRIBUTE,
|
17927 | points: MUST_USE_ATTRIBUTE,
|
17928 | preserveAspectRatio: MUST_USE_ATTRIBUTE,
|
17929 | r: MUST_USE_ATTRIBUTE,
|
17930 | rx: MUST_USE_ATTRIBUTE,
|
17931 | ry: MUST_USE_ATTRIBUTE,
|
17932 | spreadMethod: MUST_USE_ATTRIBUTE,
|
17933 | stopColor: MUST_USE_ATTRIBUTE,
|
17934 | stopOpacity: MUST_USE_ATTRIBUTE,
|
17935 | stroke: MUST_USE_ATTRIBUTE,
|
17936 | strokeDasharray: MUST_USE_ATTRIBUTE,
|
17937 | strokeLinecap: MUST_USE_ATTRIBUTE,
|
17938 | strokeOpacity: MUST_USE_ATTRIBUTE,
|
17939 | strokeWidth: MUST_USE_ATTRIBUTE,
|
17940 | textAnchor: MUST_USE_ATTRIBUTE,
|
17941 | transform: MUST_USE_ATTRIBUTE,
|
17942 | version: MUST_USE_ATTRIBUTE,
|
17943 | viewBox: MUST_USE_ATTRIBUTE,
|
17944 | x1: MUST_USE_ATTRIBUTE,
|
17945 | x2: MUST_USE_ATTRIBUTE,
|
17946 | x: MUST_USE_ATTRIBUTE,
|
17947 | xlinkActuate: MUST_USE_ATTRIBUTE,
|
17948 | xlinkArcrole: MUST_USE_ATTRIBUTE,
|
17949 | xlinkHref: MUST_USE_ATTRIBUTE,
|
17950 | xlinkRole: MUST_USE_ATTRIBUTE,
|
17951 | xlinkShow: MUST_USE_ATTRIBUTE,
|
17952 | xlinkTitle: MUST_USE_ATTRIBUTE,
|
17953 | xlinkType: MUST_USE_ATTRIBUTE,
|
17954 | xmlBase: MUST_USE_ATTRIBUTE,
|
17955 | xmlLang: MUST_USE_ATTRIBUTE,
|
17956 | xmlSpace: MUST_USE_ATTRIBUTE,
|
17957 | y1: MUST_USE_ATTRIBUTE,
|
17958 | y2: MUST_USE_ATTRIBUTE,
|
17959 | y: MUST_USE_ATTRIBUTE
|
17960 | },
|
17961 | DOMAttributeNamespaces: {
|
17962 | xlinkActuate: NS.xlink,
|
17963 | xlinkArcrole: NS.xlink,
|
17964 | xlinkHref: NS.xlink,
|
17965 | xlinkRole: NS.xlink,
|
17966 | xlinkShow: NS.xlink,
|
17967 | xlinkTitle: NS.xlink,
|
17968 | xlinkType: NS.xlink,
|
17969 | xmlBase: NS.xml,
|
17970 | xmlLang: NS.xml,
|
17971 | xmlSpace: NS.xml
|
17972 | },
|
17973 | DOMAttributeNames: {
|
17974 | clipPath: 'clip-path',
|
17975 | fillOpacity: 'fill-opacity',
|
17976 | fontFamily: 'font-family',
|
17977 | fontSize: 'font-size',
|
17978 | gradientTransform: 'gradientTransform',
|
17979 | gradientUnits: 'gradientUnits',
|
17980 | markerEnd: 'marker-end',
|
17981 | markerMid: 'marker-mid',
|
17982 | markerStart: 'marker-start',
|
17983 | patternContentUnits: 'patternContentUnits',
|
17984 | patternUnits: 'patternUnits',
|
17985 | preserveAspectRatio: 'preserveAspectRatio',
|
17986 | spreadMethod: 'spreadMethod',
|
17987 | stopColor: 'stop-color',
|
17988 | stopOpacity: 'stop-opacity',
|
17989 | strokeDasharray: 'stroke-dasharray',
|
17990 | strokeLinecap: 'stroke-linecap',
|
17991 | strokeOpacity: 'stroke-opacity',
|
17992 | strokeWidth: 'stroke-width',
|
17993 | textAnchor: 'text-anchor',
|
17994 | viewBox: 'viewBox',
|
17995 | xlinkActuate: 'xlink:actuate',
|
17996 | xlinkArcrole: 'xlink:arcrole',
|
17997 | xlinkHref: 'xlink:href',
|
17998 | xlinkRole: 'xlink:role',
|
17999 | xlinkShow: 'xlink:show',
|
18000 | xlinkTitle: 'xlink:title',
|
18001 | xlinkType: 'xlink:type',
|
18002 | xmlBase: 'xml:base',
|
18003 | xmlLang: 'xml:lang',
|
18004 | xmlSpace: 'xml:space'
|
18005 | }
|
18006 | };
|
18007 |
|
18008 | module.exports = SVGDOMPropertyConfig;
|
18009 |
|
18010 | /***/ },
|
18011 | /* 141 */
|
18012 | /***/ function(module, exports, __webpack_require__) {
|
18013 |
|
18014 | /**
|
18015 | * Copyright 2013-2015, Facebook, Inc.
|
18016 | * All rights reserved.
|
18017 | *
|
18018 | * This source code is licensed under the BSD-style license found in the
|
18019 | * LICENSE file in the root directory of this source tree. An additional grant
|
18020 | * of patent rights can be found in the PATENTS file in the same directory.
|
18021 | *
|
18022 | * @providesModule ReactDefaultPerf
|
18023 | * @typechecks static-only
|
18024 | */
|
18025 |
|
18026 | 'use strict';
|
18027 |
|
18028 | var DOMProperty = __webpack_require__(22);
|
18029 | var ReactDefaultPerfAnalysis = __webpack_require__(142);
|
18030 | var ReactMount = __webpack_require__(27);
|
18031 | var ReactPerf = __webpack_require__(17);
|
18032 |
|
18033 | var performanceNow = __webpack_require__(143);
|
18034 |
|
18035 | function roundFloat(val) {
|
18036 | return Math.floor(val * 100) / 100;
|
18037 | }
|
18038 |
|
18039 | function addValue(obj, key, val) {
|
18040 | obj[key] = (obj[key] || 0) + val;
|
18041 | }
|
18042 |
|
18043 | var ReactDefaultPerf = {
|
18044 | _allMeasurements: [], // last item in the list is the current one
|
18045 | _mountStack: [0],
|
18046 | _injected: false,
|
18047 |
|
18048 | start: function () {
|
18049 | if (!ReactDefaultPerf._injected) {
|
18050 | ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
|
18051 | }
|
18052 |
|
18053 | ReactDefaultPerf._allMeasurements.length = 0;
|
18054 | ReactPerf.enableMeasure = true;
|
18055 | },
|
18056 |
|
18057 | stop: function () {
|
18058 | ReactPerf.enableMeasure = false;
|
18059 | },
|
18060 |
|
18061 | getLastMeasurements: function () {
|
18062 | return ReactDefaultPerf._allMeasurements;
|
18063 | },
|
18064 |
|
18065 | printExclusive: function (measurements) {
|
18066 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18067 | var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
|
18068 | console.table(summary.map(function (item) {
|
18069 | return {
|
18070 | 'Component class name': item.componentName,
|
18071 | 'Total inclusive time (ms)': roundFloat(item.inclusive),
|
18072 | 'Exclusive mount time (ms)': roundFloat(item.exclusive),
|
18073 | 'Exclusive render time (ms)': roundFloat(item.render),
|
18074 | 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
|
18075 | 'Render time per instance (ms)': roundFloat(item.render / item.count),
|
18076 | 'Instances': item.count
|
18077 | };
|
18078 | }));
|
18079 | // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
|
18080 | // number.
|
18081 | },
|
18082 |
|
18083 | printInclusive: function (measurements) {
|
18084 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18085 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
|
18086 | console.table(summary.map(function (item) {
|
18087 | return {
|
18088 | 'Owner > component': item.componentName,
|
18089 | 'Inclusive time (ms)': roundFloat(item.time),
|
18090 | 'Instances': item.count
|
18091 | };
|
18092 | }));
|
18093 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18094 | },
|
18095 |
|
18096 | getMeasurementsSummaryMap: function (measurements) {
|
18097 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
|
18098 | return summary.map(function (item) {
|
18099 | return {
|
18100 | 'Owner > component': item.componentName,
|
18101 | 'Wasted time (ms)': item.time,
|
18102 | 'Instances': item.count
|
18103 | };
|
18104 | });
|
18105 | },
|
18106 |
|
18107 | printWasted: function (measurements) {
|
18108 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18109 | console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
|
18110 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18111 | },
|
18112 |
|
18113 | printDOM: function (measurements) {
|
18114 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18115 | var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
|
18116 | console.table(summary.map(function (item) {
|
18117 | var result = {};
|
18118 | result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
|
18119 | result.type = item.type;
|
18120 | result.args = JSON.stringify(item.args);
|
18121 | return result;
|
18122 | }));
|
18123 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18124 | },
|
18125 |
|
18126 | _recordWrite: function (id, fnName, totalTime, args) {
|
18127 | // TODO: totalTime isn't that useful since it doesn't count paints/reflows
|
18128 | var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
|
18129 | writes[id] = writes[id] || [];
|
18130 | writes[id].push({
|
18131 | type: fnName,
|
18132 | time: totalTime,
|
18133 | args: args
|
18134 | });
|
18135 | },
|
18136 |
|
18137 | measure: function (moduleName, fnName, func) {
|
18138 | return function () {
|
18139 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
18140 | args[_key] = arguments[_key];
|
18141 | }
|
18142 |
|
18143 | var totalTime;
|
18144 | var rv;
|
18145 | var start;
|
18146 |
|
18147 | if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
|
18148 | // A "measurement" is a set of metrics recorded for each flush. We want
|
18149 | // to group the metrics for a given flush together so we can look at the
|
18150 | // components that rendered and the DOM operations that actually
|
18151 | // happened to determine the amount of "wasted work" performed.
|
18152 | ReactDefaultPerf._allMeasurements.push({
|
18153 | exclusive: {},
|
18154 | inclusive: {},
|
18155 | render: {},
|
18156 | counts: {},
|
18157 | writes: {},
|
18158 | displayNames: {},
|
18159 | totalTime: 0,
|
18160 | created: {}
|
18161 | });
|
18162 | start = performanceNow();
|
18163 | rv = func.apply(this, args);
|
18164 | ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
|
18165 | return rv;
|
18166 | } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
|
18167 | start = performanceNow();
|
18168 | rv = func.apply(this, args);
|
18169 | totalTime = performanceNow() - start;
|
18170 |
|
18171 | if (fnName === '_mountImageIntoNode') {
|
18172 | var mountID = ReactMount.getID(args[1]);
|
18173 | ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
|
18174 | } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
|
18175 | // special format
|
18176 | args[0].forEach(function (update) {
|
18177 | var writeArgs = {};
|
18178 | if (update.fromIndex !== null) {
|
18179 | writeArgs.fromIndex = update.fromIndex;
|
18180 | }
|
18181 | if (update.toIndex !== null) {
|
18182 | writeArgs.toIndex = update.toIndex;
|
18183 | }
|
18184 | if (update.textContent !== null) {
|
18185 | writeArgs.textContent = update.textContent;
|
18186 | }
|
18187 | if (update.markupIndex !== null) {
|
18188 | writeArgs.markup = args[1][update.markupIndex];
|
18189 | }
|
18190 | ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
|
18191 | });
|
18192 | } else {
|
18193 | // basic format
|
18194 | var id = args[0];
|
18195 | if (typeof id === 'object') {
|
18196 | id = ReactMount.getID(args[0]);
|
18197 | }
|
18198 | ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
|
18199 | }
|
18200 | return rv;
|
18201 | } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
|
18202 | fnName === '_renderValidatedComponent')) {
|
18203 |
|
18204 | if (this._currentElement.type === ReactMount.TopLevelWrapper) {
|
18205 | return func.apply(this, args);
|
18206 | }
|
18207 |
|
18208 | var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
|
18209 | var isRender = fnName === '_renderValidatedComponent';
|
18210 | var isMount = fnName === 'mountComponent';
|
18211 |
|
18212 | var mountStack = ReactDefaultPerf._mountStack;
|
18213 | var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
|
18214 |
|
18215 | if (isRender) {
|
18216 | addValue(entry.counts, rootNodeID, 1);
|
18217 | } else if (isMount) {
|
18218 | entry.created[rootNodeID] = true;
|
18219 | mountStack.push(0);
|
18220 | }
|
18221 |
|
18222 | start = performanceNow();
|
18223 | rv = func.apply(this, args);
|
18224 | totalTime = performanceNow() - start;
|
18225 |
|
18226 | if (isRender) {
|
18227 | addValue(entry.render, rootNodeID, totalTime);
|
18228 | } else if (isMount) {
|
18229 | var subMountTime = mountStack.pop();
|
18230 | mountStack[mountStack.length - 1] += totalTime;
|
18231 | addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
|
18232 | addValue(entry.inclusive, rootNodeID, totalTime);
|
18233 | } else {
|
18234 | addValue(entry.inclusive, rootNodeID, totalTime);
|
18235 | }
|
18236 |
|
18237 | entry.displayNames[rootNodeID] = {
|
18238 | current: this.getName(),
|
18239 | owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
|
18240 | };
|
18241 |
|
18242 | return rv;
|
18243 | } else {
|
18244 | return func.apply(this, args);
|
18245 | }
|
18246 | };
|
18247 | }
|
18248 | };
|
18249 |
|
18250 | module.exports = ReactDefaultPerf;
|
18251 |
|
18252 | /***/ },
|
18253 | /* 142 */
|
18254 | /***/ function(module, exports, __webpack_require__) {
|
18255 |
|
18256 | /**
|
18257 | * Copyright 2013-2015, Facebook, Inc.
|
18258 | * All rights reserved.
|
18259 | *
|
18260 | * This source code is licensed under the BSD-style license found in the
|
18261 | * LICENSE file in the root directory of this source tree. An additional grant
|
18262 | * of patent rights can be found in the PATENTS file in the same directory.
|
18263 | *
|
18264 | * @providesModule ReactDefaultPerfAnalysis
|
18265 | */
|
18266 |
|
18267 | 'use strict';
|
18268 |
|
18269 | var assign = __webpack_require__(38);
|
18270 |
|
18271 | // Don't try to save users less than 1.2ms (a number I made up)
|
18272 | var DONT_CARE_THRESHOLD = 1.2;
|
18273 | var DOM_OPERATION_TYPES = {
|
18274 | '_mountImageIntoNode': 'set innerHTML',
|
18275 | INSERT_MARKUP: 'set innerHTML',
|
18276 | MOVE_EXISTING: 'move',
|
18277 | REMOVE_NODE: 'remove',
|
18278 | SET_MARKUP: 'set innerHTML',
|
18279 | TEXT_CONTENT: 'set textContent',
|
18280 | 'setValueForProperty': 'update attribute',
|
18281 | 'setValueForAttribute': 'update attribute',
|
18282 | 'deleteValueForProperty': 'remove attribute',
|
18283 | 'setValueForStyles': 'update styles',
|
18284 | 'replaceNodeWithMarkup': 'replace',
|
18285 | 'updateTextContent': 'set textContent'
|
18286 | };
|
18287 |
|
18288 | function getTotalTime(measurements) {
|
18289 | // TODO: return number of DOM ops? could be misleading.
|
18290 | // TODO: measure dropped frames after reconcile?
|
18291 | // TODO: log total time of each reconcile and the top-level component
|
18292 | // class that triggered it.
|
18293 | var totalTime = 0;
|
18294 | for (var i = 0; i < measurements.length; i++) {
|
18295 | var measurement = measurements[i];
|
18296 | totalTime += measurement.totalTime;
|
18297 | }
|
18298 | return totalTime;
|
18299 | }
|
18300 |
|
18301 | function getDOMSummary(measurements) {
|
18302 | var items = [];
|
18303 | measurements.forEach(function (measurement) {
|
18304 | Object.keys(measurement.writes).forEach(function (id) {
|
18305 | measurement.writes[id].forEach(function (write) {
|
18306 | items.push({
|
18307 | id: id,
|
18308 | type: DOM_OPERATION_TYPES[write.type] || write.type,
|
18309 | args: write.args
|
18310 | });
|
18311 | });
|
18312 | });
|
18313 | });
|
18314 | return items;
|
18315 | }
|
18316 |
|
18317 | function getExclusiveSummary(measurements) {
|
18318 | var candidates = {};
|
18319 | var displayName;
|
18320 |
|
18321 | for (var i = 0; i < measurements.length; i++) {
|
18322 | var measurement = measurements[i];
|
18323 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18324 |
|
18325 | for (var id in allIDs) {
|
18326 | displayName = measurement.displayNames[id].current;
|
18327 |
|
18328 | candidates[displayName] = candidates[displayName] || {
|
18329 | componentName: displayName,
|
18330 | inclusive: 0,
|
18331 | exclusive: 0,
|
18332 | render: 0,
|
18333 | count: 0
|
18334 | };
|
18335 | if (measurement.render[id]) {
|
18336 | candidates[displayName].render += measurement.render[id];
|
18337 | }
|
18338 | if (measurement.exclusive[id]) {
|
18339 | candidates[displayName].exclusive += measurement.exclusive[id];
|
18340 | }
|
18341 | if (measurement.inclusive[id]) {
|
18342 | candidates[displayName].inclusive += measurement.inclusive[id];
|
18343 | }
|
18344 | if (measurement.counts[id]) {
|
18345 | candidates[displayName].count += measurement.counts[id];
|
18346 | }
|
18347 | }
|
18348 | }
|
18349 |
|
18350 | // Now make a sorted array with the results.
|
18351 | var arr = [];
|
18352 | for (displayName in candidates) {
|
18353 | if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
|
18354 | arr.push(candidates[displayName]);
|
18355 | }
|
18356 | }
|
18357 |
|
18358 | arr.sort(function (a, b) {
|
18359 | return b.exclusive - a.exclusive;
|
18360 | });
|
18361 |
|
18362 | return arr;
|
18363 | }
|
18364 |
|
18365 | function getInclusiveSummary(measurements, onlyClean) {
|
18366 | var candidates = {};
|
18367 | var inclusiveKey;
|
18368 |
|
18369 | for (var i = 0; i < measurements.length; i++) {
|
18370 | var measurement = measurements[i];
|
18371 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18372 | var cleanComponents;
|
18373 |
|
18374 | if (onlyClean) {
|
18375 | cleanComponents = getUnchangedComponents(measurement);
|
18376 | }
|
18377 |
|
18378 | for (var id in allIDs) {
|
18379 | if (onlyClean && !cleanComponents[id]) {
|
18380 | continue;
|
18381 | }
|
18382 |
|
18383 | var displayName = measurement.displayNames[id];
|
18384 |
|
18385 | // Inclusive time is not useful for many components without knowing where
|
18386 | // they are instantiated. So we aggregate inclusive time with both the
|
18387 | // owner and current displayName as the key.
|
18388 | inclusiveKey = displayName.owner + ' > ' + displayName.current;
|
18389 |
|
18390 | candidates[inclusiveKey] = candidates[inclusiveKey] || {
|
18391 | componentName: inclusiveKey,
|
18392 | time: 0,
|
18393 | count: 0
|
18394 | };
|
18395 |
|
18396 | if (measurement.inclusive[id]) {
|
18397 | candidates[inclusiveKey].time += measurement.inclusive[id];
|
18398 | }
|
18399 | if (measurement.counts[id]) {
|
18400 | candidates[inclusiveKey].count += measurement.counts[id];
|
18401 | }
|
18402 | }
|
18403 | }
|
18404 |
|
18405 | // Now make a sorted array with the results.
|
18406 | var arr = [];
|
18407 | for (inclusiveKey in candidates) {
|
18408 | if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
|
18409 | arr.push(candidates[inclusiveKey]);
|
18410 | }
|
18411 | }
|
18412 |
|
18413 | arr.sort(function (a, b) {
|
18414 | return b.time - a.time;
|
18415 | });
|
18416 |
|
18417 | return arr;
|
18418 | }
|
18419 |
|
18420 | function getUnchangedComponents(measurement) {
|
18421 | // For a given reconcile, look at which components did not actually
|
18422 | // render anything to the DOM and return a mapping of their ID to
|
18423 | // the amount of time it took to render the entire subtree.
|
18424 | var cleanComponents = {};
|
18425 | var dirtyLeafIDs = Object.keys(measurement.writes);
|
18426 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18427 |
|
18428 | for (var id in allIDs) {
|
18429 | var isDirty = false;
|
18430 | // For each component that rendered, see if a component that triggered
|
18431 | // a DOM op is in its subtree.
|
18432 | for (var i = 0; i < dirtyLeafIDs.length; i++) {
|
18433 | if (dirtyLeafIDs[i].indexOf(id) === 0) {
|
18434 | isDirty = true;
|
18435 | break;
|
18436 | }
|
18437 | }
|
18438 | // check if component newly created
|
18439 | if (measurement.created[id]) {
|
18440 | isDirty = true;
|
18441 | }
|
18442 | if (!isDirty && measurement.counts[id] > 0) {
|
18443 | cleanComponents[id] = true;
|
18444 | }
|
18445 | }
|
18446 | return cleanComponents;
|
18447 | }
|
18448 |
|
18449 | var ReactDefaultPerfAnalysis = {
|
18450 | getExclusiveSummary: getExclusiveSummary,
|
18451 | getInclusiveSummary: getInclusiveSummary,
|
18452 | getDOMSummary: getDOMSummary,
|
18453 | getTotalTime: getTotalTime
|
18454 | };
|
18455 |
|
18456 | module.exports = ReactDefaultPerfAnalysis;
|
18457 |
|
18458 | /***/ },
|
18459 | /* 143 */
|
18460 | /***/ function(module, exports, __webpack_require__) {
|
18461 |
|
18462 | /**
|
18463 | * Copyright 2013-2015, Facebook, Inc.
|
18464 | * All rights reserved.
|
18465 | *
|
18466 | * This source code is licensed under the BSD-style license found in the
|
18467 | * LICENSE file in the root directory of this source tree. An additional grant
|
18468 | * of patent rights can be found in the PATENTS file in the same directory.
|
18469 | *
|
18470 | * @providesModule performanceNow
|
18471 | * @typechecks
|
18472 | */
|
18473 |
|
18474 | 'use strict';
|
18475 |
|
18476 | var performance = __webpack_require__(144);
|
18477 |
|
18478 | var performanceNow;
|
18479 |
|
18480 | /**
|
18481 | * Detect if we can use `window.performance.now()` and gracefully fallback to
|
18482 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
|
18483 | * because of Facebook's testing infrastructure.
|
18484 | */
|
18485 | if (performance.now) {
|
18486 | performanceNow = function () {
|
18487 | return performance.now();
|
18488 | };
|
18489 | } else {
|
18490 | performanceNow = function () {
|
18491 | return Date.now();
|
18492 | };
|
18493 | }
|
18494 |
|
18495 | module.exports = performanceNow;
|
18496 |
|
18497 | /***/ },
|
18498 | /* 144 */
|
18499 | /***/ function(module, exports, __webpack_require__) {
|
18500 |
|
18501 | /**
|
18502 | * Copyright 2013-2015, Facebook, Inc.
|
18503 | * All rights reserved.
|
18504 | *
|
18505 | * This source code is licensed under the BSD-style license found in the
|
18506 | * LICENSE file in the root directory of this source tree. An additional grant
|
18507 | * of patent rights can be found in the PATENTS file in the same directory.
|
18508 | *
|
18509 | * @providesModule performance
|
18510 | * @typechecks
|
18511 | */
|
18512 |
|
18513 | 'use strict';
|
18514 |
|
18515 | var ExecutionEnvironment = __webpack_require__(8);
|
18516 |
|
18517 | var performance;
|
18518 |
|
18519 | if (ExecutionEnvironment.canUseDOM) {
|
18520 | performance = window.performance || window.msPerformance || window.webkitPerformance;
|
18521 | }
|
18522 |
|
18523 | module.exports = performance || {};
|
18524 |
|
18525 | /***/ },
|
18526 | /* 145 */
|
18527 | /***/ function(module, exports) {
|
18528 |
|
18529 | /**
|
18530 | * Copyright 2013-2015, Facebook, Inc.
|
18531 | * All rights reserved.
|
18532 | *
|
18533 | * This source code is licensed under the BSD-style license found in the
|
18534 | * LICENSE file in the root directory of this source tree. An additional grant
|
18535 | * of patent rights can be found in the PATENTS file in the same directory.
|
18536 | *
|
18537 | * @providesModule ReactVersion
|
18538 | */
|
18539 |
|
18540 | 'use strict';
|
18541 |
|
18542 | module.exports = '0.14.7';
|
18543 |
|
18544 | /***/ },
|
18545 | /* 146 */
|
18546 | /***/ function(module, exports, __webpack_require__) {
|
18547 |
|
18548 | /**
|
18549 | * Copyright 2013-2015, Facebook, Inc.
|
18550 | * All rights reserved.
|
18551 | *
|
18552 | * This source code is licensed under the BSD-style license found in the
|
18553 | * LICENSE file in the root directory of this source tree. An additional grant
|
18554 | * of patent rights can be found in the PATENTS file in the same directory.
|
18555 | *
|
18556 | * @providesModule renderSubtreeIntoContainer
|
18557 | */
|
18558 |
|
18559 | 'use strict';
|
18560 |
|
18561 | var ReactMount = __webpack_require__(27);
|
18562 |
|
18563 | module.exports = ReactMount.renderSubtreeIntoContainer;
|
18564 |
|
18565 | /***/ },
|
18566 | /* 147 */
|
18567 | /***/ function(module, exports, __webpack_require__) {
|
18568 |
|
18569 | /**
|
18570 | * Copyright 2013-2015, Facebook, Inc.
|
18571 | * All rights reserved.
|
18572 | *
|
18573 | * This source code is licensed under the BSD-style license found in the
|
18574 | * LICENSE file in the root directory of this source tree. An additional grant
|
18575 | * of patent rights can be found in the PATENTS file in the same directory.
|
18576 | *
|
18577 | * @providesModule ReactDOMServer
|
18578 | */
|
18579 |
|
18580 | 'use strict';
|
18581 |
|
18582 | var ReactDefaultInjection = __webpack_require__(70);
|
18583 | var ReactServerRendering = __webpack_require__(148);
|
18584 | var ReactVersion = __webpack_require__(145);
|
18585 |
|
18586 | ReactDefaultInjection.inject();
|
18587 |
|
18588 | var ReactDOMServer = {
|
18589 | renderToString: ReactServerRendering.renderToString,
|
18590 | renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
|
18591 | version: ReactVersion
|
18592 | };
|
18593 |
|
18594 | module.exports = ReactDOMServer;
|
18595 |
|
18596 | /***/ },
|
18597 | /* 148 */
|
18598 | /***/ function(module, exports, __webpack_require__) {
|
18599 |
|
18600 | /**
|
18601 | * Copyright 2013-2015, Facebook, Inc.
|
18602 | * All rights reserved.
|
18603 | *
|
18604 | * This source code is licensed under the BSD-style license found in the
|
18605 | * LICENSE file in the root directory of this source tree. An additional grant
|
18606 | * of patent rights can be found in the PATENTS file in the same directory.
|
18607 | *
|
18608 | * @typechecks static-only
|
18609 | * @providesModule ReactServerRendering
|
18610 | */
|
18611 | 'use strict';
|
18612 |
|
18613 | var ReactDefaultBatchingStrategy = __webpack_require__(91);
|
18614 | var ReactElement = __webpack_require__(41);
|
18615 | var ReactInstanceHandles = __webpack_require__(44);
|
18616 | var ReactMarkupChecksum = __webpack_require__(47);
|
18617 | var ReactServerBatchingStrategy = __webpack_require__(149);
|
18618 | var ReactServerRenderingTransaction = __webpack_require__(150);
|
18619 | var ReactUpdates = __webpack_require__(53);
|
18620 |
|
18621 | var emptyObject = __webpack_require__(57);
|
18622 | var instantiateReactComponent = __webpack_require__(61);
|
18623 | var invariant = __webpack_require__(12);
|
18624 |
|
18625 | /**
|
18626 | * @param {ReactElement} element
|
18627 | * @return {string} the HTML markup
|
18628 | */
|
18629 | function renderToString(element) {
|
18630 | !ReactElement.isValidElement(element) ? true ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
18631 |
|
18632 | var transaction;
|
18633 | try {
|
18634 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
18635 |
|
18636 | var id = ReactInstanceHandles.createReactRootID();
|
18637 | transaction = ReactServerRenderingTransaction.getPooled(false);
|
18638 |
|
18639 | return transaction.perform(function () {
|
18640 | var componentInstance = instantiateReactComponent(element, null);
|
18641 | var markup = componentInstance.mountComponent(id, transaction, emptyObject);
|
18642 | return ReactMarkupChecksum.addChecksumToMarkup(markup);
|
18643 | }, null);
|
18644 | } finally {
|
18645 | ReactServerRenderingTransaction.release(transaction);
|
18646 | // Revert to the DOM batching strategy since these two renderers
|
18647 | // currently share these stateful modules.
|
18648 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
18649 | }
|
18650 | }
|
18651 |
|
18652 | /**
|
18653 | * @param {ReactElement} element
|
18654 | * @return {string} the HTML markup, without the extra React ID and checksum
|
18655 | * (for generating static pages)
|
18656 | */
|
18657 | function renderToStaticMarkup(element) {
|
18658 | !ReactElement.isValidElement(element) ? true ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
18659 |
|
18660 | var transaction;
|
18661 | try {
|
18662 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
18663 |
|
18664 | var id = ReactInstanceHandles.createReactRootID();
|
18665 | transaction = ReactServerRenderingTransaction.getPooled(true);
|
18666 |
|
18667 | return transaction.perform(function () {
|
18668 | var componentInstance = instantiateReactComponent(element, null);
|
18669 | return componentInstance.mountComponent(id, transaction, emptyObject);
|
18670 | }, null);
|
18671 | } finally {
|
18672 | ReactServerRenderingTransaction.release(transaction);
|
18673 | // Revert to the DOM batching strategy since these two renderers
|
18674 | // currently share these stateful modules.
|
18675 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
18676 | }
|
18677 | }
|
18678 |
|
18679 | module.exports = {
|
18680 | renderToString: renderToString,
|
18681 | renderToStaticMarkup: renderToStaticMarkup
|
18682 | };
|
18683 |
|
18684 | /***/ },
|
18685 | /* 149 */
|
18686 | /***/ function(module, exports) {
|
18687 |
|
18688 | /**
|
18689 | * Copyright 2014-2015, Facebook, Inc.
|
18690 | * All rights reserved.
|
18691 | *
|
18692 | * This source code is licensed under the BSD-style license found in the
|
18693 | * LICENSE file in the root directory of this source tree. An additional grant
|
18694 | * of patent rights can be found in the PATENTS file in the same directory.
|
18695 | *
|
18696 | * @providesModule ReactServerBatchingStrategy
|
18697 | * @typechecks
|
18698 | */
|
18699 |
|
18700 | 'use strict';
|
18701 |
|
18702 | var ReactServerBatchingStrategy = {
|
18703 | isBatchingUpdates: false,
|
18704 | batchedUpdates: function (callback) {
|
18705 | // Don't do anything here. During the server rendering we don't want to
|
18706 | // schedule any updates. We will simply ignore them.
|
18707 | }
|
18708 | };
|
18709 |
|
18710 | module.exports = ReactServerBatchingStrategy;
|
18711 |
|
18712 | /***/ },
|
18713 | /* 150 */
|
18714 | /***/ function(module, exports, __webpack_require__) {
|
18715 |
|
18716 | /**
|
18717 | * Copyright 2014-2015, Facebook, Inc.
|
18718 | * All rights reserved.
|
18719 | *
|
18720 | * This source code is licensed under the BSD-style license found in the
|
18721 | * LICENSE file in the root directory of this source tree. An additional grant
|
18722 | * of patent rights can be found in the PATENTS file in the same directory.
|
18723 | *
|
18724 | * @providesModule ReactServerRenderingTransaction
|
18725 | * @typechecks
|
18726 | */
|
18727 |
|
18728 | 'use strict';
|
18729 |
|
18730 | var PooledClass = __webpack_require__(55);
|
18731 | var CallbackQueue = __webpack_require__(54);
|
18732 | var Transaction = __webpack_require__(56);
|
18733 |
|
18734 | var assign = __webpack_require__(38);
|
18735 | var emptyFunction = __webpack_require__(14);
|
18736 |
|
18737 | /**
|
18738 | * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
|
18739 | * during the performing of the transaction.
|
18740 | */
|
18741 | var ON_DOM_READY_QUEUEING = {
|
18742 | /**
|
18743 | * Initializes the internal `onDOMReady` queue.
|
18744 | */
|
18745 | initialize: function () {
|
18746 | this.reactMountReady.reset();
|
18747 | },
|
18748 |
|
18749 | close: emptyFunction
|
18750 | };
|
18751 |
|
18752 | /**
|
18753 | * Executed within the scope of the `Transaction` instance. Consider these as
|
18754 | * being member methods, but with an implied ordering while being isolated from
|
18755 | * each other.
|
18756 | */
|
18757 | var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
|
18758 |
|
18759 | /**
|
18760 | * @class ReactServerRenderingTransaction
|
18761 | * @param {boolean} renderToStaticMarkup
|
18762 | */
|
18763 | function ReactServerRenderingTransaction(renderToStaticMarkup) {
|
18764 | this.reinitializeTransaction();
|
18765 | this.renderToStaticMarkup = renderToStaticMarkup;
|
18766 | this.reactMountReady = CallbackQueue.getPooled(null);
|
18767 | this.useCreateElement = false;
|
18768 | }
|
18769 |
|
18770 | var Mixin = {
|
18771 | /**
|
18772 | * @see Transaction
|
18773 | * @abstract
|
18774 | * @final
|
18775 | * @return {array} Empty list of operation wrap procedures.
|
18776 | */
|
18777 | getTransactionWrappers: function () {
|
18778 | return TRANSACTION_WRAPPERS;
|
18779 | },
|
18780 |
|
18781 | /**
|
18782 | * @return {object} The queue to collect `onDOMReady` callbacks with.
|
18783 | */
|
18784 | getReactMountReady: function () {
|
18785 | return this.reactMountReady;
|
18786 | },
|
18787 |
|
18788 | /**
|
18789 | * `PooledClass` looks for this, and will invoke this before allowing this
|
18790 | * instance to be reused.
|
18791 | */
|
18792 | destructor: function () {
|
18793 | CallbackQueue.release(this.reactMountReady);
|
18794 | this.reactMountReady = null;
|
18795 | }
|
18796 | };
|
18797 |
|
18798 | assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
|
18799 |
|
18800 | PooledClass.addPoolingTo(ReactServerRenderingTransaction);
|
18801 |
|
18802 | module.exports = ReactServerRenderingTransaction;
|
18803 |
|
18804 | /***/ },
|
18805 | /* 151 */
|
18806 | /***/ function(module, exports, __webpack_require__) {
|
18807 |
|
18808 | /**
|
18809 | * Copyright 2013-2015, Facebook, Inc.
|
18810 | * All rights reserved.
|
18811 | *
|
18812 | * This source code is licensed under the BSD-style license found in the
|
18813 | * LICENSE file in the root directory of this source tree. An additional grant
|
18814 | * of patent rights can be found in the PATENTS file in the same directory.
|
18815 | *
|
18816 | * @providesModule ReactIsomorphic
|
18817 | */
|
18818 |
|
18819 | 'use strict';
|
18820 |
|
18821 | var ReactChildren = __webpack_require__(109);
|
18822 | var ReactComponent = __webpack_require__(122);
|
18823 | var ReactClass = __webpack_require__(121);
|
18824 | var ReactDOMFactories = __webpack_require__(152);
|
18825 | var ReactElement = __webpack_require__(41);
|
18826 | var ReactElementValidator = __webpack_require__(153);
|
18827 | var ReactPropTypes = __webpack_require__(106);
|
18828 | var ReactVersion = __webpack_require__(145);
|
18829 |
|
18830 | var assign = __webpack_require__(38);
|
18831 | var onlyChild = __webpack_require__(155);
|
18832 |
|
18833 | var createElement = ReactElement.createElement;
|
18834 | var createFactory = ReactElement.createFactory;
|
18835 | var cloneElement = ReactElement.cloneElement;
|
18836 |
|
18837 | if (true) {
|
18838 | createElement = ReactElementValidator.createElement;
|
18839 | createFactory = ReactElementValidator.createFactory;
|
18840 | cloneElement = ReactElementValidator.cloneElement;
|
18841 | }
|
18842 |
|
18843 | var React = {
|
18844 |
|
18845 | // Modern
|
18846 |
|
18847 | Children: {
|
18848 | map: ReactChildren.map,
|
18849 | forEach: ReactChildren.forEach,
|
18850 | count: ReactChildren.count,
|
18851 | toArray: ReactChildren.toArray,
|
18852 | only: onlyChild
|
18853 | },
|
18854 |
|
18855 | Component: ReactComponent,
|
18856 |
|
18857 | createElement: createElement,
|
18858 | cloneElement: cloneElement,
|
18859 | isValidElement: ReactElement.isValidElement,
|
18860 |
|
18861 | // Classic
|
18862 |
|
18863 | PropTypes: ReactPropTypes,
|
18864 | createClass: ReactClass.createClass,
|
18865 | createFactory: createFactory,
|
18866 | createMixin: function (mixin) {
|
18867 | // Currently a noop. Will be used to validate and trace mixins.
|
18868 | return mixin;
|
18869 | },
|
18870 |
|
18871 | // This looks DOM specific but these are actually isomorphic helpers
|
18872 | // since they are just generating DOM strings.
|
18873 | DOM: ReactDOMFactories,
|
18874 |
|
18875 | version: ReactVersion,
|
18876 |
|
18877 | // Hook for JSX spread, don't use this for anything else.
|
18878 | __spread: assign
|
18879 | };
|
18880 |
|
18881 | module.exports = React;
|
18882 |
|
18883 | /***/ },
|
18884 | /* 152 */
|
18885 | /***/ function(module, exports, __webpack_require__) {
|
18886 |
|
18887 | /**
|
18888 | * Copyright 2013-2015, Facebook, Inc.
|
18889 | * All rights reserved.
|
18890 | *
|
18891 | * This source code is licensed under the BSD-style license found in the
|
18892 | * LICENSE file in the root directory of this source tree. An additional grant
|
18893 | * of patent rights can be found in the PATENTS file in the same directory.
|
18894 | *
|
18895 | * @providesModule ReactDOMFactories
|
18896 | * @typechecks static-only
|
18897 | */
|
18898 |
|
18899 | 'use strict';
|
18900 |
|
18901 | var ReactElement = __webpack_require__(41);
|
18902 | var ReactElementValidator = __webpack_require__(153);
|
18903 |
|
18904 | var mapObject = __webpack_require__(154);
|
18905 |
|
18906 | /**
|
18907 | * Create a factory that creates HTML tag elements.
|
18908 | *
|
18909 | * @param {string} tag Tag name (e.g. `div`).
|
18910 | * @private
|
18911 | */
|
18912 | function createDOMFactory(tag) {
|
18913 | if (true) {
|
18914 | return ReactElementValidator.createFactory(tag);
|
18915 | }
|
18916 | return ReactElement.createFactory(tag);
|
18917 | }
|
18918 |
|
18919 | /**
|
18920 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
18921 | * This is also accessible via `React.DOM`.
|
18922 | *
|
18923 | * @public
|
18924 | */
|
18925 | var ReactDOMFactories = mapObject({
|
18926 | a: 'a',
|
18927 | abbr: 'abbr',
|
18928 | address: 'address',
|
18929 | area: 'area',
|
18930 | article: 'article',
|
18931 | aside: 'aside',
|
18932 | audio: 'audio',
|
18933 | b: 'b',
|
18934 | base: 'base',
|
18935 | bdi: 'bdi',
|
18936 | bdo: 'bdo',
|
18937 | big: 'big',
|
18938 | blockquote: 'blockquote',
|
18939 | body: 'body',
|
18940 | br: 'br',
|
18941 | button: 'button',
|
18942 | canvas: 'canvas',
|
18943 | caption: 'caption',
|
18944 | cite: 'cite',
|
18945 | code: 'code',
|
18946 | col: 'col',
|
18947 | colgroup: 'colgroup',
|
18948 | data: 'data',
|
18949 | datalist: 'datalist',
|
18950 | dd: 'dd',
|
18951 | del: 'del',
|
18952 | details: 'details',
|
18953 | dfn: 'dfn',
|
18954 | dialog: 'dialog',
|
18955 | div: 'div',
|
18956 | dl: 'dl',
|
18957 | dt: 'dt',
|
18958 | em: 'em',
|
18959 | embed: 'embed',
|
18960 | fieldset: 'fieldset',
|
18961 | figcaption: 'figcaption',
|
18962 | figure: 'figure',
|
18963 | footer: 'footer',
|
18964 | form: 'form',
|
18965 | h1: 'h1',
|
18966 | h2: 'h2',
|
18967 | h3: 'h3',
|
18968 | h4: 'h4',
|
18969 | h5: 'h5',
|
18970 | h6: 'h6',
|
18971 | head: 'head',
|
18972 | header: 'header',
|
18973 | hgroup: 'hgroup',
|
18974 | hr: 'hr',
|
18975 | html: 'html',
|
18976 | i: 'i',
|
18977 | iframe: 'iframe',
|
18978 | img: 'img',
|
18979 | input: 'input',
|
18980 | ins: 'ins',
|
18981 | kbd: 'kbd',
|
18982 | keygen: 'keygen',
|
18983 | label: 'label',
|
18984 | legend: 'legend',
|
18985 | li: 'li',
|
18986 | link: 'link',
|
18987 | main: 'main',
|
18988 | map: 'map',
|
18989 | mark: 'mark',
|
18990 | menu: 'menu',
|
18991 | menuitem: 'menuitem',
|
18992 | meta: 'meta',
|
18993 | meter: 'meter',
|
18994 | nav: 'nav',
|
18995 | noscript: 'noscript',
|
18996 | object: 'object',
|
18997 | ol: 'ol',
|
18998 | optgroup: 'optgroup',
|
18999 | option: 'option',
|
19000 | output: 'output',
|
19001 | p: 'p',
|
19002 | param: 'param',
|
19003 | picture: 'picture',
|
19004 | pre: 'pre',
|
19005 | progress: 'progress',
|
19006 | q: 'q',
|
19007 | rp: 'rp',
|
19008 | rt: 'rt',
|
19009 | ruby: 'ruby',
|
19010 | s: 's',
|
19011 | samp: 'samp',
|
19012 | script: 'script',
|
19013 | section: 'section',
|
19014 | select: 'select',
|
19015 | small: 'small',
|
19016 | source: 'source',
|
19017 | span: 'span',
|
19018 | strong: 'strong',
|
19019 | style: 'style',
|
19020 | sub: 'sub',
|
19021 | summary: 'summary',
|
19022 | sup: 'sup',
|
19023 | table: 'table',
|
19024 | tbody: 'tbody',
|
19025 | td: 'td',
|
19026 | textarea: 'textarea',
|
19027 | tfoot: 'tfoot',
|
19028 | th: 'th',
|
19029 | thead: 'thead',
|
19030 | time: 'time',
|
19031 | title: 'title',
|
19032 | tr: 'tr',
|
19033 | track: 'track',
|
19034 | u: 'u',
|
19035 | ul: 'ul',
|
19036 | 'var': 'var',
|
19037 | video: 'video',
|
19038 | wbr: 'wbr',
|
19039 |
|
19040 | // SVG
|
19041 | circle: 'circle',
|
19042 | clipPath: 'clipPath',
|
19043 | defs: 'defs',
|
19044 | ellipse: 'ellipse',
|
19045 | g: 'g',
|
19046 | image: 'image',
|
19047 | line: 'line',
|
19048 | linearGradient: 'linearGradient',
|
19049 | mask: 'mask',
|
19050 | path: 'path',
|
19051 | pattern: 'pattern',
|
19052 | polygon: 'polygon',
|
19053 | polyline: 'polyline',
|
19054 | radialGradient: 'radialGradient',
|
19055 | rect: 'rect',
|
19056 | stop: 'stop',
|
19057 | svg: 'svg',
|
19058 | text: 'text',
|
19059 | tspan: 'tspan'
|
19060 |
|
19061 | }, createDOMFactory);
|
19062 |
|
19063 | module.exports = ReactDOMFactories;
|
19064 |
|
19065 | /***/ },
|
19066 | /* 153 */
|
19067 | /***/ function(module, exports, __webpack_require__) {
|
19068 |
|
19069 | /**
|
19070 | * Copyright 2014-2015, Facebook, Inc.
|
19071 | * All rights reserved.
|
19072 | *
|
19073 | * This source code is licensed under the BSD-style license found in the
|
19074 | * LICENSE file in the root directory of this source tree. An additional grant
|
19075 | * of patent rights can be found in the PATENTS file in the same directory.
|
19076 | *
|
19077 | * @providesModule ReactElementValidator
|
19078 | */
|
19079 |
|
19080 | /**
|
19081 | * ReactElementValidator provides a wrapper around a element factory
|
19082 | * which validates the props passed to the element. This is intended to be
|
19083 | * used only in DEV and could be replaced by a static type checker for languages
|
19084 | * that support it.
|
19085 | */
|
19086 |
|
19087 | 'use strict';
|
19088 |
|
19089 | var ReactElement = __webpack_require__(41);
|
19090 | var ReactPropTypeLocations = __webpack_require__(64);
|
19091 | var ReactPropTypeLocationNames = __webpack_require__(65);
|
19092 | var ReactCurrentOwner = __webpack_require__(4);
|
19093 |
|
19094 | var canDefineProperty = __webpack_require__(42);
|
19095 | var getIteratorFn = __webpack_require__(107);
|
19096 | var invariant = __webpack_require__(12);
|
19097 | var warning = __webpack_require__(24);
|
19098 |
|
19099 | function getDeclarationErrorAddendum() {
|
19100 | if (ReactCurrentOwner.current) {
|
19101 | var name = ReactCurrentOwner.current.getName();
|
19102 | if (name) {
|
19103 | return ' Check the render method of `' + name + '`.';
|
19104 | }
|
19105 | }
|
19106 | return '';
|
19107 | }
|
19108 |
|
19109 | /**
|
19110 | * Warn if there's no key explicitly set on dynamic arrays of children or
|
19111 | * object keys are not valid. This allows us to keep track of children between
|
19112 | * updates.
|
19113 | */
|
19114 | var ownerHasKeyUseWarning = {};
|
19115 |
|
19116 | var loggedTypeFailures = {};
|
19117 |
|
19118 | /**
|
19119 | * Warn if the element doesn't have an explicit key assigned to it.
|
19120 | * This element is in an array. The array could grow and shrink or be
|
19121 | * reordered. All children that haven't already been validated are required to
|
19122 | * have a "key" property assigned to it.
|
19123 | *
|
19124 | * @internal
|
19125 | * @param {ReactElement} element Element that requires a key.
|
19126 | * @param {*} parentType element's parent's type.
|
19127 | */
|
19128 | function validateExplicitKey(element, parentType) {
|
19129 | if (!element._store || element._store.validated || element.key != null) {
|
19130 | return;
|
19131 | }
|
19132 | element._store.validated = true;
|
19133 |
|
19134 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
|
19135 | if (addenda === null) {
|
19136 | // we already showed the warning
|
19137 | return;
|
19138 | }
|
19139 | true ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
|
19140 | }
|
19141 |
|
19142 | /**
|
19143 | * Shared warning and monitoring code for the key warnings.
|
19144 | *
|
19145 | * @internal
|
19146 | * @param {string} messageType A key used for de-duping warnings.
|
19147 | * @param {ReactElement} element Component that requires a key.
|
19148 | * @param {*} parentType element's parent's type.
|
19149 | * @returns {?object} A set of addenda to use in the warning message, or null
|
19150 | * if the warning has already been shown before (and shouldn't be shown again).
|
19151 | */
|
19152 | function getAddendaForKeyUse(messageType, element, parentType) {
|
19153 | var addendum = getDeclarationErrorAddendum();
|
19154 | if (!addendum) {
|
19155 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
19156 | if (parentName) {
|
19157 | addendum = ' Check the top-level render call using <' + parentName + '>.';
|
19158 | }
|
19159 | }
|
19160 |
|
19161 | var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
|
19162 | if (memoizer[addendum]) {
|
19163 | return null;
|
19164 | }
|
19165 | memoizer[addendum] = true;
|
19166 |
|
19167 | var addenda = {
|
19168 | parentOrOwner: addendum,
|
19169 | url: ' See https://fb.me/react-warning-keys for more information.',
|
19170 | childOwner: null
|
19171 | };
|
19172 |
|
19173 | // Usually the current owner is the offender, but if it accepts children as a
|
19174 | // property, it may be the creator of the child that's responsible for
|
19175 | // assigning it a key.
|
19176 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
19177 | // Give the component that originally created this child.
|
19178 | addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
|
19179 | }
|
19180 |
|
19181 | return addenda;
|
19182 | }
|
19183 |
|
19184 | /**
|
19185 | * Ensure that every element either is passed in a static location, in an
|
19186 | * array with an explicit keys property defined, or in an object literal
|
19187 | * with valid key property.
|
19188 | *
|
19189 | * @internal
|
19190 | * @param {ReactNode} node Statically passed child of any type.
|
19191 | * @param {*} parentType node's parent's type.
|
19192 | */
|
19193 | function validateChildKeys(node, parentType) {
|
19194 | if (typeof node !== 'object') {
|
19195 | return;
|
19196 | }
|
19197 | if (Array.isArray(node)) {
|
19198 | for (var i = 0; i < node.length; i++) {
|
19199 | var child = node[i];
|
19200 | if (ReactElement.isValidElement(child)) {
|
19201 | validateExplicitKey(child, parentType);
|
19202 | }
|
19203 | }
|
19204 | } else if (ReactElement.isValidElement(node)) {
|
19205 | // This element was passed in a valid location.
|
19206 | if (node._store) {
|
19207 | node._store.validated = true;
|
19208 | }
|
19209 | } else if (node) {
|
19210 | var iteratorFn = getIteratorFn(node);
|
19211 | // Entry iterators provide implicit keys.
|
19212 | if (iteratorFn) {
|
19213 | if (iteratorFn !== node.entries) {
|
19214 | var iterator = iteratorFn.call(node);
|
19215 | var step;
|
19216 | while (!(step = iterator.next()).done) {
|
19217 | if (ReactElement.isValidElement(step.value)) {
|
19218 | validateExplicitKey(step.value, parentType);
|
19219 | }
|
19220 | }
|
19221 | }
|
19222 | }
|
19223 | }
|
19224 | }
|
19225 |
|
19226 | /**
|
19227 | * Assert that the props are valid
|
19228 | *
|
19229 | * @param {string} componentName Name of the component for error messages.
|
19230 | * @param {object} propTypes Map of prop name to a ReactPropType
|
19231 | * @param {object} props
|
19232 | * @param {string} location e.g. "prop", "context", "child context"
|
19233 | * @private
|
19234 | */
|
19235 | function checkPropTypes(componentName, propTypes, props, location) {
|
19236 | for (var propName in propTypes) {
|
19237 | if (propTypes.hasOwnProperty(propName)) {
|
19238 | var error;
|
19239 | // Prop type validation may throw. In case they do, we don't want to
|
19240 | // fail the render phase where it didn't fail before. So we log it.
|
19241 | // After these have been cleaned up, we'll let them throw.
|
19242 | try {
|
19243 | // This is intentionally an invariant that gets caught. It's the same
|
19244 | // behavior as without this statement except with a better message.
|
19245 | !(typeof propTypes[propName] === 'function') ? true ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
19246 | error = propTypes[propName](props, propName, componentName, location);
|
19247 | } catch (ex) {
|
19248 | error = ex;
|
19249 | }
|
19250 | true ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
|
19251 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
19252 | // Only monitor this failure once because there tends to be a lot of the
|
19253 | // same error.
|
19254 | loggedTypeFailures[error.message] = true;
|
19255 |
|
19256 | var addendum = getDeclarationErrorAddendum();
|
19257 | true ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
|
19258 | }
|
19259 | }
|
19260 | }
|
19261 | }
|
19262 |
|
19263 | /**
|
19264 | * Given an element, validate that its props follow the propTypes definition,
|
19265 | * provided by the type.
|
19266 | *
|
19267 | * @param {ReactElement} element
|
19268 | */
|
19269 | function validatePropTypes(element) {
|
19270 | var componentClass = element.type;
|
19271 | if (typeof componentClass !== 'function') {
|
19272 | return;
|
19273 | }
|
19274 | var name = componentClass.displayName || componentClass.name;
|
19275 | if (componentClass.propTypes) {
|
19276 | checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
|
19277 | }
|
19278 | if (typeof componentClass.getDefaultProps === 'function') {
|
19279 | true ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
|
19280 | }
|
19281 | }
|
19282 |
|
19283 | var ReactElementValidator = {
|
19284 |
|
19285 | createElement: function (type, props, children) {
|
19286 | var validType = typeof type === 'string' || typeof type === 'function';
|
19287 | // We warn in this case but don't throw. We expect the element creation to
|
19288 | // succeed and there will likely be errors in render.
|
19289 | true ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
|
19290 |
|
19291 | var element = ReactElement.createElement.apply(this, arguments);
|
19292 |
|
19293 | // The result can be nullish if a mock or a custom function is used.
|
19294 | // TODO: Drop this when these are no longer allowed as the type argument.
|
19295 | if (element == null) {
|
19296 | return element;
|
19297 | }
|
19298 |
|
19299 | // Skip key warning if the type isn't valid since our key validation logic
|
19300 | // doesn't expect a non-string/function type and can throw confusing errors.
|
19301 | // We don't want exception behavior to differ between dev and prod.
|
19302 | // (Rendering will throw with a helpful message and as soon as the type is
|
19303 | // fixed, the key warnings will appear.)
|
19304 | if (validType) {
|
19305 | for (var i = 2; i < arguments.length; i++) {
|
19306 | validateChildKeys(arguments[i], type);
|
19307 | }
|
19308 | }
|
19309 |
|
19310 | validatePropTypes(element);
|
19311 |
|
19312 | return element;
|
19313 | },
|
19314 |
|
19315 | createFactory: function (type) {
|
19316 | var validatedFactory = ReactElementValidator.createElement.bind(null, type);
|
19317 | // Legacy hook TODO: Warn if this is accessed
|
19318 | validatedFactory.type = type;
|
19319 |
|
19320 | if (true) {
|
19321 | if (canDefineProperty) {
|
19322 | Object.defineProperty(validatedFactory, 'type', {
|
19323 | enumerable: false,
|
19324 | get: function () {
|
19325 | true ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
|
19326 | Object.defineProperty(this, 'type', {
|
19327 | value: type
|
19328 | });
|
19329 | return type;
|
19330 | }
|
19331 | });
|
19332 | }
|
19333 | }
|
19334 |
|
19335 | return validatedFactory;
|
19336 | },
|
19337 |
|
19338 | cloneElement: function (element, props, children) {
|
19339 | var newElement = ReactElement.cloneElement.apply(this, arguments);
|
19340 | for (var i = 2; i < arguments.length; i++) {
|
19341 | validateChildKeys(arguments[i], newElement.type);
|
19342 | }
|
19343 | validatePropTypes(newElement);
|
19344 | return newElement;
|
19345 | }
|
19346 |
|
19347 | };
|
19348 |
|
19349 | module.exports = ReactElementValidator;
|
19350 |
|
19351 | /***/ },
|
19352 | /* 154 */
|
19353 | /***/ function(module, exports) {
|
19354 |
|
19355 | /**
|
19356 | * Copyright 2013-2015, Facebook, Inc.
|
19357 | * All rights reserved.
|
19358 | *
|
19359 | * This source code is licensed under the BSD-style license found in the
|
19360 | * LICENSE file in the root directory of this source tree. An additional grant
|
19361 | * of patent rights can be found in the PATENTS file in the same directory.
|
19362 | *
|
19363 | * @providesModule mapObject
|
19364 | */
|
19365 |
|
19366 | 'use strict';
|
19367 |
|
19368 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
19369 |
|
19370 | /**
|
19371 | * Executes the provided `callback` once for each enumerable own property in the
|
19372 | * object and constructs a new object from the results. The `callback` is
|
19373 | * invoked with three arguments:
|
19374 | *
|
19375 | * - the property value
|
19376 | * - the property name
|
19377 | * - the object being traversed
|
19378 | *
|
19379 | * Properties that are added after the call to `mapObject` will not be visited
|
19380 | * by `callback`. If the values of existing properties are changed, the value
|
19381 | * passed to `callback` will be the value at the time `mapObject` visits them.
|
19382 | * Properties that are deleted before being visited are not visited.
|
19383 | *
|
19384 | * @grep function objectMap()
|
19385 | * @grep function objMap()
|
19386 | *
|
19387 | * @param {?object} object
|
19388 | * @param {function} callback
|
19389 | * @param {*} context
|
19390 | * @return {?object}
|
19391 | */
|
19392 | function mapObject(object, callback, context) {
|
19393 | if (!object) {
|
19394 | return null;
|
19395 | }
|
19396 | var result = {};
|
19397 | for (var name in object) {
|
19398 | if (hasOwnProperty.call(object, name)) {
|
19399 | result[name] = callback.call(context, object[name], name, object);
|
19400 | }
|
19401 | }
|
19402 | return result;
|
19403 | }
|
19404 |
|
19405 | module.exports = mapObject;
|
19406 |
|
19407 | /***/ },
|
19408 | /* 155 */
|
19409 | /***/ function(module, exports, __webpack_require__) {
|
19410 |
|
19411 | /**
|
19412 | * Copyright 2013-2015, Facebook, Inc.
|
19413 | * All rights reserved.
|
19414 | *
|
19415 | * This source code is licensed under the BSD-style license found in the
|
19416 | * LICENSE file in the root directory of this source tree. An additional grant
|
19417 | * of patent rights can be found in the PATENTS file in the same directory.
|
19418 | *
|
19419 | * @providesModule onlyChild
|
19420 | */
|
19421 | 'use strict';
|
19422 |
|
19423 | var ReactElement = __webpack_require__(41);
|
19424 |
|
19425 | var invariant = __webpack_require__(12);
|
19426 |
|
19427 | /**
|
19428 | * Returns the first child in a collection of children and verifies that there
|
19429 | * is only one child in the collection. The current implementation of this
|
19430 | * function assumes that a single child gets passed without a wrapper, but the
|
19431 | * purpose of this helper function is to abstract away the particular structure
|
19432 | * of children.
|
19433 | *
|
19434 | * @param {?object} children Child collection structure.
|
19435 | * @return {ReactComponent} The first and only `ReactComponent` contained in the
|
19436 | * structure.
|
19437 | */
|
19438 | function onlyChild(children) {
|
19439 | !ReactElement.isValidElement(children) ? true ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
|
19440 | return children;
|
19441 | }
|
19442 |
|
19443 | module.exports = onlyChild;
|
19444 |
|
19445 | /***/ },
|
19446 | /* 156 */
|
19447 | /***/ function(module, exports, __webpack_require__) {
|
19448 |
|
19449 | /**
|
19450 | * Copyright 2013-2015, Facebook, Inc.
|
19451 | * All rights reserved.
|
19452 | *
|
19453 | * This source code is licensed under the BSD-style license found in the
|
19454 | * LICENSE file in the root directory of this source tree. An additional grant
|
19455 | * of patent rights can be found in the PATENTS file in the same directory.
|
19456 | *
|
19457 | * @providesModule deprecated
|
19458 | */
|
19459 |
|
19460 | 'use strict';
|
19461 |
|
19462 | var assign = __webpack_require__(38);
|
19463 | var warning = __webpack_require__(24);
|
19464 |
|
19465 | /**
|
19466 | * This will log a single deprecation notice per function and forward the call
|
19467 | * on to the new API.
|
19468 | *
|
19469 | * @param {string} fnName The name of the function
|
19470 | * @param {string} newModule The module that fn will exist in
|
19471 | * @param {string} newPackage The module that fn will exist in
|
19472 | * @param {*} ctx The context this forwarded call should run in
|
19473 | * @param {function} fn The function to forward on to
|
19474 | * @return {function} The function that will warn once and then call fn
|
19475 | */
|
19476 | function deprecated(fnName, newModule, newPackage, ctx, fn) {
|
19477 | var warned = false;
|
19478 | if (true) {
|
19479 | var newFn = function () {
|
19480 | true ? warning(warned,
|
19481 | // Require examples in this string must be split to prevent React's
|
19482 | // build tools from mistaking them for real requires.
|
19483 | // Otherwise the build tools will attempt to build a '%s' module.
|
19484 | 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
|
19485 | warned = true;
|
19486 | return fn.apply(ctx, arguments);
|
19487 | };
|
19488 | // We need to make sure all properties of the original fn are copied over.
|
19489 | // In particular, this is needed to support PropTypes
|
19490 | return assign(newFn, fn);
|
19491 | }
|
19492 |
|
19493 | return fn;
|
19494 | }
|
19495 |
|
19496 | module.exports = deprecated;
|
19497 |
|
19498 | /***/ },
|
19499 | /* 157 */
|
19500 | /***/ function(module, exports, __webpack_require__) {
|
19501 |
|
19502 | 'use strict';
|
19503 |
|
19504 | module.exports = __webpack_require__(3);
|
19505 |
|
19506 |
|
19507 | /***/ },
|
19508 | /* 158 */
|
19509 | /***/ function(module, exports, __webpack_require__) {
|
19510 |
|
19511 | 'use strict';
|
19512 |
|
19513 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
19514 |
|
19515 | Object.defineProperty(exports, "__esModule", {
|
19516 | value: true
|
19517 | });
|
19518 |
|
19519 | var _react = __webpack_require__(1);
|
19520 |
|
19521 | var _react2 = _interopRequireDefault(_react);
|
19522 |
|
19523 | var _src = __webpack_require__(163);
|
19524 |
|
19525 | var _src2 = _interopRequireDefault(_src);
|
19526 |
|
19527 | var _Page = __webpack_require__(159);
|
19528 |
|
19529 | var _Page2 = _interopRequireDefault(_Page);
|
19530 |
|
19531 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19532 |
|
19533 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19534 |
|
19535 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
19536 |
|
19537 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
19538 |
|
19539 | var html = '\n <div>Awesome Electron <img src="../demo/awesome.svg"></div><div><img src="../demo/electron.svg"></div><div>Useful resources for creating apps with Electron</div><div>Inspired by the awesome list thing. You might also like awesome-nodejs.</div><div>Example apps</div><div>Some good apps written with Electron.</div><div>Open Source</div><div>Atom - Code editor.</div><div>Nuclide - Unified IDE.</div><div>Playback - Video player.</div>\n';
|
19540 | var isCtrlSend = true;
|
19541 |
|
19542 | var Page = (function (_Component) {
|
19543 | _inherits(Page, _Component);
|
19544 |
|
19545 | function Page() {
|
19546 | _classCallCheck(this, Page);
|
19547 |
|
19548 | return _possibleConstructorReturn(this, Object.getPrototypeOf(Page).apply(this, arguments));
|
19549 | }
|
19550 |
|
19551 | _createClass(Page, [{
|
19552 | key: 'submitForm',
|
19553 | value: function submitForm() {
|
19554 | // todo
|
19555 | console.log('submitForm');
|
19556 | }
|
19557 | }, {
|
19558 | key: 'onFocus',
|
19559 | value: function onFocus() {
|
19560 | this.refs.editor.restoreRange();
|
19561 | }
|
19562 | }, {
|
19563 | key: 'onBlur',
|
19564 | value: function onBlur() {
|
19565 | var editor = this.refs.editor;
|
19566 |
|
19567 | editor.lint();
|
19568 | editor.saveRange();
|
19569 |
|
19570 | // 解决win上其他域选中干扰
|
19571 | editor.clearRange();
|
19572 | }
|
19573 | }, {
|
19574 | key: 'onKeyDown',
|
19575 | value: function onKeyDown(e) {
|
19576 | // note: hasCtrl && !isCtrlSend insert换行
|
19577 | // 造成editor滚动失效
|
19578 | if (e.keyCode === 13) {
|
19579 | var hasCtrl = e.ctrlKey || e.metaKey;
|
19580 | if (hasCtrl ^ isCtrlSend) {
|
19581 | // 不一致
|
19582 | if (hasCtrl) {
|
19583 | e.preventDefault(); // 滚动失效
|
19584 | this.refs.editor.insertText('\n');
|
19585 | } // else不处理 采用默认行为
|
19586 | } else {
|
19587 | // 一致
|
19588 | e.preventDefault();
|
19589 | this.submitForm();
|
19590 | }
|
19591 | return;
|
19592 | }
|
19593 | }
|
19594 | }, {
|
19595 | key: 'render',
|
19596 | value: function render() {
|
19597 | var _this2 = this;
|
19598 |
|
19599 | return _react2.default.createElement(
|
19600 | 'div',
|
19601 | { onFocus: function onFocus(e) {
|
19602 | return _this2.onFocus(e);
|
19603 | },
|
19604 | onBlur: function onBlur(e) {
|
19605 | return _this2.onBlur(e);
|
19606 | },
|
19607 | onKeyDown: function onKeyDown(e) {
|
19608 | return _this2.onKeyDown(e);
|
19609 | } },
|
19610 | _react2.default.createElement(_src2.default, { ref: 'editor', className: _Page2.default.editor,
|
19611 | dangerouslySetInnerHTML: { __html: html } })
|
19612 | );
|
19613 | }
|
19614 | }]);
|
19615 |
|
19616 | return Page;
|
19617 | })(_react.Component);
|
19618 |
|
19619 | exports.default = Page;
|
19620 |
|
19621 | /***/ },
|
19622 | /* 159 */
|
19623 | /***/ function(module, exports, __webpack_require__) {
|
19624 |
|
19625 | // style-loader: Adds some css to the DOM by adding a <style> tag
|
19626 |
|
19627 | // load the styles
|
19628 | var content = __webpack_require__(160);
|
19629 | if(typeof content === 'string') content = [[module.id, content, '']];
|
19630 | // add the styles to the DOM
|
19631 | var update = __webpack_require__(162)(content, {});
|
19632 | if(content.locals) module.exports = content.locals;
|
19633 | // Hot Module Replacement
|
19634 | if(false) {
|
19635 | // When the styles change, update the <style> tags
|
19636 | if(!content.locals) {
|
19637 | module.hot.accept("!!./../node_modules/css-loader/index.js?modules!./Page.css", function() {
|
19638 | var newContent = require("!!./../node_modules/css-loader/index.js?modules!./Page.css");
|
19639 | if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
|
19640 | update(newContent);
|
19641 | });
|
19642 | }
|
19643 | // When the module is disposed, remove the <style> tags
|
19644 | module.hot.dispose(function() { update(); });
|
19645 | }
|
19646 |
|
19647 | /***/ },
|
19648 | /* 160 */
|
19649 | /***/ function(module, exports, __webpack_require__) {
|
19650 |
|
19651 | exports = module.exports = __webpack_require__(161)();
|
19652 | // imports
|
19653 |
|
19654 |
|
19655 | // module
|
19656 | exports.push([module.id, "\n._2X35-BSe5_rJw_6odCQ8Tb {\n width: 400px;\n min-height: 200px;\n white-space: pre-wrap;\n border: solid 2px rgba(0,0,0,.5);\n}\n\n._2X35-BSe5_rJw_6odCQ8Tb img {\n max-width: 10em;\n vertical-align: bottom;\n}\n", ""]);
|
19657 |
|
19658 | // exports
|
19659 | exports.locals = {
|
19660 | "editor": "_2X35-BSe5_rJw_6odCQ8Tb"
|
19661 | };
|
19662 |
|
19663 | /***/ },
|
19664 | /* 161 */
|
19665 | /***/ function(module, exports) {
|
19666 |
|
19667 | /*
|
19668 | MIT License http://www.opensource.org/licenses/mit-license.php
|
19669 | Author Tobias Koppers @sokra
|
19670 | */
|
19671 | // css base code, injected by the css-loader
|
19672 | module.exports = function() {
|
19673 | var list = [];
|
19674 |
|
19675 | // return the list of modules as css string
|
19676 | list.toString = function toString() {
|
19677 | var result = [];
|
19678 | for(var i = 0; i < this.length; i++) {
|
19679 | var item = this[i];
|
19680 | if(item[2]) {
|
19681 | result.push("@media " + item[2] + "{" + item[1] + "}");
|
19682 | } else {
|
19683 | result.push(item[1]);
|
19684 | }
|
19685 | }
|
19686 | return result.join("");
|
19687 | };
|
19688 |
|
19689 | // import a list of modules into the list
|
19690 | list.i = function(modules, mediaQuery) {
|
19691 | if(typeof modules === "string")
|
19692 | modules = [[null, modules, ""]];
|
19693 | var alreadyImportedModules = {};
|
19694 | for(var i = 0; i < this.length; i++) {
|
19695 | var id = this[i][0];
|
19696 | if(typeof id === "number")
|
19697 | alreadyImportedModules[id] = true;
|
19698 | }
|
19699 | for(i = 0; i < modules.length; i++) {
|
19700 | var item = modules[i];
|
19701 | // skip already imported module
|
19702 | // this implementation is not 100% perfect for weird media query combinations
|
19703 | // when a module is imported multiple times with different media queries.
|
19704 | // I hope this will never occur (Hey this way we have smaller bundles)
|
19705 | if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
19706 | if(mediaQuery && !item[2]) {
|
19707 | item[2] = mediaQuery;
|
19708 | } else if(mediaQuery) {
|
19709 | item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
19710 | }
|
19711 | list.push(item);
|
19712 | }
|
19713 | }
|
19714 | };
|
19715 | return list;
|
19716 | };
|
19717 |
|
19718 |
|
19719 | /***/ },
|
19720 | /* 162 */
|
19721 | /***/ function(module, exports, __webpack_require__) {
|
19722 |
|
19723 | /*
|
19724 | MIT License http://www.opensource.org/licenses/mit-license.php
|
19725 | Author Tobias Koppers @sokra
|
19726 | */
|
19727 | var stylesInDom = {},
|
19728 | memoize = function(fn) {
|
19729 | var memo;
|
19730 | return function () {
|
19731 | if (typeof memo === "undefined") memo = fn.apply(this, arguments);
|
19732 | return memo;
|
19733 | };
|
19734 | },
|
19735 | isOldIE = memoize(function() {
|
19736 | return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
|
19737 | }),
|
19738 | getHeadElement = memoize(function () {
|
19739 | return document.head || document.getElementsByTagName("head")[0];
|
19740 | }),
|
19741 | singletonElement = null,
|
19742 | singletonCounter = 0,
|
19743 | styleElementsInsertedAtTop = [];
|
19744 |
|
19745 | module.exports = function(list, options) {
|
19746 | if(false) {
|
19747 | if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
19748 | }
|
19749 |
|
19750 | options = options || {};
|
19751 | // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
19752 | // tags it will allow on a page
|
19753 | if (typeof options.singleton === "undefined") options.singleton = isOldIE();
|
19754 |
|
19755 | // By default, add <style> tags to the bottom of <head>.
|
19756 | if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
|
19757 |
|
19758 | var styles = listToStyles(list);
|
19759 | addStylesToDom(styles, options);
|
19760 |
|
19761 | return function update(newList) {
|
19762 | var mayRemove = [];
|
19763 | for(var i = 0; i < styles.length; i++) {
|
19764 | var item = styles[i];
|
19765 | var domStyle = stylesInDom[item.id];
|
19766 | domStyle.refs--;
|
19767 | mayRemove.push(domStyle);
|
19768 | }
|
19769 | if(newList) {
|
19770 | var newStyles = listToStyles(newList);
|
19771 | addStylesToDom(newStyles, options);
|
19772 | }
|
19773 | for(var i = 0; i < mayRemove.length; i++) {
|
19774 | var domStyle = mayRemove[i];
|
19775 | if(domStyle.refs === 0) {
|
19776 | for(var j = 0; j < domStyle.parts.length; j++)
|
19777 | domStyle.parts[j]();
|
19778 | delete stylesInDom[domStyle.id];
|
19779 | }
|
19780 | }
|
19781 | };
|
19782 | }
|
19783 |
|
19784 | function addStylesToDom(styles, options) {
|
19785 | for(var i = 0; i < styles.length; i++) {
|
19786 | var item = styles[i];
|
19787 | var domStyle = stylesInDom[item.id];
|
19788 | if(domStyle) {
|
19789 | domStyle.refs++;
|
19790 | for(var j = 0; j < domStyle.parts.length; j++) {
|
19791 | domStyle.parts[j](item.parts[j]);
|
19792 | }
|
19793 | for(; j < item.parts.length; j++) {
|
19794 | domStyle.parts.push(addStyle(item.parts[j], options));
|
19795 | }
|
19796 | } else {
|
19797 | var parts = [];
|
19798 | for(var j = 0; j < item.parts.length; j++) {
|
19799 | parts.push(addStyle(item.parts[j], options));
|
19800 | }
|
19801 | stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
|
19802 | }
|
19803 | }
|
19804 | }
|
19805 |
|
19806 | function listToStyles(list) {
|
19807 | var styles = [];
|
19808 | var newStyles = {};
|
19809 | for(var i = 0; i < list.length; i++) {
|
19810 | var item = list[i];
|
19811 | var id = item[0];
|
19812 | var css = item[1];
|
19813 | var media = item[2];
|
19814 | var sourceMap = item[3];
|
19815 | var part = {css: css, media: media, sourceMap: sourceMap};
|
19816 | if(!newStyles[id])
|
19817 | styles.push(newStyles[id] = {id: id, parts: [part]});
|
19818 | else
|
19819 | newStyles[id].parts.push(part);
|
19820 | }
|
19821 | return styles;
|
19822 | }
|
19823 |
|
19824 | function insertStyleElement(options, styleElement) {
|
19825 | var head = getHeadElement();
|
19826 | var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
19827 | if (options.insertAt === "top") {
|
19828 | if(!lastStyleElementInsertedAtTop) {
|
19829 | head.insertBefore(styleElement, head.firstChild);
|
19830 | } else if(lastStyleElementInsertedAtTop.nextSibling) {
|
19831 | head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
|
19832 | } else {
|
19833 | head.appendChild(styleElement);
|
19834 | }
|
19835 | styleElementsInsertedAtTop.push(styleElement);
|
19836 | } else if (options.insertAt === "bottom") {
|
19837 | head.appendChild(styleElement);
|
19838 | } else {
|
19839 | throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
19840 | }
|
19841 | }
|
19842 |
|
19843 | function removeStyleElement(styleElement) {
|
19844 | styleElement.parentNode.removeChild(styleElement);
|
19845 | var idx = styleElementsInsertedAtTop.indexOf(styleElement);
|
19846 | if(idx >= 0) {
|
19847 | styleElementsInsertedAtTop.splice(idx, 1);
|
19848 | }
|
19849 | }
|
19850 |
|
19851 | function createStyleElement(options) {
|
19852 | var styleElement = document.createElement("style");
|
19853 | styleElement.type = "text/css";
|
19854 | insertStyleElement(options, styleElement);
|
19855 | return styleElement;
|
19856 | }
|
19857 |
|
19858 | function createLinkElement(options) {
|
19859 | var linkElement = document.createElement("link");
|
19860 | linkElement.rel = "stylesheet";
|
19861 | insertStyleElement(options, linkElement);
|
19862 | return linkElement;
|
19863 | }
|
19864 |
|
19865 | function addStyle(obj, options) {
|
19866 | var styleElement, update, remove;
|
19867 |
|
19868 | if (options.singleton) {
|
19869 | var styleIndex = singletonCounter++;
|
19870 | styleElement = singletonElement || (singletonElement = createStyleElement(options));
|
19871 | update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
|
19872 | remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
|
19873 | } else if(obj.sourceMap &&
|
19874 | typeof URL === "function" &&
|
19875 | typeof URL.createObjectURL === "function" &&
|
19876 | typeof URL.revokeObjectURL === "function" &&
|
19877 | typeof Blob === "function" &&
|
19878 | typeof btoa === "function") {
|
19879 | styleElement = createLinkElement(options);
|
19880 | update = updateLink.bind(null, styleElement);
|
19881 | remove = function() {
|
19882 | removeStyleElement(styleElement);
|
19883 | if(styleElement.href)
|
19884 | URL.revokeObjectURL(styleElement.href);
|
19885 | };
|
19886 | } else {
|
19887 | styleElement = createStyleElement(options);
|
19888 | update = applyToTag.bind(null, styleElement);
|
19889 | remove = function() {
|
19890 | removeStyleElement(styleElement);
|
19891 | };
|
19892 | }
|
19893 |
|
19894 | update(obj);
|
19895 |
|
19896 | return function updateStyle(newObj) {
|
19897 | if(newObj) {
|
19898 | if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
|
19899 | return;
|
19900 | update(obj = newObj);
|
19901 | } else {
|
19902 | remove();
|
19903 | }
|
19904 | };
|
19905 | }
|
19906 |
|
19907 | var replaceText = (function () {
|
19908 | var textStore = [];
|
19909 |
|
19910 | return function (index, replacement) {
|
19911 | textStore[index] = replacement;
|
19912 | return textStore.filter(Boolean).join('\n');
|
19913 | };
|
19914 | })();
|
19915 |
|
19916 | function applyToSingletonTag(styleElement, index, remove, obj) {
|
19917 | var css = remove ? "" : obj.css;
|
19918 |
|
19919 | if (styleElement.styleSheet) {
|
19920 | styleElement.styleSheet.cssText = replaceText(index, css);
|
19921 | } else {
|
19922 | var cssNode = document.createTextNode(css);
|
19923 | var childNodes = styleElement.childNodes;
|
19924 | if (childNodes[index]) styleElement.removeChild(childNodes[index]);
|
19925 | if (childNodes.length) {
|
19926 | styleElement.insertBefore(cssNode, childNodes[index]);
|
19927 | } else {
|
19928 | styleElement.appendChild(cssNode);
|
19929 | }
|
19930 | }
|
19931 | }
|
19932 |
|
19933 | function applyToTag(styleElement, obj) {
|
19934 | var css = obj.css;
|
19935 | var media = obj.media;
|
19936 | var sourceMap = obj.sourceMap;
|
19937 |
|
19938 | if(media) {
|
19939 | styleElement.setAttribute("media", media)
|
19940 | }
|
19941 |
|
19942 | if(styleElement.styleSheet) {
|
19943 | styleElement.styleSheet.cssText = css;
|
19944 | } else {
|
19945 | while(styleElement.firstChild) {
|
19946 | styleElement.removeChild(styleElement.firstChild);
|
19947 | }
|
19948 | styleElement.appendChild(document.createTextNode(css));
|
19949 | }
|
19950 | }
|
19951 |
|
19952 | function updateLink(linkElement, obj) {
|
19953 | var css = obj.css;
|
19954 | var media = obj.media;
|
19955 | var sourceMap = obj.sourceMap;
|
19956 |
|
19957 | if(sourceMap) {
|
19958 | // http://stackoverflow.com/a/26603875
|
19959 | css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
19960 | }
|
19961 |
|
19962 | var blob = new Blob([css], { type: "text/css" });
|
19963 |
|
19964 | var oldSrc = linkElement.href;
|
19965 |
|
19966 | linkElement.href = URL.createObjectURL(blob);
|
19967 |
|
19968 | if(oldSrc)
|
19969 | URL.revokeObjectURL(oldSrc);
|
19970 | }
|
19971 |
|
19972 |
|
19973 | /***/ },
|
19974 | /* 163 */
|
19975 | /***/ function(module, exports, __webpack_require__) {
|
19976 |
|
19977 | 'use strict';
|
19978 |
|
19979 | Object.defineProperty(exports, "__esModule", {
|
19980 | value: true
|
19981 | });
|
19982 | exports.default = undefined;
|
19983 |
|
19984 | var _Editor = __webpack_require__(164);
|
19985 |
|
19986 | var _Editor2 = _interopRequireDefault(_Editor);
|
19987 |
|
19988 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19989 |
|
19990 | exports.default = _Editor2.default;
|
19991 |
|
19992 | /***/ },
|
19993 | /* 164 */
|
19994 | /***/ function(module, exports, __webpack_require__) {
|
19995 |
|
19996 | 'use strict';
|
19997 |
|
19998 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
19999 |
|
20000 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
20001 |
|
20002 | Object.defineProperty(exports, "__esModule", {
|
20003 | value: true
|
20004 | });
|
20005 |
|
20006 | var _react = __webpack_require__(1);
|
20007 |
|
20008 | var _react2 = _interopRequireDefault(_react);
|
20009 |
|
20010 | var _format = __webpack_require__(165);
|
20011 |
|
20012 | var _range = __webpack_require__(167);
|
20013 |
|
20014 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20015 |
|
20016 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20017 |
|
20018 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
20019 |
|
20020 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
20021 |
|
20022 | // import pasteFile from './pasteFile'
|
20023 | // import { emojiReplace } from '../Emoji'
|
20024 | // import { escapeHTML } from '../Text'
|
20025 |
|
20026 | function escapeHTML(str) {
|
20027 | return str.replace(/&/g, '&') // `&`必须最前`
|
20028 | // .replace(/ /g, ' ')
|
20029 | .replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
|
20030 | }
|
20031 |
|
20032 | var Editor = (function (_Component) {
|
20033 | _inherits(Editor, _Component);
|
20034 |
|
20035 | function Editor() {
|
20036 | _classCallCheck(this, Editor);
|
20037 |
|
20038 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Editor).call(this));
|
20039 |
|
20040 | _this.savedRange = null;
|
20041 | return _this;
|
20042 | }
|
20043 |
|
20044 | _createClass(Editor, [{
|
20045 | key: 'focus',
|
20046 | value: function focus() {
|
20047 | this.refs.edit.blur(); // 确保focus有效
|
20048 | this.refs.edit.focus();
|
20049 | }
|
20050 | }, {
|
20051 | key: 'lint',
|
20052 | value: function lint() {
|
20053 | (0, _format.lint)(this.refs.edit);
|
20054 | }
|
20055 | }, {
|
20056 | key: 'clearRange',
|
20057 | value: function clearRange() {
|
20058 | (0, _range.clearRange)();
|
20059 | }
|
20060 | }, {
|
20061 | key: 'restoreRange',
|
20062 | value: function restoreRange() {
|
20063 | if (this.savedRange) (0, _range.setRange)(this.savedRange);
|
20064 | this.savedRange = null;
|
20065 | }
|
20066 | }, {
|
20067 | key: 'saveRange',
|
20068 | value: function saveRange() {
|
20069 | var range = (0, _range.getRange)(this.refs.edit);
|
20070 | if (range) this.savedRange = range;
|
20071 | }
|
20072 | }, {
|
20073 | key: 'insertHTML',
|
20074 | value: function insertHTML(html) {
|
20075 | this.focus();
|
20076 | // html = emojiReplace(html)
|
20077 | document.execCommand('insertHTML', 0, html);
|
20078 | }
|
20079 | }, {
|
20080 | key: 'insertText',
|
20081 | value: function insertText(text) {
|
20082 | var html = escapeHTML(text);
|
20083 | this.insertHTML(html);
|
20084 | }
|
20085 | }, {
|
20086 | key: 'insertImage',
|
20087 | value: function insertImage(src) {
|
20088 | this.insertHTML('<img src="' + src + '">');
|
20089 | }
|
20090 | }, {
|
20091 | key: 'onPaste',
|
20092 | value: function onPaste(e) {
|
20093 | var _this2 = this;
|
20094 |
|
20095 | // note: 造成editor滚动失效
|
20096 | e.preventDefault();
|
20097 | var types = e.clipboardData.types;
|
20098 | var html = e.clipboardData.getData('text/html');
|
20099 | var text = e.clipboardData.getData('text/plain');
|
20100 | // console.log('paste:html', html)
|
20101 | // console.log('paste:text', text)
|
20102 |
|
20103 | // 粘贴板内有files 如来自QQ截屏
|
20104 | // if (types && types.indexOf('Files') > -1) {
|
20105 | // pasteFile(e)
|
20106 | // return
|
20107 | // }
|
20108 |
|
20109 | // fixme: use this.insertHTML
|
20110 | setTimeout(function () {
|
20111 | // 解决execCommand递归
|
20112 | if (html) {
|
20113 | var _html = (0, _format.filter)(html);
|
20114 | // console.log('insert:html', _html)
|
20115 | _this2.insertHTML(_html);
|
20116 | // const _html = emojiReplace(filter(html))
|
20117 | // console.log('insert:html', _html)
|
20118 | // document.execCommand('insertHtml', 0, _html)
|
20119 | } else if (text) {
|
20120 | // console.log('insert:text', text)
|
20121 | _this2.insertText(text);
|
20122 | // const _html = emojiReplace(textToHTML(text))
|
20123 | // document.execCommand('insertHtml', 0, _html)
|
20124 | // document.execCommand('insertText', 0, text)
|
20125 | }
|
20126 | _this2.lint();
|
20127 | });
|
20128 | }
|
20129 |
|
20130 | // 确保选中前lint 不影响选中
|
20131 |
|
20132 | }, {
|
20133 | key: 'onMouseDown',
|
20134 | value: function onMouseDown() {
|
20135 | this.lint();
|
20136 | }
|
20137 | }, {
|
20138 | key: 'render',
|
20139 | value: function render() {
|
20140 | return _react2.default.createElement('div', _extends({ ref: 'edit', contentEditable: true,
|
20141 | onMouseDown: this.onMouseDown.bind(this),
|
20142 | onPaste: this.onPaste.bind(this)
|
20143 | }, this.props));
|
20144 | }
|
20145 | }]);
|
20146 |
|
20147 | return Editor;
|
20148 | })(_react.Component);
|
20149 |
|
20150 | exports.default = Editor;
|
20151 |
|
20152 | /***/ },
|
20153 | /* 165 */
|
20154 | /***/ function(module, exports, __webpack_require__) {
|
20155 |
|
20156 | 'use strict';
|
20157 |
|
20158 | Object.defineProperty(exports, "__esModule", {
|
20159 | value: true
|
20160 | });
|
20161 | exports.parse = parse;
|
20162 | exports.filter = filter;
|
20163 | exports.lint = lint;
|
20164 |
|
20165 | var _jquery = __webpack_require__(166);
|
20166 |
|
20167 | var _jquery2 = _interopRequireDefault(_jquery);
|
20168 |
|
20169 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20170 |
|
20171 | function parse() {
|
20172 | var items = [];
|
20173 | // todo: text br image qface emoji
|
20174 | return items;
|
20175 | }
|
20176 |
|
20177 | function filter(html) {
|
20178 | var mat = html.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/);
|
20179 | if (mat) html = mat[1];
|
20180 | mat = html.match(/<body>([\s\S]*?)<\/body>/);
|
20181 | if (mat) html = mat[1];
|
20182 | var $src = (0, _jquery2.default)('<div>').html(html);
|
20183 | var $dest = (0, _jquery2.default)('<div>');
|
20184 | filterContent($src, $dest);
|
20185 | $dest.children('[x-block]').removeAttr('x-block');
|
20186 | $dest.children(':empty').remove();
|
20187 | return $dest.html();
|
20188 | }
|
20189 |
|
20190 | /* eslint-disable */
|
20191 | // https://github.com/fritx/none/blob/dev/elec%2Fapp%2Feditor.js
|
20192 | var blockElements = 'address, article, aside, blockquote, canvas, dd, div, dl, fieldset, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, nav, noscript, ol, output, p, pre, section, table, tfoot, ul, video';
|
20193 | blockElements += ', li'; // display:iist-item => block
|
20194 | blockElements += ', tr';
|
20195 |
|
20196 | // 过滤清理 内容
|
20197 | function filterContent($src, $dest) {
|
20198 | // _.each($src[0].childNodes, function(node, i){
|
20199 | [].forEach.call($src[0].childNodes, function (node, i) {
|
20200 | if (node.nodeType === Node.TEXT_NODE) {
|
20201 | getLine().append(node.cloneNode());
|
20202 | return;
|
20203 | }
|
20204 |
|
20205 | if (node.nodeType !== Node.ELEMENT_NODE) {
|
20206 | return;
|
20207 | }
|
20208 |
|
20209 | var $node = (0, _jquery2.default)(node);
|
20210 |
|
20211 | // 过滤消息中的用户头像
|
20212 | if ($node.is('[headimg], .avatar, .nocopy')) return;
|
20213 |
|
20214 | if ($node.is('img')) {
|
20215 |
|
20216 | // 如果可能是emoji 则优先使用alt
|
20217 | // case: 右侧 http://changba.com/s/MWN6SYnX0zJwnnKNijYL-w?&code=Kxhsv6044ik
|
20218 | // if ($node.is('[class*=emoji], [src*=emoji]') && $node.attr('alt')) {
|
20219 | // getLine().append($node.attr('alt'))
|
20220 | // return
|
20221 | // }
|
20222 |
|
20223 | getLine().append('<img src="' + $node.attr('src') + '">');
|
20224 | return;
|
20225 | }
|
20226 |
|
20227 | if ($node.is('br')) {
|
20228 | // getLine().append('<br>')
|
20229 | getLine(true); // br直接转div
|
20230 | return;
|
20231 | }
|
20232 |
|
20233 | // var html = $node.html().trim()
|
20234 | var html = $node.html();
|
20235 | if (!html) return;
|
20236 |
|
20237 | var isBlock = $node.is(blockElements);
|
20238 | if (isBlock) getLine(true);
|
20239 |
|
20240 | if ($node.children().length > 0) {
|
20241 | filterContent($node, $dest);
|
20242 | if (isBlock) getLine(true);
|
20243 | return;
|
20244 | }
|
20245 |
|
20246 | var text = $node.text();
|
20247 | if (!text) return;
|
20248 | getLine().append(document.createTextNode(text));
|
20249 | if (isBlock) getLine(true);
|
20250 | });
|
20251 |
|
20252 | function getLine(newBlock) {
|
20253 | var $prev = $dest.children('div').last();
|
20254 | var $line = $prev;
|
20255 | if ($prev.length > 0 && !$prev.html()) {
|
20256 | $prev.remove(); // 清除空div
|
20257 | }
|
20258 | if ($prev.length <= 0 || $prev.is('[x-block]')) {
|
20259 | $prev.removeAttr('x-block');
|
20260 | $line = (0, _jquery2.default)('<div>').appendTo($dest);
|
20261 | }
|
20262 | if (newBlock) {
|
20263 | $line.attr('x-block', ''); // block标记
|
20264 | }
|
20265 | return $line;
|
20266 | }
|
20267 | }
|
20268 |
|
20269 | function lint(dom) {
|
20270 |
|
20271 | // return // 暂时取消
|
20272 | // console.log('dom', dom.innerHTML)
|
20273 | // // 消除嵌套多层的div
|
20274 | // var $el = $(dom)
|
20275 | // // amazing无敌选择器 选出嵌套的目标
|
20276 | // var $main = $el.find('div:has(>div:not(:has(div))), .editor').first()
|
20277 | // $el.html($main.html())
|
20278 | // console.log('main', $main.html())
|
20279 |
|
20280 | var $el = (0, _jquery2.default)(dom);
|
20281 | $el.children('[x-block]').removeAttr('x-block');
|
20282 |
|
20283 | // 如果只有一个空行 则视为空
|
20284 | var $el = (0, _jquery2.default)(dom);
|
20285 | var nodes = dom.childNodes;
|
20286 | if (nodes.length === 1) {
|
20287 | var $first = (0, _jquery2.default)(nodes[0]);
|
20288 | if ($first.is('br')) {
|
20289 | $el.html('');
|
20290 | } else {
|
20291 | nodes = $first[0].childNodes;
|
20292 | if (nodes.length === 1) {
|
20293 | var $first = (0, _jquery2.default)(nodes[0]);
|
20294 | if ($first.is('br')) {
|
20295 | $el.html('');
|
20296 | }
|
20297 | }
|
20298 | }
|
20299 | }
|
20300 |
|
20301 | // 若超过一行 第一行需要div包裹 与其他行保持一致
|
20302 | var $prev = (0, _jquery2.default)([]);
|
20303 | var hasNext = false;
|
20304 | var nodes = dom.childNodes;
|
20305 | for (var i = 0; i < nodes.length; i++) {
|
20306 | var node = nodes[i];
|
20307 | if (node.tagName !== 'DIV') {
|
20308 | $prev.push(node);
|
20309 | } else {
|
20310 | hasNext = true;
|
20311 | break;
|
20312 | }
|
20313 | }
|
20314 | if (hasNext && $prev.length >= 1) $prev.wrapAll('<div>');
|
20315 | }
|
20316 | /* eslint-enable */
|
20317 |
|
20318 | /***/ },
|
20319 | /* 166 */
|
20320 | /***/ function(module, exports, __webpack_require__) {
|
20321 |
|
20322 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
20323 | * jQuery JavaScript Library v2.1.4
|
20324 | * http://jquery.com/
|
20325 | *
|
20326 | * Includes Sizzle.js
|
20327 | * http://sizzlejs.com/
|
20328 | *
|
20329 | * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
|
20330 | * Released under the MIT license
|
20331 | * http://jquery.org/license
|
20332 | *
|
20333 | * Date: 2015-04-28T16:01Z
|
20334 | */
|
20335 |
|
20336 | (function( global, factory ) {
|
20337 |
|
20338 | if ( typeof module === "object" && typeof module.exports === "object" ) {
|
20339 | // For CommonJS and CommonJS-like environments where a proper `window`
|
20340 | // is present, execute the factory and get jQuery.
|
20341 | // For environments that do not have a `window` with a `document`
|
20342 | // (such as Node.js), expose a factory as module.exports.
|
20343 | // This accentuates the need for the creation of a real `window`.
|
20344 | // e.g. var jQuery = require("jquery")(window);
|
20345 | // See ticket #14549 for more info.
|
20346 | module.exports = global.document ?
|
20347 | factory( global, true ) :
|
20348 | function( w ) {
|
20349 | if ( !w.document ) {
|
20350 | throw new Error( "jQuery requires a window with a document" );
|
20351 | }
|
20352 | return factory( w );
|
20353 | };
|
20354 | } else {
|
20355 | factory( global );
|
20356 | }
|
20357 |
|
20358 | // Pass this if window is not defined yet
|
20359 | }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
|
20360 |
|
20361 | // Support: Firefox 18+
|
20362 | // Can't be in strict mode, several libs including ASP.NET trace
|
20363 | // the stack via arguments.caller.callee and Firefox dies if
|
20364 | // you try to trace through "use strict" call chains. (#13335)
|
20365 | //
|
20366 |
|
20367 | var arr = [];
|
20368 |
|
20369 | var slice = arr.slice;
|
20370 |
|
20371 | var concat = arr.concat;
|
20372 |
|
20373 | var push = arr.push;
|
20374 |
|
20375 | var indexOf = arr.indexOf;
|
20376 |
|
20377 | var class2type = {};
|
20378 |
|
20379 | var toString = class2type.toString;
|
20380 |
|
20381 | var hasOwn = class2type.hasOwnProperty;
|
20382 |
|
20383 | var support = {};
|
20384 |
|
20385 |
|
20386 |
|
20387 | var
|
20388 | // Use the correct document accordingly with window argument (sandbox)
|
20389 | document = window.document,
|
20390 |
|
20391 | version = "2.1.4",
|
20392 |
|
20393 | // Define a local copy of jQuery
|
20394 | jQuery = function( selector, context ) {
|
20395 | // The jQuery object is actually just the init constructor 'enhanced'
|
20396 | // Need init if jQuery is called (just allow error to be thrown if not included)
|
20397 | return new jQuery.fn.init( selector, context );
|
20398 | },
|
20399 |
|
20400 | // Support: Android<4.1
|
20401 | // Make sure we trim BOM and NBSP
|
20402 | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
20403 |
|
20404 | // Matches dashed string for camelizing
|
20405 | rmsPrefix = /^-ms-/,
|
20406 | rdashAlpha = /-([\da-z])/gi,
|
20407 |
|
20408 | // Used by jQuery.camelCase as callback to replace()
|
20409 | fcamelCase = function( all, letter ) {
|
20410 | return letter.toUpperCase();
|
20411 | };
|
20412 |
|
20413 | jQuery.fn = jQuery.prototype = {
|
20414 | // The current version of jQuery being used
|
20415 | jquery: version,
|
20416 |
|
20417 | constructor: jQuery,
|
20418 |
|
20419 | // Start with an empty selector
|
20420 | selector: "",
|
20421 |
|
20422 | // The default length of a jQuery object is 0
|
20423 | length: 0,
|
20424 |
|
20425 | toArray: function() {
|
20426 | return slice.call( this );
|
20427 | },
|
20428 |
|
20429 | // Get the Nth element in the matched element set OR
|
20430 | // Get the whole matched element set as a clean array
|
20431 | get: function( num ) {
|
20432 | return num != null ?
|
20433 |
|
20434 | // Return just the one element from the set
|
20435 | ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
|
20436 |
|
20437 | // Return all the elements in a clean array
|
20438 | slice.call( this );
|
20439 | },
|
20440 |
|
20441 | // Take an array of elements and push it onto the stack
|
20442 | // (returning the new matched element set)
|
20443 | pushStack: function( elems ) {
|
20444 |
|
20445 | // Build a new jQuery matched element set
|
20446 | var ret = jQuery.merge( this.constructor(), elems );
|
20447 |
|
20448 | // Add the old object onto the stack (as a reference)
|
20449 | ret.prevObject = this;
|
20450 | ret.context = this.context;
|
20451 |
|
20452 | // Return the newly-formed element set
|
20453 | return ret;
|
20454 | },
|
20455 |
|
20456 | // Execute a callback for every element in the matched set.
|
20457 | // (You can seed the arguments with an array of args, but this is
|
20458 | // only used internally.)
|
20459 | each: function( callback, args ) {
|
20460 | return jQuery.each( this, callback, args );
|
20461 | },
|
20462 |
|
20463 | map: function( callback ) {
|
20464 | return this.pushStack( jQuery.map(this, function( elem, i ) {
|
20465 | return callback.call( elem, i, elem );
|
20466 | }));
|
20467 | },
|
20468 |
|
20469 | slice: function() {
|
20470 | return this.pushStack( slice.apply( this, arguments ) );
|
20471 | },
|
20472 |
|
20473 | first: function() {
|
20474 | return this.eq( 0 );
|
20475 | },
|
20476 |
|
20477 | last: function() {
|
20478 | return this.eq( -1 );
|
20479 | },
|
20480 |
|
20481 | eq: function( i ) {
|
20482 | var len = this.length,
|
20483 | j = +i + ( i < 0 ? len : 0 );
|
20484 | return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
|
20485 | },
|
20486 |
|
20487 | end: function() {
|
20488 | return this.prevObject || this.constructor(null);
|
20489 | },
|
20490 |
|
20491 | // For internal use only.
|
20492 | // Behaves like an Array's method, not like a jQuery method.
|
20493 | push: push,
|
20494 | sort: arr.sort,
|
20495 | splice: arr.splice
|
20496 | };
|
20497 |
|
20498 | jQuery.extend = jQuery.fn.extend = function() {
|
20499 | var options, name, src, copy, copyIsArray, clone,
|
20500 | target = arguments[0] || {},
|
20501 | i = 1,
|
20502 | length = arguments.length,
|
20503 | deep = false;
|
20504 |
|
20505 | // Handle a deep copy situation
|
20506 | if ( typeof target === "boolean" ) {
|
20507 | deep = target;
|
20508 |
|
20509 | // Skip the boolean and the target
|
20510 | target = arguments[ i ] || {};
|
20511 | i++;
|
20512 | }
|
20513 |
|
20514 | // Handle case when target is a string or something (possible in deep copy)
|
20515 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
20516 | target = {};
|
20517 | }
|
20518 |
|
20519 | // Extend jQuery itself if only one argument is passed
|
20520 | if ( i === length ) {
|
20521 | target = this;
|
20522 | i--;
|
20523 | }
|
20524 |
|
20525 | for ( ; i < length; i++ ) {
|
20526 | // Only deal with non-null/undefined values
|
20527 | if ( (options = arguments[ i ]) != null ) {
|
20528 | // Extend the base object
|
20529 | for ( name in options ) {
|
20530 | src = target[ name ];
|
20531 | copy = options[ name ];
|
20532 |
|
20533 | // Prevent never-ending loop
|
20534 | if ( target === copy ) {
|
20535 | continue;
|
20536 | }
|
20537 |
|
20538 | // Recurse if we're merging plain objects or arrays
|
20539 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
20540 | if ( copyIsArray ) {
|
20541 | copyIsArray = false;
|
20542 | clone = src && jQuery.isArray(src) ? src : [];
|
20543 |
|
20544 | } else {
|
20545 | clone = src && jQuery.isPlainObject(src) ? src : {};
|
20546 | }
|
20547 |
|
20548 | // Never move original objects, clone them
|
20549 | target[ name ] = jQuery.extend( deep, clone, copy );
|
20550 |
|
20551 | // Don't bring in undefined values
|
20552 | } else if ( copy !== undefined ) {
|
20553 | target[ name ] = copy;
|
20554 | }
|
20555 | }
|
20556 | }
|
20557 | }
|
20558 |
|
20559 | // Return the modified object
|
20560 | return target;
|
20561 | };
|
20562 |
|
20563 | jQuery.extend({
|
20564 | // Unique for each copy of jQuery on the page
|
20565 | expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
|
20566 |
|
20567 | // Assume jQuery is ready without the ready module
|
20568 | isReady: true,
|
20569 |
|
20570 | error: function( msg ) {
|
20571 | throw new Error( msg );
|
20572 | },
|
20573 |
|
20574 | noop: function() {},
|
20575 |
|
20576 | isFunction: function( obj ) {
|
20577 | return jQuery.type(obj) === "function";
|
20578 | },
|
20579 |
|
20580 | isArray: Array.isArray,
|
20581 |
|
20582 | isWindow: function( obj ) {
|
20583 | return obj != null && obj === obj.window;
|
20584 | },
|
20585 |
|
20586 | isNumeric: function( obj ) {
|
20587 | // parseFloat NaNs numeric-cast false positives (null|true|false|"")
|
20588 | // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
|
20589 | // subtraction forces infinities to NaN
|
20590 | // adding 1 corrects loss of precision from parseFloat (#15100)
|
20591 | return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
|
20592 | },
|
20593 |
|
20594 | isPlainObject: function( obj ) {
|
20595 | // Not plain objects:
|
20596 | // - Any object or value whose internal [[Class]] property is not "[object Object]"
|
20597 | // - DOM nodes
|
20598 | // - window
|
20599 | if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
20600 | return false;
|
20601 | }
|
20602 |
|
20603 | if ( obj.constructor &&
|
20604 | !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
|
20605 | return false;
|
20606 | }
|
20607 |
|
20608 | // If the function hasn't returned already, we're confident that
|
20609 | // |obj| is a plain object, created by {} or constructed with new Object
|
20610 | return true;
|
20611 | },
|
20612 |
|
20613 | isEmptyObject: function( obj ) {
|
20614 | var name;
|
20615 | for ( name in obj ) {
|
20616 | return false;
|
20617 | }
|
20618 | return true;
|
20619 | },
|
20620 |
|
20621 | type: function( obj ) {
|
20622 | if ( obj == null ) {
|
20623 | return obj + "";
|
20624 | }
|
20625 | // Support: Android<4.0, iOS<6 (functionish RegExp)
|
20626 | return typeof obj === "object" || typeof obj === "function" ?
|
20627 | class2type[ toString.call(obj) ] || "object" :
|
20628 | typeof obj;
|
20629 | },
|
20630 |
|
20631 | // Evaluates a script in a global context
|
20632 | globalEval: function( code ) {
|
20633 | var script,
|
20634 | indirect = eval;
|
20635 |
|
20636 | code = jQuery.trim( code );
|
20637 |
|
20638 | if ( code ) {
|
20639 | // If the code includes a valid, prologue position
|
20640 | // strict mode pragma, execute code by injecting a
|
20641 | // script tag into the document.
|
20642 | if ( code.indexOf("use strict") === 1 ) {
|
20643 | script = document.createElement("script");
|
20644 | script.text = code;
|
20645 | document.head.appendChild( script ).parentNode.removeChild( script );
|
20646 | } else {
|
20647 | // Otherwise, avoid the DOM node creation, insertion
|
20648 | // and removal by using an indirect global eval
|
20649 | indirect( code );
|
20650 | }
|
20651 | }
|
20652 | },
|
20653 |
|
20654 | // Convert dashed to camelCase; used by the css and data modules
|
20655 | // Support: IE9-11+
|
20656 | // Microsoft forgot to hump their vendor prefix (#9572)
|
20657 | camelCase: function( string ) {
|
20658 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
20659 | },
|
20660 |
|
20661 | nodeName: function( elem, name ) {
|
20662 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
20663 | },
|
20664 |
|
20665 | // args is for internal usage only
|
20666 | each: function( obj, callback, args ) {
|
20667 | var value,
|
20668 | i = 0,
|
20669 | length = obj.length,
|
20670 | isArray = isArraylike( obj );
|
20671 |
|
20672 | if ( args ) {
|
20673 | if ( isArray ) {
|
20674 | for ( ; i < length; i++ ) {
|
20675 | value = callback.apply( obj[ i ], args );
|
20676 |
|
20677 | if ( value === false ) {
|
20678 | break;
|
20679 | }
|
20680 | }
|
20681 | } else {
|
20682 | for ( i in obj ) {
|
20683 | value = callback.apply( obj[ i ], args );
|
20684 |
|
20685 | if ( value === false ) {
|
20686 | break;
|
20687 | }
|
20688 | }
|
20689 | }
|
20690 |
|
20691 | // A special, fast, case for the most common use of each
|
20692 | } else {
|
20693 | if ( isArray ) {
|
20694 | for ( ; i < length; i++ ) {
|
20695 | value = callback.call( obj[ i ], i, obj[ i ] );
|
20696 |
|
20697 | if ( value === false ) {
|
20698 | break;
|
20699 | }
|
20700 | }
|
20701 | } else {
|
20702 | for ( i in obj ) {
|
20703 | value = callback.call( obj[ i ], i, obj[ i ] );
|
20704 |
|
20705 | if ( value === false ) {
|
20706 | break;
|
20707 | }
|
20708 | }
|
20709 | }
|
20710 | }
|
20711 |
|
20712 | return obj;
|
20713 | },
|
20714 |
|
20715 | // Support: Android<4.1
|
20716 | trim: function( text ) {
|
20717 | return text == null ?
|
20718 | "" :
|
20719 | ( text + "" ).replace( rtrim, "" );
|
20720 | },
|
20721 |
|
20722 | // results is for internal usage only
|
20723 | makeArray: function( arr, results ) {
|
20724 | var ret = results || [];
|
20725 |
|
20726 | if ( arr != null ) {
|
20727 | if ( isArraylike( Object(arr) ) ) {
|
20728 | jQuery.merge( ret,
|
20729 | typeof arr === "string" ?
|
20730 | [ arr ] : arr
|
20731 | );
|
20732 | } else {
|
20733 | push.call( ret, arr );
|
20734 | }
|
20735 | }
|
20736 |
|
20737 | return ret;
|
20738 | },
|
20739 |
|
20740 | inArray: function( elem, arr, i ) {
|
20741 | return arr == null ? -1 : indexOf.call( arr, elem, i );
|
20742 | },
|
20743 |
|
20744 | merge: function( first, second ) {
|
20745 | var len = +second.length,
|
20746 | j = 0,
|
20747 | i = first.length;
|
20748 |
|
20749 | for ( ; j < len; j++ ) {
|
20750 | first[ i++ ] = second[ j ];
|
20751 | }
|
20752 |
|
20753 | first.length = i;
|
20754 |
|
20755 | return first;
|
20756 | },
|
20757 |
|
20758 | grep: function( elems, callback, invert ) {
|
20759 | var callbackInverse,
|
20760 | matches = [],
|
20761 | i = 0,
|
20762 | length = elems.length,
|
20763 | callbackExpect = !invert;
|
20764 |
|
20765 | // Go through the array, only saving the items
|
20766 | // that pass the validator function
|
20767 | for ( ; i < length; i++ ) {
|
20768 | callbackInverse = !callback( elems[ i ], i );
|
20769 | if ( callbackInverse !== callbackExpect ) {
|
20770 | matches.push( elems[ i ] );
|
20771 | }
|
20772 | }
|
20773 |
|
20774 | return matches;
|
20775 | },
|
20776 |
|
20777 | // arg is for internal usage only
|
20778 | map: function( elems, callback, arg ) {
|
20779 | var value,
|
20780 | i = 0,
|
20781 | length = elems.length,
|
20782 | isArray = isArraylike( elems ),
|
20783 | ret = [];
|
20784 |
|
20785 | // Go through the array, translating each of the items to their new values
|
20786 | if ( isArray ) {
|
20787 | for ( ; i < length; i++ ) {
|
20788 | value = callback( elems[ i ], i, arg );
|
20789 |
|
20790 | if ( value != null ) {
|
20791 | ret.push( value );
|
20792 | }
|
20793 | }
|
20794 |
|
20795 | // Go through every key on the object,
|
20796 | } else {
|
20797 | for ( i in elems ) {
|
20798 | value = callback( elems[ i ], i, arg );
|
20799 |
|
20800 | if ( value != null ) {
|
20801 | ret.push( value );
|
20802 | }
|
20803 | }
|
20804 | }
|
20805 |
|
20806 | // Flatten any nested arrays
|
20807 | return concat.apply( [], ret );
|
20808 | },
|
20809 |
|
20810 | // A global GUID counter for objects
|
20811 | guid: 1,
|
20812 |
|
20813 | // Bind a function to a context, optionally partially applying any
|
20814 | // arguments.
|
20815 | proxy: function( fn, context ) {
|
20816 | var tmp, args, proxy;
|
20817 |
|
20818 | if ( typeof context === "string" ) {
|
20819 | tmp = fn[ context ];
|
20820 | context = fn;
|
20821 | fn = tmp;
|
20822 | }
|
20823 |
|
20824 | // Quick check to determine if target is callable, in the spec
|
20825 | // this throws a TypeError, but we will just return undefined.
|
20826 | if ( !jQuery.isFunction( fn ) ) {
|
20827 | return undefined;
|
20828 | }
|
20829 |
|
20830 | // Simulated bind
|
20831 | args = slice.call( arguments, 2 );
|
20832 | proxy = function() {
|
20833 | return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
|
20834 | };
|
20835 |
|
20836 | // Set the guid of unique handler to the same of original handler, so it can be removed
|
20837 | proxy.guid = fn.guid = fn.guid || jQuery.guid++;
|
20838 |
|
20839 | return proxy;
|
20840 | },
|
20841 |
|
20842 | now: Date.now,
|
20843 |
|
20844 | // jQuery.support is not used in Core but other projects attach their
|
20845 | // properties to it so it needs to exist.
|
20846 | support: support
|
20847 | });
|
20848 |
|
20849 | // Populate the class2type map
|
20850 | jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
|
20851 | class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
20852 | });
|
20853 |
|
20854 | function isArraylike( obj ) {
|
20855 |
|
20856 | // Support: iOS 8.2 (not reproducible in simulator)
|
20857 | // `in` check used to prevent JIT error (gh-2145)
|
20858 | // hasOwn isn't used here due to false negatives
|
20859 | // regarding Nodelist length in IE
|
20860 | var length = "length" in obj && obj.length,
|
20861 | type = jQuery.type( obj );
|
20862 |
|
20863 | if ( type === "function" || jQuery.isWindow( obj ) ) {
|
20864 | return false;
|
20865 | }
|
20866 |
|
20867 | if ( obj.nodeType === 1 && length ) {
|
20868 | return true;
|
20869 | }
|
20870 |
|
20871 | return type === "array" || length === 0 ||
|
20872 | typeof length === "number" && length > 0 && ( length - 1 ) in obj;
|
20873 | }
|
20874 | var Sizzle =
|
20875 | /*!
|
20876 | * Sizzle CSS Selector Engine v2.2.0-pre
|
20877 | * http://sizzlejs.com/
|
20878 | *
|
20879 | * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
|
20880 | * Released under the MIT license
|
20881 | * http://jquery.org/license
|
20882 | *
|
20883 | * Date: 2014-12-16
|
20884 | */
|
20885 | (function( window ) {
|
20886 |
|
20887 | var i,
|
20888 | support,
|
20889 | Expr,
|
20890 | getText,
|
20891 | isXML,
|
20892 | tokenize,
|
20893 | compile,
|
20894 | select,
|
20895 | outermostContext,
|
20896 | sortInput,
|
20897 | hasDuplicate,
|
20898 |
|
20899 | // Local document vars
|
20900 | setDocument,
|
20901 | document,
|
20902 | docElem,
|
20903 | documentIsHTML,
|
20904 | rbuggyQSA,
|
20905 | rbuggyMatches,
|
20906 | matches,
|
20907 | contains,
|
20908 |
|
20909 | // Instance-specific data
|
20910 | expando = "sizzle" + 1 * new Date(),
|
20911 | preferredDoc = window.document,
|
20912 | dirruns = 0,
|
20913 | done = 0,
|
20914 | classCache = createCache(),
|
20915 | tokenCache = createCache(),
|
20916 | compilerCache = createCache(),
|
20917 | sortOrder = function( a, b ) {
|
20918 | if ( a === b ) {
|
20919 | hasDuplicate = true;
|
20920 | }
|
20921 | return 0;
|
20922 | },
|
20923 |
|
20924 | // General-purpose constants
|
20925 | MAX_NEGATIVE = 1 << 31,
|
20926 |
|
20927 | // Instance methods
|
20928 | hasOwn = ({}).hasOwnProperty,
|
20929 | arr = [],
|
20930 | pop = arr.pop,
|
20931 | push_native = arr.push,
|
20932 | push = arr.push,
|
20933 | slice = arr.slice,
|
20934 | // Use a stripped-down indexOf as it's faster than native
|
20935 | // http://jsperf.com/thor-indexof-vs-for/5
|
20936 | indexOf = function( list, elem ) {
|
20937 | var i = 0,
|
20938 | len = list.length;
|
20939 | for ( ; i < len; i++ ) {
|
20940 | if ( list[i] === elem ) {
|
20941 | return i;
|
20942 | }
|
20943 | }
|
20944 | return -1;
|
20945 | },
|
20946 |
|
20947 | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
|
20948 |
|
20949 | // Regular expressions
|
20950 |
|
20951 | // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
|
20952 | whitespace = "[\\x20\\t\\r\\n\\f]",
|
20953 | // http://www.w3.org/TR/css3-syntax/#characters
|
20954 | characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
|
20955 |
|
20956 | // Loosely modeled on CSS identifier characters
|
20957 | // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
|
20958 | // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
|
20959 | identifier = characterEncoding.replace( "w", "w#" ),
|
20960 |
|
20961 | // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
|
20962 | attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
|
20963 | // Operator (capture 2)
|
20964 | "*([*^$|!~]?=)" + whitespace +
|
20965 | // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
|
20966 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
|
20967 | "*\\]",
|
20968 |
|
20969 | pseudos = ":(" + characterEncoding + ")(?:\\((" +
|
20970 | // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
|
20971 | // 1. quoted (capture 3; capture 4 or capture 5)
|
20972 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
|
20973 | // 2. simple (capture 6)
|
20974 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
|
20975 | // 3. anything else (capture 2)
|
20976 | ".*" +
|
20977 | ")\\)|)",
|
20978 |
|
20979 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
|
20980 | rwhitespace = new RegExp( whitespace + "+", "g" ),
|
20981 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
|
20982 |
|
20983 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
|
20984 | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
|
20985 |
|
20986 | rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
|
20987 |
|
20988 | rpseudo = new RegExp( pseudos ),
|
20989 | ridentifier = new RegExp( "^" + identifier + "$" ),
|
20990 |
|
20991 | matchExpr = {
|
20992 | "ID": new RegExp( "^#(" + characterEncoding + ")" ),
|
20993 | "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
|
20994 | "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
|
20995 | "ATTR": new RegExp( "^" + attributes ),
|
20996 | "PSEUDO": new RegExp( "^" + pseudos ),
|
20997 | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
|
20998 | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
|
20999 | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
|
21000 | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
|
21001 | // For use in libraries implementing .is()
|
21002 | // We use this for POS matching in `select`
|
21003 | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
|
21004 | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
|
21005 | },
|
21006 |
|
21007 | rinputs = /^(?:input|select|textarea|button)$/i,
|
21008 | rheader = /^h\d$/i,
|
21009 |
|
21010 | rnative = /^[^{]+\{\s*\[native \w/,
|
21011 |
|
21012 | // Easily-parseable/retrievable ID or TAG or CLASS selectors
|
21013 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
|
21014 |
|
21015 | rsibling = /[+~]/,
|
21016 | rescape = /'|\\/g,
|
21017 |
|
21018 | // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
|
21019 | runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
|
21020 | funescape = function( _, escaped, escapedWhitespace ) {
|
21021 | var high = "0x" + escaped - 0x10000;
|
21022 | // NaN means non-codepoint
|
21023 | // Support: Firefox<24
|
21024 | // Workaround erroneous numeric interpretation of +"0x"
|
21025 | return high !== high || escapedWhitespace ?
|
21026 | escaped :
|
21027 | high < 0 ?
|
21028 | // BMP codepoint
|
21029 | String.fromCharCode( high + 0x10000 ) :
|
21030 | // Supplemental Plane codepoint (surrogate pair)
|
21031 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
|
21032 | },
|
21033 |
|
21034 | // Used for iframes
|
21035 | // See setDocument()
|
21036 | // Removing the function wrapper causes a "Permission Denied"
|
21037 | // error in IE
|
21038 | unloadHandler = function() {
|
21039 | setDocument();
|
21040 | };
|
21041 |
|
21042 | // Optimize for push.apply( _, NodeList )
|
21043 | try {
|
21044 | push.apply(
|
21045 | (arr = slice.call( preferredDoc.childNodes )),
|
21046 | preferredDoc.childNodes
|
21047 | );
|
21048 | // Support: Android<4.0
|
21049 | // Detect silently failing push.apply
|
21050 | arr[ preferredDoc.childNodes.length ].nodeType;
|
21051 | } catch ( e ) {
|
21052 | push = { apply: arr.length ?
|
21053 |
|
21054 | // Leverage slice if possible
|
21055 | function( target, els ) {
|
21056 | push_native.apply( target, slice.call(els) );
|
21057 | } :
|
21058 |
|
21059 | // Support: IE<9
|
21060 | // Otherwise append directly
|
21061 | function( target, els ) {
|
21062 | var j = target.length,
|
21063 | i = 0;
|
21064 | // Can't trust NodeList.length
|
21065 | while ( (target[j++] = els[i++]) ) {}
|
21066 | target.length = j - 1;
|
21067 | }
|
21068 | };
|
21069 | }
|
21070 |
|
21071 | function Sizzle( selector, context, results, seed ) {
|
21072 | var match, elem, m, nodeType,
|
21073 | // QSA vars
|
21074 | i, groups, old, nid, newContext, newSelector;
|
21075 |
|
21076 | if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
|
21077 | setDocument( context );
|
21078 | }
|
21079 |
|
21080 | context = context || document;
|
21081 | results = results || [];
|
21082 | nodeType = context.nodeType;
|
21083 |
|
21084 | if ( typeof selector !== "string" || !selector ||
|
21085 | nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
|
21086 |
|
21087 | return results;
|
21088 | }
|
21089 |
|
21090 | if ( !seed && documentIsHTML ) {
|
21091 |
|
21092 | // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
|
21093 | if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
|
21094 | // Speed-up: Sizzle("#ID")
|
21095 | if ( (m = match[1]) ) {
|
21096 | if ( nodeType === 9 ) {
|
21097 | elem = context.getElementById( m );
|
21098 | // Check parentNode to catch when Blackberry 4.6 returns
|
21099 | // nodes that are no longer in the document (jQuery #6963)
|
21100 | if ( elem && elem.parentNode ) {
|
21101 | // Handle the case where IE, Opera, and Webkit return items
|
21102 | // by name instead of ID
|
21103 | if ( elem.id === m ) {
|
21104 | results.push( elem );
|
21105 | return results;
|
21106 | }
|
21107 | } else {
|
21108 | return results;
|
21109 | }
|
21110 | } else {
|
21111 | // Context is not a document
|
21112 | if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
|
21113 | contains( context, elem ) && elem.id === m ) {
|
21114 | results.push( elem );
|
21115 | return results;
|
21116 | }
|
21117 | }
|
21118 |
|
21119 | // Speed-up: Sizzle("TAG")
|
21120 | } else if ( match[2] ) {
|
21121 | push.apply( results, context.getElementsByTagName( selector ) );
|
21122 | return results;
|
21123 |
|
21124 | // Speed-up: Sizzle(".CLASS")
|
21125 | } else if ( (m = match[3]) && support.getElementsByClassName ) {
|
21126 | push.apply( results, context.getElementsByClassName( m ) );
|
21127 | return results;
|
21128 | }
|
21129 | }
|
21130 |
|
21131 | // QSA path
|
21132 | if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
|
21133 | nid = old = expando;
|
21134 | newContext = context;
|
21135 | newSelector = nodeType !== 1 && selector;
|
21136 |
|
21137 | // qSA works strangely on Element-rooted queries
|
21138 | // We can work around this by specifying an extra ID on the root
|
21139 | // and working up from there (Thanks to Andrew Dupont for the technique)
|
21140 | // IE 8 doesn't work on object elements
|
21141 | if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
21142 | groups = tokenize( selector );
|
21143 |
|
21144 | if ( (old = context.getAttribute("id")) ) {
|
21145 | nid = old.replace( rescape, "\\$&" );
|
21146 | } else {
|
21147 | context.setAttribute( "id", nid );
|
21148 | }
|
21149 | nid = "[id='" + nid + "'] ";
|
21150 |
|
21151 | i = groups.length;
|
21152 | while ( i-- ) {
|
21153 | groups[i] = nid + toSelector( groups[i] );
|
21154 | }
|
21155 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
|
21156 | newSelector = groups.join(",");
|
21157 | }
|
21158 |
|
21159 | if ( newSelector ) {
|
21160 | try {
|
21161 | push.apply( results,
|
21162 | newContext.querySelectorAll( newSelector )
|
21163 | );
|
21164 | return results;
|
21165 | } catch(qsaError) {
|
21166 | } finally {
|
21167 | if ( !old ) {
|
21168 | context.removeAttribute("id");
|
21169 | }
|
21170 | }
|
21171 | }
|
21172 | }
|
21173 | }
|
21174 |
|
21175 | // All others
|
21176 | return select( selector.replace( rtrim, "$1" ), context, results, seed );
|
21177 | }
|
21178 |
|
21179 | /**
|
21180 | * Create key-value caches of limited size
|
21181 | * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
|
21182 | * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
|
21183 | * deleting the oldest entry
|
21184 | */
|
21185 | function createCache() {
|
21186 | var keys = [];
|
21187 |
|
21188 | function cache( key, value ) {
|
21189 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
|
21190 | if ( keys.push( key + " " ) > Expr.cacheLength ) {
|
21191 | // Only keep the most recent entries
|
21192 | delete cache[ keys.shift() ];
|
21193 | }
|
21194 | return (cache[ key + " " ] = value);
|
21195 | }
|
21196 | return cache;
|
21197 | }
|
21198 |
|
21199 | /**
|
21200 | * Mark a function for special use by Sizzle
|
21201 | * @param {Function} fn The function to mark
|
21202 | */
|
21203 | function markFunction( fn ) {
|
21204 | fn[ expando ] = true;
|
21205 | return fn;
|
21206 | }
|
21207 |
|
21208 | /**
|
21209 | * Support testing using an element
|
21210 | * @param {Function} fn Passed the created div and expects a boolean result
|
21211 | */
|
21212 | function assert( fn ) {
|
21213 | var div = document.createElement("div");
|
21214 |
|
21215 | try {
|
21216 | return !!fn( div );
|
21217 | } catch (e) {
|
21218 | return false;
|
21219 | } finally {
|
21220 | // Remove from its parent by default
|
21221 | if ( div.parentNode ) {
|
21222 | div.parentNode.removeChild( div );
|
21223 | }
|
21224 | // release memory in IE
|
21225 | div = null;
|
21226 | }
|
21227 | }
|
21228 |
|
21229 | /**
|
21230 | * Adds the same handler for all of the specified attrs
|
21231 | * @param {String} attrs Pipe-separated list of attributes
|
21232 | * @param {Function} handler The method that will be applied
|
21233 | */
|
21234 | function addHandle( attrs, handler ) {
|
21235 | var arr = attrs.split("|"),
|
21236 | i = attrs.length;
|
21237 |
|
21238 | while ( i-- ) {
|
21239 | Expr.attrHandle[ arr[i] ] = handler;
|
21240 | }
|
21241 | }
|
21242 |
|
21243 | /**
|
21244 | * Checks document order of two siblings
|
21245 | * @param {Element} a
|
21246 | * @param {Element} b
|
21247 | * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
|
21248 | */
|
21249 | function siblingCheck( a, b ) {
|
21250 | var cur = b && a,
|
21251 | diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
|
21252 | ( ~b.sourceIndex || MAX_NEGATIVE ) -
|
21253 | ( ~a.sourceIndex || MAX_NEGATIVE );
|
21254 |
|
21255 | // Use IE sourceIndex if available on both nodes
|
21256 | if ( diff ) {
|
21257 | return diff;
|
21258 | }
|
21259 |
|
21260 | // Check if b follows a
|
21261 | if ( cur ) {
|
21262 | while ( (cur = cur.nextSibling) ) {
|
21263 | if ( cur === b ) {
|
21264 | return -1;
|
21265 | }
|
21266 | }
|
21267 | }
|
21268 |
|
21269 | return a ? 1 : -1;
|
21270 | }
|
21271 |
|
21272 | /**
|
21273 | * Returns a function to use in pseudos for input types
|
21274 | * @param {String} type
|
21275 | */
|
21276 | function createInputPseudo( type ) {
|
21277 | return function( elem ) {
|
21278 | var name = elem.nodeName.toLowerCase();
|
21279 | return name === "input" && elem.type === type;
|
21280 | };
|
21281 | }
|
21282 |
|
21283 | /**
|
21284 | * Returns a function to use in pseudos for buttons
|
21285 | * @param {String} type
|
21286 | */
|
21287 | function createButtonPseudo( type ) {
|
21288 | return function( elem ) {
|
21289 | var name = elem.nodeName.toLowerCase();
|
21290 | return (name === "input" || name === "button") && elem.type === type;
|
21291 | };
|
21292 | }
|
21293 |
|
21294 | /**
|
21295 | * Returns a function to use in pseudos for positionals
|
21296 | * @param {Function} fn
|
21297 | */
|
21298 | function createPositionalPseudo( fn ) {
|
21299 | return markFunction(function( argument ) {
|
21300 | argument = +argument;
|
21301 | return markFunction(function( seed, matches ) {
|
21302 | var j,
|
21303 | matchIndexes = fn( [], seed.length, argument ),
|
21304 | i = matchIndexes.length;
|
21305 |
|
21306 | // Match elements found at the specified indexes
|
21307 | while ( i-- ) {
|
21308 | if ( seed[ (j = matchIndexes[i]) ] ) {
|
21309 | seed[j] = !(matches[j] = seed[j]);
|
21310 | }
|
21311 | }
|
21312 | });
|
21313 | });
|
21314 | }
|
21315 |
|
21316 | /**
|
21317 | * Checks a node for validity as a Sizzle context
|
21318 | * @param {Element|Object=} context
|
21319 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
|
21320 | */
|
21321 | function testContext( context ) {
|
21322 | return context && typeof context.getElementsByTagName !== "undefined" && context;
|
21323 | }
|
21324 |
|
21325 | // Expose support vars for convenience
|
21326 | support = Sizzle.support = {};
|
21327 |
|
21328 | /**
|
21329 | * Detects XML nodes
|
21330 | * @param {Element|Object} elem An element or a document
|
21331 | * @returns {Boolean} True iff elem is a non-HTML XML node
|
21332 | */
|
21333 | isXML = Sizzle.isXML = function( elem ) {
|
21334 | // documentElement is verified for cases where it doesn't yet exist
|
21335 | // (such as loading iframes in IE - #4833)
|
21336 | var documentElement = elem && (elem.ownerDocument || elem).documentElement;
|
21337 | return documentElement ? documentElement.nodeName !== "HTML" : false;
|
21338 | };
|
21339 |
|
21340 | /**
|
21341 | * Sets document-related variables once based on the current document
|
21342 | * @param {Element|Object} [doc] An element or document object to use to set the document
|
21343 | * @returns {Object} Returns the current document
|
21344 | */
|
21345 | setDocument = Sizzle.setDocument = function( node ) {
|
21346 | var hasCompare, parent,
|
21347 | doc = node ? node.ownerDocument || node : preferredDoc;
|
21348 |
|
21349 | // If no document and documentElement is available, return
|
21350 | if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
|
21351 | return document;
|
21352 | }
|
21353 |
|
21354 | // Set our document
|
21355 | document = doc;
|
21356 | docElem = doc.documentElement;
|
21357 | parent = doc.defaultView;
|
21358 |
|
21359 | // Support: IE>8
|
21360 | // If iframe document is assigned to "document" variable and if iframe has been reloaded,
|
21361 | // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
|
21362 | // IE6-8 do not support the defaultView property so parent will be undefined
|
21363 | if ( parent && parent !== parent.top ) {
|
21364 | // IE11 does not have attachEvent, so all must suffer
|
21365 | if ( parent.addEventListener ) {
|
21366 | parent.addEventListener( "unload", unloadHandler, false );
|
21367 | } else if ( parent.attachEvent ) {
|
21368 | parent.attachEvent( "onunload", unloadHandler );
|
21369 | }
|
21370 | }
|
21371 |
|
21372 | /* Support tests
|
21373 | ---------------------------------------------------------------------- */
|
21374 | documentIsHTML = !isXML( doc );
|
21375 |
|
21376 | /* Attributes
|
21377 | ---------------------------------------------------------------------- */
|
21378 |
|
21379 | // Support: IE<8
|
21380 | // Verify that getAttribute really returns attributes and not properties
|
21381 | // (excepting IE8 booleans)
|
21382 | support.attributes = assert(function( div ) {
|
21383 | div.className = "i";
|
21384 | return !div.getAttribute("className");
|
21385 | });
|
21386 |
|
21387 | /* getElement(s)By*
|
21388 | ---------------------------------------------------------------------- */
|
21389 |
|
21390 | // Check if getElementsByTagName("*") returns only elements
|
21391 | support.getElementsByTagName = assert(function( div ) {
|
21392 | div.appendChild( doc.createComment("") );
|
21393 | return !div.getElementsByTagName("*").length;
|
21394 | });
|
21395 |
|
21396 | // Support: IE<9
|
21397 | support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
|
21398 |
|
21399 | // Support: IE<10
|
21400 | // Check if getElementById returns elements by name
|
21401 | // The broken getElementById methods don't pick up programatically-set names,
|
21402 | // so use a roundabout getElementsByName test
|
21403 | support.getById = assert(function( div ) {
|
21404 | docElem.appendChild( div ).id = expando;
|
21405 | return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
|
21406 | });
|
21407 |
|
21408 | // ID find and filter
|
21409 | if ( support.getById ) {
|
21410 | Expr.find["ID"] = function( id, context ) {
|
21411 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
|
21412 | var m = context.getElementById( id );
|
21413 | // Check parentNode to catch when Blackberry 4.6 returns
|
21414 | // nodes that are no longer in the document #6963
|
21415 | return m && m.parentNode ? [ m ] : [];
|
21416 | }
|
21417 | };
|
21418 | Expr.filter["ID"] = function( id ) {
|
21419 | var attrId = id.replace( runescape, funescape );
|
21420 | return function( elem ) {
|
21421 | return elem.getAttribute("id") === attrId;
|
21422 | };
|
21423 | };
|
21424 | } else {
|
21425 | // Support: IE6/7
|
21426 | // getElementById is not reliable as a find shortcut
|
21427 | delete Expr.find["ID"];
|
21428 |
|
21429 | Expr.filter["ID"] = function( id ) {
|
21430 | var attrId = id.replace( runescape, funescape );
|
21431 | return function( elem ) {
|
21432 | var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
|
21433 | return node && node.value === attrId;
|
21434 | };
|
21435 | };
|
21436 | }
|
21437 |
|
21438 | // Tag
|
21439 | Expr.find["TAG"] = support.getElementsByTagName ?
|
21440 | function( tag, context ) {
|
21441 | if ( typeof context.getElementsByTagName !== "undefined" ) {
|
21442 | return context.getElementsByTagName( tag );
|
21443 |
|
21444 | // DocumentFragment nodes don't have gEBTN
|
21445 | } else if ( support.qsa ) {
|
21446 | return context.querySelectorAll( tag );
|
21447 | }
|
21448 | } :
|
21449 |
|
21450 | function( tag, context ) {
|
21451 | var elem,
|
21452 | tmp = [],
|
21453 | i = 0,
|
21454 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
|
21455 | results = context.getElementsByTagName( tag );
|
21456 |
|
21457 | // Filter out possible comments
|
21458 | if ( tag === "*" ) {
|
21459 | while ( (elem = results[i++]) ) {
|
21460 | if ( elem.nodeType === 1 ) {
|
21461 | tmp.push( elem );
|
21462 | }
|
21463 | }
|
21464 |
|
21465 | return tmp;
|
21466 | }
|
21467 | return results;
|
21468 | };
|
21469 |
|
21470 | // Class
|
21471 | Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
|
21472 | if ( documentIsHTML ) {
|
21473 | return context.getElementsByClassName( className );
|
21474 | }
|
21475 | };
|
21476 |
|
21477 | /* QSA/matchesSelector
|
21478 | ---------------------------------------------------------------------- */
|
21479 |
|
21480 | // QSA and matchesSelector support
|
21481 |
|
21482 | // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
21483 | rbuggyMatches = [];
|
21484 |
|
21485 | // qSa(:focus) reports false when true (Chrome 21)
|
21486 | // We allow this because of a bug in IE8/9 that throws an error
|
21487 | // whenever `document.activeElement` is accessed on an iframe
|
21488 | // So, we allow :focus to pass through QSA all the time to avoid the IE error
|
21489 | // See http://bugs.jquery.com/ticket/13378
|
21490 | rbuggyQSA = [];
|
21491 |
|
21492 | if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
|
21493 | // Build QSA regex
|
21494 | // Regex strategy adopted from Diego Perini
|
21495 | assert(function( div ) {
|
21496 | // Select is set to empty string on purpose
|
21497 | // This is to test IE's treatment of not explicitly
|
21498 | // setting a boolean content attribute,
|
21499 | // since its presence should be enough
|
21500 | // http://bugs.jquery.com/ticket/12359
|
21501 | docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
|
21502 | "<select id='" + expando + "-\f]' msallowcapture=''>" +
|
21503 | "<option selected=''></option></select>";
|
21504 |
|
21505 | // Support: IE8, Opera 11-12.16
|
21506 | // Nothing should be selected when empty strings follow ^= or $= or *=
|
21507 | // The test attribute must be unknown in Opera but "safe" for WinRT
|
21508 | // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
|
21509 | if ( div.querySelectorAll("[msallowcapture^='']").length ) {
|
21510 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
|
21511 | }
|
21512 |
|
21513 | // Support: IE8
|
21514 | // Boolean attributes and "value" are not treated correctly
|
21515 | if ( !div.querySelectorAll("[selected]").length ) {
|
21516 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
|
21517 | }
|
21518 |
|
21519 | // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
|
21520 | if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
|
21521 | rbuggyQSA.push("~=");
|
21522 | }
|
21523 |
|
21524 | // Webkit/Opera - :checked should return selected option elements
|
21525 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
21526 | // IE8 throws error here and will not see later tests
|
21527 | if ( !div.querySelectorAll(":checked").length ) {
|
21528 | rbuggyQSA.push(":checked");
|
21529 | }
|
21530 |
|
21531 | // Support: Safari 8+, iOS 8+
|
21532 | // https://bugs.webkit.org/show_bug.cgi?id=136851
|
21533 | // In-page `selector#id sibing-combinator selector` fails
|
21534 | if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
|
21535 | rbuggyQSA.push(".#.+[+~]");
|
21536 | }
|
21537 | });
|
21538 |
|
21539 | assert(function( div ) {
|
21540 | // Support: Windows 8 Native Apps
|
21541 | // The type and name attributes are restricted during .innerHTML assignment
|
21542 | var input = doc.createElement("input");
|
21543 | input.setAttribute( "type", "hidden" );
|
21544 | div.appendChild( input ).setAttribute( "name", "D" );
|
21545 |
|
21546 | // Support: IE8
|
21547 | // Enforce case-sensitivity of name attribute
|
21548 | if ( div.querySelectorAll("[name=d]").length ) {
|
21549 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
|
21550 | }
|
21551 |
|
21552 | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
|
21553 | // IE8 throws error here and will not see later tests
|
21554 | if ( !div.querySelectorAll(":enabled").length ) {
|
21555 | rbuggyQSA.push( ":enabled", ":disabled" );
|
21556 | }
|
21557 |
|
21558 | // Opera 10-11 does not throw on post-comma invalid pseudos
|
21559 | div.querySelectorAll("*,:x");
|
21560 | rbuggyQSA.push(",.*:");
|
21561 | });
|
21562 | }
|
21563 |
|
21564 | if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
|
21565 | docElem.webkitMatchesSelector ||
|
21566 | docElem.mozMatchesSelector ||
|
21567 | docElem.oMatchesSelector ||
|
21568 | docElem.msMatchesSelector) )) ) {
|
21569 |
|
21570 | assert(function( div ) {
|
21571 | // Check to see if it's possible to do matchesSelector
|
21572 | // on a disconnected node (IE 9)
|
21573 | support.disconnectedMatch = matches.call( div, "div" );
|
21574 |
|
21575 | // This should fail with an exception
|
21576 | // Gecko does not error, returns false instead
|
21577 | matches.call( div, "[s!='']:x" );
|
21578 | rbuggyMatches.push( "!=", pseudos );
|
21579 | });
|
21580 | }
|
21581 |
|
21582 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
|
21583 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
|
21584 |
|
21585 | /* Contains
|
21586 | ---------------------------------------------------------------------- */
|
21587 | hasCompare = rnative.test( docElem.compareDocumentPosition );
|
21588 |
|
21589 | // Element contains another
|
21590 | // Purposefully does not implement inclusive descendent
|
21591 | // As in, an element does not contain itself
|
21592 | contains = hasCompare || rnative.test( docElem.contains ) ?
|
21593 | function( a, b ) {
|
21594 | var adown = a.nodeType === 9 ? a.documentElement : a,
|
21595 | bup = b && b.parentNode;
|
21596 | return a === bup || !!( bup && bup.nodeType === 1 && (
|
21597 | adown.contains ?
|
21598 | adown.contains( bup ) :
|
21599 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
|
21600 | ));
|
21601 | } :
|
21602 | function( a, b ) {
|
21603 | if ( b ) {
|
21604 | while ( (b = b.parentNode) ) {
|
21605 | if ( b === a ) {
|
21606 | return true;
|
21607 | }
|
21608 | }
|
21609 | }
|
21610 | return false;
|
21611 | };
|
21612 |
|
21613 | /* Sorting
|
21614 | ---------------------------------------------------------------------- */
|
21615 |
|
21616 | // Document order sorting
|
21617 | sortOrder = hasCompare ?
|
21618 | function( a, b ) {
|
21619 |
|
21620 | // Flag for duplicate removal
|
21621 | if ( a === b ) {
|
21622 | hasDuplicate = true;
|
21623 | return 0;
|
21624 | }
|
21625 |
|
21626 | // Sort on method existence if only one input has compareDocumentPosition
|
21627 | var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
|
21628 | if ( compare ) {
|
21629 | return compare;
|
21630 | }
|
21631 |
|
21632 | // Calculate position if both inputs belong to the same document
|
21633 | compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
|
21634 | a.compareDocumentPosition( b ) :
|
21635 |
|
21636 | // Otherwise we know they are disconnected
|
21637 | 1;
|
21638 |
|
21639 | // Disconnected nodes
|
21640 | if ( compare & 1 ||
|
21641 | (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
|
21642 |
|
21643 | // Choose the first element that is related to our preferred document
|
21644 | if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
|
21645 | return -1;
|
21646 | }
|
21647 | if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
|
21648 | return 1;
|
21649 | }
|
21650 |
|
21651 | // Maintain original order
|
21652 | return sortInput ?
|
21653 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
|
21654 | 0;
|
21655 | }
|
21656 |
|
21657 | return compare & 4 ? -1 : 1;
|
21658 | } :
|
21659 | function( a, b ) {
|
21660 | // Exit early if the nodes are identical
|
21661 | if ( a === b ) {
|
21662 | hasDuplicate = true;
|
21663 | return 0;
|
21664 | }
|
21665 |
|
21666 | var cur,
|
21667 | i = 0,
|
21668 | aup = a.parentNode,
|
21669 | bup = b.parentNode,
|
21670 | ap = [ a ],
|
21671 | bp = [ b ];
|
21672 |
|
21673 | // Parentless nodes are either documents or disconnected
|
21674 | if ( !aup || !bup ) {
|
21675 | return a === doc ? -1 :
|
21676 | b === doc ? 1 :
|
21677 | aup ? -1 :
|
21678 | bup ? 1 :
|
21679 | sortInput ?
|
21680 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
|
21681 | 0;
|
21682 |
|
21683 | // If the nodes are siblings, we can do a quick check
|
21684 | } else if ( aup === bup ) {
|
21685 | return siblingCheck( a, b );
|
21686 | }
|
21687 |
|
21688 | // Otherwise we need full lists of their ancestors for comparison
|
21689 | cur = a;
|
21690 | while ( (cur = cur.parentNode) ) {
|
21691 | ap.unshift( cur );
|
21692 | }
|
21693 | cur = b;
|
21694 | while ( (cur = cur.parentNode) ) {
|
21695 | bp.unshift( cur );
|
21696 | }
|
21697 |
|
21698 | // Walk down the tree looking for a discrepancy
|
21699 | while ( ap[i] === bp[i] ) {
|
21700 | i++;
|
21701 | }
|
21702 |
|
21703 | return i ?
|
21704 | // Do a sibling check if the nodes have a common ancestor
|
21705 | siblingCheck( ap[i], bp[i] ) :
|
21706 |
|
21707 | // Otherwise nodes in our document sort first
|
21708 | ap[i] === preferredDoc ? -1 :
|
21709 | bp[i] === preferredDoc ? 1 :
|
21710 | 0;
|
21711 | };
|
21712 |
|
21713 | return doc;
|
21714 | };
|
21715 |
|
21716 | Sizzle.matches = function( expr, elements ) {
|
21717 | return Sizzle( expr, null, null, elements );
|
21718 | };
|
21719 |
|
21720 | Sizzle.matchesSelector = function( elem, expr ) {
|
21721 | // Set document vars if needed
|
21722 | if ( ( elem.ownerDocument || elem ) !== document ) {
|
21723 | setDocument( elem );
|
21724 | }
|
21725 |
|
21726 | // Make sure that attribute selectors are quoted
|
21727 | expr = expr.replace( rattributeQuotes, "='$1']" );
|
21728 |
|
21729 | if ( support.matchesSelector && documentIsHTML &&
|
21730 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
|
21731 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
|
21732 |
|
21733 | try {
|
21734 | var ret = matches.call( elem, expr );
|
21735 |
|
21736 | // IE 9's matchesSelector returns false on disconnected nodes
|
21737 | if ( ret || support.disconnectedMatch ||
|
21738 | // As well, disconnected nodes are said to be in a document
|
21739 | // fragment in IE 9
|
21740 | elem.document && elem.document.nodeType !== 11 ) {
|
21741 | return ret;
|
21742 | }
|
21743 | } catch (e) {}
|
21744 | }
|
21745 |
|
21746 | return Sizzle( expr, document, null, [ elem ] ).length > 0;
|
21747 | };
|
21748 |
|
21749 | Sizzle.contains = function( context, elem ) {
|
21750 | // Set document vars if needed
|
21751 | if ( ( context.ownerDocument || context ) !== document ) {
|
21752 | setDocument( context );
|
21753 | }
|
21754 | return contains( context, elem );
|
21755 | };
|
21756 |
|
21757 | Sizzle.attr = function( elem, name ) {
|
21758 | // Set document vars if needed
|
21759 | if ( ( elem.ownerDocument || elem ) !== document ) {
|
21760 | setDocument( elem );
|
21761 | }
|
21762 |
|
21763 | var fn = Expr.attrHandle[ name.toLowerCase() ],
|
21764 | // Don't get fooled by Object.prototype properties (jQuery #13807)
|
21765 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
|
21766 | fn( elem, name, !documentIsHTML ) :
|
21767 | undefined;
|
21768 |
|
21769 | return val !== undefined ?
|
21770 | val :
|
21771 | support.attributes || !documentIsHTML ?
|
21772 | elem.getAttribute( name ) :
|
21773 | (val = elem.getAttributeNode(name)) && val.specified ?
|
21774 | val.value :
|
21775 | null;
|
21776 | };
|
21777 |
|
21778 | Sizzle.error = function( msg ) {
|
21779 | throw new Error( "Syntax error, unrecognized expression: " + msg );
|
21780 | };
|
21781 |
|
21782 | /**
|
21783 | * Document sorting and removing duplicates
|
21784 | * @param {ArrayLike} results
|
21785 | */
|
21786 | Sizzle.uniqueSort = function( results ) {
|
21787 | var elem,
|
21788 | duplicates = [],
|
21789 | j = 0,
|
21790 | i = 0;
|
21791 |
|
21792 | // Unless we *know* we can detect duplicates, assume their presence
|
21793 | hasDuplicate = !support.detectDuplicates;
|
21794 | sortInput = !support.sortStable && results.slice( 0 );
|
21795 | results.sort( sortOrder );
|
21796 |
|
21797 | if ( hasDuplicate ) {
|
21798 | while ( (elem = results[i++]) ) {
|
21799 | if ( elem === results[ i ] ) {
|
21800 | j = duplicates.push( i );
|
21801 | }
|
21802 | }
|
21803 | while ( j-- ) {
|
21804 | results.splice( duplicates[ j ], 1 );
|
21805 | }
|
21806 | }
|
21807 |
|
21808 | // Clear input after sorting to release objects
|
21809 | // See https://github.com/jquery/sizzle/pull/225
|
21810 | sortInput = null;
|
21811 |
|
21812 | return results;
|
21813 | };
|
21814 |
|
21815 | /**
|
21816 | * Utility function for retrieving the text value of an array of DOM nodes
|
21817 | * @param {Array|Element} elem
|
21818 | */
|
21819 | getText = Sizzle.getText = function( elem ) {
|
21820 | var node,
|
21821 | ret = "",
|
21822 | i = 0,
|
21823 | nodeType = elem.nodeType;
|
21824 |
|
21825 | if ( !nodeType ) {
|
21826 | // If no nodeType, this is expected to be an array
|
21827 | while ( (node = elem[i++]) ) {
|
21828 | // Do not traverse comment nodes
|
21829 | ret += getText( node );
|
21830 | }
|
21831 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
|
21832 | // Use textContent for elements
|
21833 | // innerText usage removed for consistency of new lines (jQuery #11153)
|
21834 | if ( typeof elem.textContent === "string" ) {
|
21835 | return elem.textContent;
|
21836 | } else {
|
21837 | // Traverse its children
|
21838 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
|
21839 | ret += getText( elem );
|
21840 | }
|
21841 | }
|
21842 | } else if ( nodeType === 3 || nodeType === 4 ) {
|
21843 | return elem.nodeValue;
|
21844 | }
|
21845 | // Do not include comment or processing instruction nodes
|
21846 |
|
21847 | return ret;
|
21848 | };
|
21849 |
|
21850 | Expr = Sizzle.selectors = {
|
21851 |
|
21852 | // Can be adjusted by the user
|
21853 | cacheLength: 50,
|
21854 |
|
21855 | createPseudo: markFunction,
|
21856 |
|
21857 | match: matchExpr,
|
21858 |
|
21859 | attrHandle: {},
|
21860 |
|
21861 | find: {},
|
21862 |
|
21863 | relative: {
|
21864 | ">": { dir: "parentNode", first: true },
|
21865 | " ": { dir: "parentNode" },
|
21866 | "+": { dir: "previousSibling", first: true },
|
21867 | "~": { dir: "previousSibling" }
|
21868 | },
|
21869 |
|
21870 | preFilter: {
|
21871 | "ATTR": function( match ) {
|
21872 | match[1] = match[1].replace( runescape, funescape );
|
21873 |
|
21874 | // Move the given value to match[3] whether quoted or unquoted
|
21875 | match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
|
21876 |
|
21877 | if ( match[2] === "~=" ) {
|
21878 | match[3] = " " + match[3] + " ";
|
21879 | }
|
21880 |
|
21881 | return match.slice( 0, 4 );
|
21882 | },
|
21883 |
|
21884 | "CHILD": function( match ) {
|
21885 | /* matches from matchExpr["CHILD"]
|
21886 | 1 type (only|nth|...)
|
21887 | 2 what (child|of-type)
|
21888 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
|
21889 | 4 xn-component of xn+y argument ([+-]?\d*n|)
|
21890 | 5 sign of xn-component
|
21891 | 6 x of xn-component
|
21892 | 7 sign of y-component
|
21893 | 8 y of y-component
|
21894 | */
|
21895 | match[1] = match[1].toLowerCase();
|
21896 |
|
21897 | if ( match[1].slice( 0, 3 ) === "nth" ) {
|
21898 | // nth-* requires argument
|
21899 | if ( !match[3] ) {
|
21900 | Sizzle.error( match[0] );
|
21901 | }
|
21902 |
|
21903 | // numeric x and y parameters for Expr.filter.CHILD
|
21904 | // remember that false/true cast respectively to 0/1
|
21905 | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
|
21906 | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
|
21907 |
|
21908 | // other types prohibit arguments
|
21909 | } else if ( match[3] ) {
|
21910 | Sizzle.error( match[0] );
|
21911 | }
|
21912 |
|
21913 | return match;
|
21914 | },
|
21915 |
|
21916 | "PSEUDO": function( match ) {
|
21917 | var excess,
|
21918 | unquoted = !match[6] && match[2];
|
21919 |
|
21920 | if ( matchExpr["CHILD"].test( match[0] ) ) {
|
21921 | return null;
|
21922 | }
|
21923 |
|
21924 | // Accept quoted arguments as-is
|
21925 | if ( match[3] ) {
|
21926 | match[2] = match[4] || match[5] || "";
|
21927 |
|
21928 | // Strip excess characters from unquoted arguments
|
21929 | } else if ( unquoted && rpseudo.test( unquoted ) &&
|
21930 | // Get excess from tokenize (recursively)
|
21931 | (excess = tokenize( unquoted, true )) &&
|
21932 | // advance to the next closing parenthesis
|
21933 | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
|
21934 |
|
21935 | // excess is a negative index
|
21936 | match[0] = match[0].slice( 0, excess );
|
21937 | match[2] = unquoted.slice( 0, excess );
|
21938 | }
|
21939 |
|
21940 | // Return only captures needed by the pseudo filter method (type and argument)
|
21941 | return match.slice( 0, 3 );
|
21942 | }
|
21943 | },
|
21944 |
|
21945 | filter: {
|
21946 |
|
21947 | "TAG": function( nodeNameSelector ) {
|
21948 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
|
21949 | return nodeNameSelector === "*" ?
|
21950 | function() { return true; } :
|
21951 | function( elem ) {
|
21952 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
|
21953 | };
|
21954 | },
|
21955 |
|
21956 | "CLASS": function( className ) {
|
21957 | var pattern = classCache[ className + " " ];
|
21958 |
|
21959 | return pattern ||
|
21960 | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
21961 | classCache( className, function( elem ) {
|
21962 | return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
|
21963 | });
|
21964 | },
|
21965 |
|
21966 | "ATTR": function( name, operator, check ) {
|
21967 | return function( elem ) {
|
21968 | var result = Sizzle.attr( elem, name );
|
21969 |
|
21970 | if ( result == null ) {
|
21971 | return operator === "!=";
|
21972 | }
|
21973 | if ( !operator ) {
|
21974 | return true;
|
21975 | }
|
21976 |
|
21977 | result += "";
|
21978 |
|
21979 | return operator === "=" ? result === check :
|
21980 | operator === "!=" ? result !== check :
|
21981 | operator === "^=" ? check && result.indexOf( check ) === 0 :
|
21982 | operator === "*=" ? check && result.indexOf( check ) > -1 :
|
21983 | operator === "$=" ? check && result.slice( -check.length ) === check :
|
21984 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
|
21985 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
|
21986 | false;
|
21987 | };
|
21988 | },
|
21989 |
|
21990 | "CHILD": function( type, what, argument, first, last ) {
|
21991 | var simple = type.slice( 0, 3 ) !== "nth",
|
21992 | forward = type.slice( -4 ) !== "last",
|
21993 | ofType = what === "of-type";
|
21994 |
|
21995 | return first === 1 && last === 0 ?
|
21996 |
|
21997 | // Shortcut for :nth-*(n)
|
21998 | function( elem ) {
|
21999 | return !!elem.parentNode;
|
22000 | } :
|
22001 |
|
22002 | function( elem, context, xml ) {
|
22003 | var cache, outerCache, node, diff, nodeIndex, start,
|
22004 | dir = simple !== forward ? "nextSibling" : "previousSibling",
|
22005 | parent = elem.parentNode,
|
22006 | name = ofType && elem.nodeName.toLowerCase(),
|
22007 | useCache = !xml && !ofType;
|
22008 |
|
22009 | if ( parent ) {
|
22010 |
|
22011 | // :(first|last|only)-(child|of-type)
|
22012 | if ( simple ) {
|
22013 | while ( dir ) {
|
22014 | node = elem;
|
22015 | while ( (node = node[ dir ]) ) {
|
22016 | if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
|
22017 | return false;
|
22018 | }
|
22019 | }
|
22020 | // Reverse direction for :only-* (if we haven't yet done so)
|
22021 | start = dir = type === "only" && !start && "nextSibling";
|
22022 | }
|
22023 | return true;
|
22024 | }
|
22025 |
|
22026 | start = [ forward ? parent.firstChild : parent.lastChild ];
|
22027 |
|
22028 | // non-xml :nth-child(...) stores cache data on `parent`
|
22029 | if ( forward && useCache ) {
|
22030 | // Seek `elem` from a previously-cached index
|
22031 | outerCache = parent[ expando ] || (parent[ expando ] = {});
|
22032 | cache = outerCache[ type ] || [];
|
22033 | nodeIndex = cache[0] === dirruns && cache[1];
|
22034 | diff = cache[0] === dirruns && cache[2];
|
22035 | node = nodeIndex && parent.childNodes[ nodeIndex ];
|
22036 |
|
22037 | while ( (node = ++nodeIndex && node && node[ dir ] ||
|
22038 |
|
22039 | // Fallback to seeking `elem` from the start
|
22040 | (diff = nodeIndex = 0) || start.pop()) ) {
|
22041 |
|
22042 | // When found, cache indexes on `parent` and break
|
22043 | if ( node.nodeType === 1 && ++diff && node === elem ) {
|
22044 | outerCache[ type ] = [ dirruns, nodeIndex, diff ];
|
22045 | break;
|
22046 | }
|
22047 | }
|
22048 |
|
22049 | // Use previously-cached element index if available
|
22050 | } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
|
22051 | diff = cache[1];
|
22052 |
|
22053 | // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
|
22054 | } else {
|
22055 | // Use the same loop as above to seek `elem` from the start
|
22056 | while ( (node = ++nodeIndex && node && node[ dir ] ||
|
22057 | (diff = nodeIndex = 0) || start.pop()) ) {
|
22058 |
|
22059 | if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
|
22060 | // Cache the index of each encountered element
|
22061 | if ( useCache ) {
|
22062 | (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
|
22063 | }
|
22064 |
|
22065 | if ( node === elem ) {
|
22066 | break;
|
22067 | }
|
22068 | }
|
22069 | }
|
22070 | }
|
22071 |
|
22072 | // Incorporate the offset, then check against cycle size
|
22073 | diff -= last;
|
22074 | return diff === first || ( diff % first === 0 && diff / first >= 0 );
|
22075 | }
|
22076 | };
|
22077 | },
|
22078 |
|
22079 | "PSEUDO": function( pseudo, argument ) {
|
22080 | // pseudo-class names are case-insensitive
|
22081 | // http://www.w3.org/TR/selectors/#pseudo-classes
|
22082 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
|
22083 | // Remember that setFilters inherits from pseudos
|
22084 | var args,
|
22085 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
|
22086 | Sizzle.error( "unsupported pseudo: " + pseudo );
|
22087 |
|
22088 | // The user may use createPseudo to indicate that
|
22089 | // arguments are needed to create the filter function
|
22090 | // just as Sizzle does
|
22091 | if ( fn[ expando ] ) {
|
22092 | return fn( argument );
|
22093 | }
|
22094 |
|
22095 | // But maintain support for old signatures
|
22096 | if ( fn.length > 1 ) {
|
22097 | args = [ pseudo, pseudo, "", argument ];
|
22098 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
|
22099 | markFunction(function( seed, matches ) {
|
22100 | var idx,
|
22101 | matched = fn( seed, argument ),
|
22102 | i = matched.length;
|
22103 | while ( i-- ) {
|
22104 | idx = indexOf( seed, matched[i] );
|
22105 | seed[ idx ] = !( matches[ idx ] = matched[i] );
|
22106 | }
|
22107 | }) :
|
22108 | function( elem ) {
|
22109 | return fn( elem, 0, args );
|
22110 | };
|
22111 | }
|
22112 |
|
22113 | return fn;
|
22114 | }
|
22115 | },
|
22116 |
|
22117 | pseudos: {
|
22118 | // Potentially complex pseudos
|
22119 | "not": markFunction(function( selector ) {
|
22120 | // Trim the selector passed to compile
|
22121 | // to avoid treating leading and trailing
|
22122 | // spaces as combinators
|
22123 | var input = [],
|
22124 | results = [],
|
22125 | matcher = compile( selector.replace( rtrim, "$1" ) );
|
22126 |
|
22127 | return matcher[ expando ] ?
|
22128 | markFunction(function( seed, matches, context, xml ) {
|
22129 | var elem,
|
22130 | unmatched = matcher( seed, null, xml, [] ),
|
22131 | i = seed.length;
|
22132 |
|
22133 | // Match elements unmatched by `matcher`
|
22134 | while ( i-- ) {
|
22135 | if ( (elem = unmatched[i]) ) {
|
22136 | seed[i] = !(matches[i] = elem);
|
22137 | }
|
22138 | }
|
22139 | }) :
|
22140 | function( elem, context, xml ) {
|
22141 | input[0] = elem;
|
22142 | matcher( input, null, xml, results );
|
22143 | // Don't keep the element (issue #299)
|
22144 | input[0] = null;
|
22145 | return !results.pop();
|
22146 | };
|
22147 | }),
|
22148 |
|
22149 | "has": markFunction(function( selector ) {
|
22150 | return function( elem ) {
|
22151 | return Sizzle( selector, elem ).length > 0;
|
22152 | };
|
22153 | }),
|
22154 |
|
22155 | "contains": markFunction(function( text ) {
|
22156 | text = text.replace( runescape, funescape );
|
22157 | return function( elem ) {
|
22158 | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
|
22159 | };
|
22160 | }),
|
22161 |
|
22162 | // "Whether an element is represented by a :lang() selector
|
22163 | // is based solely on the element's language value
|
22164 | // being equal to the identifier C,
|
22165 | // or beginning with the identifier C immediately followed by "-".
|
22166 | // The matching of C against the element's language value is performed case-insensitively.
|
22167 | // The identifier C does not have to be a valid language name."
|
22168 | // http://www.w3.org/TR/selectors/#lang-pseudo
|
22169 | "lang": markFunction( function( lang ) {
|
22170 | // lang value must be a valid identifier
|
22171 | if ( !ridentifier.test(lang || "") ) {
|
22172 | Sizzle.error( "unsupported lang: " + lang );
|
22173 | }
|
22174 | lang = lang.replace( runescape, funescape ).toLowerCase();
|
22175 | return function( elem ) {
|
22176 | var elemLang;
|
22177 | do {
|
22178 | if ( (elemLang = documentIsHTML ?
|
22179 | elem.lang :
|
22180 | elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
|
22181 |
|
22182 | elemLang = elemLang.toLowerCase();
|
22183 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
|
22184 | }
|
22185 | } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
|
22186 | return false;
|
22187 | };
|
22188 | }),
|
22189 |
|
22190 | // Miscellaneous
|
22191 | "target": function( elem ) {
|
22192 | var hash = window.location && window.location.hash;
|
22193 | return hash && hash.slice( 1 ) === elem.id;
|
22194 | },
|
22195 |
|
22196 | "root": function( elem ) {
|
22197 | return elem === docElem;
|
22198 | },
|
22199 |
|
22200 | "focus": function( elem ) {
|
22201 | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
22202 | },
|
22203 |
|
22204 | // Boolean properties
|
22205 | "enabled": function( elem ) {
|
22206 | return elem.disabled === false;
|
22207 | },
|
22208 |
|
22209 | "disabled": function( elem ) {
|
22210 | return elem.disabled === true;
|
22211 | },
|
22212 |
|
22213 | "checked": function( elem ) {
|
22214 | // In CSS3, :checked should return both checked and selected elements
|
22215 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
22216 | var nodeName = elem.nodeName.toLowerCase();
|
22217 | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
|
22218 | },
|
22219 |
|
22220 | "selected": function( elem ) {
|
22221 | // Accessing this property makes selected-by-default
|
22222 | // options in Safari work properly
|
22223 | if ( elem.parentNode ) {
|
22224 | elem.parentNode.selectedIndex;
|
22225 | }
|
22226 |
|
22227 | return elem.selected === true;
|
22228 | },
|
22229 |
|
22230 | // Contents
|
22231 | "empty": function( elem ) {
|
22232 | // http://www.w3.org/TR/selectors/#empty-pseudo
|
22233 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
|
22234 | // but not by others (comment: 8; processing instruction: 7; etc.)
|
22235 | // nodeType < 6 works because attributes (2) do not appear as children
|
22236 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
|
22237 | if ( elem.nodeType < 6 ) {
|
22238 | return false;
|
22239 | }
|
22240 | }
|
22241 | return true;
|
22242 | },
|
22243 |
|
22244 | "parent": function( elem ) {
|
22245 | return !Expr.pseudos["empty"]( elem );
|
22246 | },
|
22247 |
|
22248 | // Element/input types
|
22249 | "header": function( elem ) {
|
22250 | return rheader.test( elem.nodeName );
|
22251 | },
|
22252 |
|
22253 | "input": function( elem ) {
|
22254 | return rinputs.test( elem.nodeName );
|
22255 | },
|
22256 |
|
22257 | "button": function( elem ) {
|
22258 | var name = elem.nodeName.toLowerCase();
|
22259 | return name === "input" && elem.type === "button" || name === "button";
|
22260 | },
|
22261 |
|
22262 | "text": function( elem ) {
|
22263 | var attr;
|
22264 | return elem.nodeName.toLowerCase() === "input" &&
|
22265 | elem.type === "text" &&
|
22266 |
|
22267 | // Support: IE<8
|
22268 | // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
|
22269 | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
|
22270 | },
|
22271 |
|
22272 | // Position-in-collection
|
22273 | "first": createPositionalPseudo(function() {
|
22274 | return [ 0 ];
|
22275 | }),
|
22276 |
|
22277 | "last": createPositionalPseudo(function( matchIndexes, length ) {
|
22278 | return [ length - 1 ];
|
22279 | }),
|
22280 |
|
22281 | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
22282 | return [ argument < 0 ? argument + length : argument ];
|
22283 | }),
|
22284 |
|
22285 | "even": createPositionalPseudo(function( matchIndexes, length ) {
|
22286 | var i = 0;
|
22287 | for ( ; i < length; i += 2 ) {
|
22288 | matchIndexes.push( i );
|
22289 | }
|
22290 | return matchIndexes;
|
22291 | }),
|
22292 |
|
22293 | "odd": createPositionalPseudo(function( matchIndexes, length ) {
|
22294 | var i = 1;
|
22295 | for ( ; i < length; i += 2 ) {
|
22296 | matchIndexes.push( i );
|
22297 | }
|
22298 | return matchIndexes;
|
22299 | }),
|
22300 |
|
22301 | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
22302 | var i = argument < 0 ? argument + length : argument;
|
22303 | for ( ; --i >= 0; ) {
|
22304 | matchIndexes.push( i );
|
22305 | }
|
22306 | return matchIndexes;
|
22307 | }),
|
22308 |
|
22309 | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
22310 | var i = argument < 0 ? argument + length : argument;
|
22311 | for ( ; ++i < length; ) {
|
22312 | matchIndexes.push( i );
|
22313 | }
|
22314 | return matchIndexes;
|
22315 | })
|
22316 | }
|
22317 | };
|
22318 |
|
22319 | Expr.pseudos["nth"] = Expr.pseudos["eq"];
|
22320 |
|
22321 | // Add button/input type pseudos
|
22322 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
|
22323 | Expr.pseudos[ i ] = createInputPseudo( i );
|
22324 | }
|
22325 | for ( i in { submit: true, reset: true } ) {
|
22326 | Expr.pseudos[ i ] = createButtonPseudo( i );
|
22327 | }
|
22328 |
|
22329 | // Easy API for creating new setFilters
|
22330 | function setFilters() {}
|
22331 | setFilters.prototype = Expr.filters = Expr.pseudos;
|
22332 | Expr.setFilters = new setFilters();
|
22333 |
|
22334 | tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
|
22335 | var matched, match, tokens, type,
|
22336 | soFar, groups, preFilters,
|
22337 | cached = tokenCache[ selector + " " ];
|
22338 |
|
22339 | if ( cached ) {
|
22340 | return parseOnly ? 0 : cached.slice( 0 );
|
22341 | }
|
22342 |
|
22343 | soFar = selector;
|
22344 | groups = [];
|
22345 | preFilters = Expr.preFilter;
|
22346 |
|
22347 | while ( soFar ) {
|
22348 |
|
22349 | // Comma and first run
|
22350 | if ( !matched || (match = rcomma.exec( soFar )) ) {
|
22351 | if ( match ) {
|
22352 | // Don't consume trailing commas as valid
|
22353 | soFar = soFar.slice( match[0].length ) || soFar;
|
22354 | }
|
22355 | groups.push( (tokens = []) );
|
22356 | }
|
22357 |
|
22358 | matched = false;
|
22359 |
|
22360 | // Combinators
|
22361 | if ( (match = rcombinators.exec( soFar )) ) {
|
22362 | matched = match.shift();
|
22363 | tokens.push({
|
22364 | value: matched,
|
22365 | // Cast descendant combinators to space
|
22366 | type: match[0].replace( rtrim, " " )
|
22367 | });
|
22368 | soFar = soFar.slice( matched.length );
|
22369 | }
|
22370 |
|
22371 | // Filters
|
22372 | for ( type in Expr.filter ) {
|
22373 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
22374 | (match = preFilters[ type ]( match ))) ) {
|
22375 | matched = match.shift();
|
22376 | tokens.push({
|
22377 | value: matched,
|
22378 | type: type,
|
22379 | matches: match
|
22380 | });
|
22381 | soFar = soFar.slice( matched.length );
|
22382 | }
|
22383 | }
|
22384 |
|
22385 | if ( !matched ) {
|
22386 | break;
|
22387 | }
|
22388 | }
|
22389 |
|
22390 | // Return the length of the invalid excess
|
22391 | // if we're just parsing
|
22392 | // Otherwise, throw an error or return tokens
|
22393 | return parseOnly ?
|
22394 | soFar.length :
|
22395 | soFar ?
|
22396 | Sizzle.error( selector ) :
|
22397 | // Cache the tokens
|
22398 | tokenCache( selector, groups ).slice( 0 );
|
22399 | };
|
22400 |
|
22401 | function toSelector( tokens ) {
|
22402 | var i = 0,
|
22403 | len = tokens.length,
|
22404 | selector = "";
|
22405 | for ( ; i < len; i++ ) {
|
22406 | selector += tokens[i].value;
|
22407 | }
|
22408 | return selector;
|
22409 | }
|
22410 |
|
22411 | function addCombinator( matcher, combinator, base ) {
|
22412 | var dir = combinator.dir,
|
22413 | checkNonElements = base && dir === "parentNode",
|
22414 | doneName = done++;
|
22415 |
|
22416 | return combinator.first ?
|
22417 | // Check against closest ancestor/preceding element
|
22418 | function( elem, context, xml ) {
|
22419 | while ( (elem = elem[ dir ]) ) {
|
22420 | if ( elem.nodeType === 1 || checkNonElements ) {
|
22421 | return matcher( elem, context, xml );
|
22422 | }
|
22423 | }
|
22424 | } :
|
22425 |
|
22426 | // Check against all ancestor/preceding elements
|
22427 | function( elem, context, xml ) {
|
22428 | var oldCache, outerCache,
|
22429 | newCache = [ dirruns, doneName ];
|
22430 |
|
22431 | // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
|
22432 | if ( xml ) {
|
22433 | while ( (elem = elem[ dir ]) ) {
|
22434 | if ( elem.nodeType === 1 || checkNonElements ) {
|
22435 | if ( matcher( elem, context, xml ) ) {
|
22436 | return true;
|
22437 | }
|
22438 | }
|
22439 | }
|
22440 | } else {
|
22441 | while ( (elem = elem[ dir ]) ) {
|
22442 | if ( elem.nodeType === 1 || checkNonElements ) {
|
22443 | outerCache = elem[ expando ] || (elem[ expando ] = {});
|
22444 | if ( (oldCache = outerCache[ dir ]) &&
|
22445 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
|
22446 |
|
22447 | // Assign to newCache so results back-propagate to previous elements
|
22448 | return (newCache[ 2 ] = oldCache[ 2 ]);
|
22449 | } else {
|
22450 | // Reuse newcache so results back-propagate to previous elements
|
22451 | outerCache[ dir ] = newCache;
|
22452 |
|
22453 | // A match means we're done; a fail means we have to keep checking
|
22454 | if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
|
22455 | return true;
|
22456 | }
|
22457 | }
|
22458 | }
|
22459 | }
|
22460 | }
|
22461 | };
|
22462 | }
|
22463 |
|
22464 | function elementMatcher( matchers ) {
|
22465 | return matchers.length > 1 ?
|
22466 | function( elem, context, xml ) {
|
22467 | var i = matchers.length;
|
22468 | while ( i-- ) {
|
22469 | if ( !matchers[i]( elem, context, xml ) ) {
|
22470 | return false;
|
22471 | }
|
22472 | }
|
22473 | return true;
|
22474 | } :
|
22475 | matchers[0];
|
22476 | }
|
22477 |
|
22478 | function multipleContexts( selector, contexts, results ) {
|
22479 | var i = 0,
|
22480 | len = contexts.length;
|
22481 | for ( ; i < len; i++ ) {
|
22482 | Sizzle( selector, contexts[i], results );
|
22483 | }
|
22484 | return results;
|
22485 | }
|
22486 |
|
22487 | function condense( unmatched, map, filter, context, xml ) {
|
22488 | var elem,
|
22489 | newUnmatched = [],
|
22490 | i = 0,
|
22491 | len = unmatched.length,
|
22492 | mapped = map != null;
|
22493 |
|
22494 | for ( ; i < len; i++ ) {
|
22495 | if ( (elem = unmatched[i]) ) {
|
22496 | if ( !filter || filter( elem, context, xml ) ) {
|
22497 | newUnmatched.push( elem );
|
22498 | if ( mapped ) {
|
22499 | map.push( i );
|
22500 | }
|
22501 | }
|
22502 | }
|
22503 | }
|
22504 |
|
22505 | return newUnmatched;
|
22506 | }
|
22507 |
|
22508 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
|
22509 | if ( postFilter && !postFilter[ expando ] ) {
|
22510 | postFilter = setMatcher( postFilter );
|
22511 | }
|
22512 | if ( postFinder && !postFinder[ expando ] ) {
|
22513 | postFinder = setMatcher( postFinder, postSelector );
|
22514 | }
|
22515 | return markFunction(function( seed, results, context, xml ) {
|
22516 | var temp, i, elem,
|
22517 | preMap = [],
|
22518 | postMap = [],
|
22519 | preexisting = results.length,
|
22520 |
|
22521 | // Get initial elements from seed or context
|
22522 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
22523 |
|
22524 | // Prefilter to get matcher input, preserving a map for seed-results synchronization
|
22525 | matcherIn = preFilter && ( seed || !selector ) ?
|
22526 | condense( elems, preMap, preFilter, context, xml ) :
|
22527 | elems,
|
22528 |
|
22529 | matcherOut = matcher ?
|
22530 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
|
22531 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
|
22532 |
|
22533 | // ...intermediate processing is necessary
|
22534 | [] :
|
22535 |
|
22536 | // ...otherwise use results directly
|
22537 | results :
|
22538 | matcherIn;
|
22539 |
|
22540 | // Find primary matches
|
22541 | if ( matcher ) {
|
22542 | matcher( matcherIn, matcherOut, context, xml );
|
22543 | }
|
22544 |
|
22545 | // Apply postFilter
|
22546 | if ( postFilter ) {
|
22547 | temp = condense( matcherOut, postMap );
|
22548 | postFilter( temp, [], context, xml );
|
22549 |
|
22550 | // Un-match failing elements by moving them back to matcherIn
|
22551 | i = temp.length;
|
22552 | while ( i-- ) {
|
22553 | if ( (elem = temp[i]) ) {
|
22554 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
|
22555 | }
|
22556 | }
|
22557 | }
|
22558 |
|
22559 | if ( seed ) {
|
22560 | if ( postFinder || preFilter ) {
|
22561 | if ( postFinder ) {
|
22562 | // Get the final matcherOut by condensing this intermediate into postFinder contexts
|
22563 | temp = [];
|
22564 | i = matcherOut.length;
|
22565 | while ( i-- ) {
|
22566 | if ( (elem = matcherOut[i]) ) {
|
22567 | // Restore matcherIn since elem is not yet a final match
|
22568 | temp.push( (matcherIn[i] = elem) );
|
22569 | }
|
22570 | }
|
22571 | postFinder( null, (matcherOut = []), temp, xml );
|
22572 | }
|
22573 |
|
22574 | // Move matched elements from seed to results to keep them synchronized
|
22575 | i = matcherOut.length;
|
22576 | while ( i-- ) {
|
22577 | if ( (elem = matcherOut[i]) &&
|
22578 | (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
|
22579 |
|
22580 | seed[temp] = !(results[temp] = elem);
|
22581 | }
|
22582 | }
|
22583 | }
|
22584 |
|
22585 | // Add elements to results, through postFinder if defined
|
22586 | } else {
|
22587 | matcherOut = condense(
|
22588 | matcherOut === results ?
|
22589 | matcherOut.splice( preexisting, matcherOut.length ) :
|
22590 | matcherOut
|
22591 | );
|
22592 | if ( postFinder ) {
|
22593 | postFinder( null, results, matcherOut, xml );
|
22594 | } else {
|
22595 | push.apply( results, matcherOut );
|
22596 | }
|
22597 | }
|
22598 | });
|
22599 | }
|
22600 |
|
22601 | function matcherFromTokens( tokens ) {
|
22602 | var checkContext, matcher, j,
|
22603 | len = tokens.length,
|
22604 | leadingRelative = Expr.relative[ tokens[0].type ],
|
22605 | implicitRelative = leadingRelative || Expr.relative[" "],
|
22606 | i = leadingRelative ? 1 : 0,
|
22607 |
|
22608 | // The foundational matcher ensures that elements are reachable from top-level context(s)
|
22609 | matchContext = addCombinator( function( elem ) {
|
22610 | return elem === checkContext;
|
22611 | }, implicitRelative, true ),
|
22612 | matchAnyContext = addCombinator( function( elem ) {
|
22613 | return indexOf( checkContext, elem ) > -1;
|
22614 | }, implicitRelative, true ),
|
22615 | matchers = [ function( elem, context, xml ) {
|
22616 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
|
22617 | (checkContext = context).nodeType ?
|
22618 | matchContext( elem, context, xml ) :
|
22619 | matchAnyContext( elem, context, xml ) );
|
22620 | // Avoid hanging onto element (issue #299)
|
22621 | checkContext = null;
|
22622 | return ret;
|
22623 | } ];
|
22624 |
|
22625 | for ( ; i < len; i++ ) {
|
22626 | if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
22627 | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
|
22628 | } else {
|
22629 | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
22630 |
|
22631 | // Return special upon seeing a positional matcher
|
22632 | if ( matcher[ expando ] ) {
|
22633 | // Find the next relative operator (if any) for proper handling
|
22634 | j = ++i;
|
22635 | for ( ; j < len; j++ ) {
|
22636 | if ( Expr.relative[ tokens[j].type ] ) {
|
22637 | break;
|
22638 | }
|
22639 | }
|
22640 | return setMatcher(
|
22641 | i > 1 && elementMatcher( matchers ),
|
22642 | i > 1 && toSelector(
|
22643 | // If the preceding token was a descendant combinator, insert an implicit any-element `*`
|
22644 | tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
|
22645 | ).replace( rtrim, "$1" ),
|
22646 | matcher,
|
22647 | i < j && matcherFromTokens( tokens.slice( i, j ) ),
|
22648 | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
|
22649 | j < len && toSelector( tokens )
|
22650 | );
|
22651 | }
|
22652 | matchers.push( matcher );
|
22653 | }
|
22654 | }
|
22655 |
|
22656 | return elementMatcher( matchers );
|
22657 | }
|
22658 |
|
22659 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
22660 | var bySet = setMatchers.length > 0,
|
22661 | byElement = elementMatchers.length > 0,
|
22662 | superMatcher = function( seed, context, xml, results, outermost ) {
|
22663 | var elem, j, matcher,
|
22664 | matchedCount = 0,
|
22665 | i = "0",
|
22666 | unmatched = seed && [],
|
22667 | setMatched = [],
|
22668 | contextBackup = outermostContext,
|
22669 | // We must always have either seed elements or outermost context
|
22670 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
|
22671 | // Use integer dirruns iff this is the outermost matcher
|
22672 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
|
22673 | len = elems.length;
|
22674 |
|
22675 | if ( outermost ) {
|
22676 | outermostContext = context !== document && context;
|
22677 | }
|
22678 |
|
22679 | // Add elements passing elementMatchers directly to results
|
22680 | // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
|
22681 | // Support: IE<9, Safari
|
22682 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
|
22683 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
|
22684 | if ( byElement && elem ) {
|
22685 | j = 0;
|
22686 | while ( (matcher = elementMatchers[j++]) ) {
|
22687 | if ( matcher( elem, context, xml ) ) {
|
22688 | results.push( elem );
|
22689 | break;
|
22690 | }
|
22691 | }
|
22692 | if ( outermost ) {
|
22693 | dirruns = dirrunsUnique;
|
22694 | }
|
22695 | }
|
22696 |
|
22697 | // Track unmatched elements for set filters
|
22698 | if ( bySet ) {
|
22699 | // They will have gone through all possible matchers
|
22700 | if ( (elem = !matcher && elem) ) {
|
22701 | matchedCount--;
|
22702 | }
|
22703 |
|
22704 | // Lengthen the array for every element, matched or not
|
22705 | if ( seed ) {
|
22706 | unmatched.push( elem );
|
22707 | }
|
22708 | }
|
22709 | }
|
22710 |
|
22711 | // Apply set filters to unmatched elements
|
22712 | matchedCount += i;
|
22713 | if ( bySet && i !== matchedCount ) {
|
22714 | j = 0;
|
22715 | while ( (matcher = setMatchers[j++]) ) {
|
22716 | matcher( unmatched, setMatched, context, xml );
|
22717 | }
|
22718 |
|
22719 | if ( seed ) {
|
22720 | // Reintegrate element matches to eliminate the need for sorting
|
22721 | if ( matchedCount > 0 ) {
|
22722 | while ( i-- ) {
|
22723 | if ( !(unmatched[i] || setMatched[i]) ) {
|
22724 | setMatched[i] = pop.call( results );
|
22725 | }
|
22726 | }
|
22727 | }
|
22728 |
|
22729 | // Discard index placeholder values to get only actual matches
|
22730 | setMatched = condense( setMatched );
|
22731 | }
|
22732 |
|
22733 | // Add matches to results
|
22734 | push.apply( results, setMatched );
|
22735 |
|
22736 | // Seedless set matches succeeding multiple successful matchers stipulate sorting
|
22737 | if ( outermost && !seed && setMatched.length > 0 &&
|
22738 | ( matchedCount + setMatchers.length ) > 1 ) {
|
22739 |
|
22740 | Sizzle.uniqueSort( results );
|
22741 | }
|
22742 | }
|
22743 |
|
22744 | // Override manipulation of globals by nested matchers
|
22745 | if ( outermost ) {
|
22746 | dirruns = dirrunsUnique;
|
22747 | outermostContext = contextBackup;
|
22748 | }
|
22749 |
|
22750 | return unmatched;
|
22751 | };
|
22752 |
|
22753 | return bySet ?
|
22754 | markFunction( superMatcher ) :
|
22755 | superMatcher;
|
22756 | }
|
22757 |
|
22758 | compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
|
22759 | var i,
|
22760 | setMatchers = [],
|
22761 | elementMatchers = [],
|
22762 | cached = compilerCache[ selector + " " ];
|
22763 |
|
22764 | if ( !cached ) {
|
22765 | // Generate a function of recursive functions that can be used to check each element
|
22766 | if ( !match ) {
|
22767 | match = tokenize( selector );
|
22768 | }
|
22769 | i = match.length;
|
22770 | while ( i-- ) {
|
22771 | cached = matcherFromTokens( match[i] );
|
22772 | if ( cached[ expando ] ) {
|
22773 | setMatchers.push( cached );
|
22774 | } else {
|
22775 | elementMatchers.push( cached );
|
22776 | }
|
22777 | }
|
22778 |
|
22779 | // Cache the compiled function
|
22780 | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
|
22781 |
|
22782 | // Save selector and tokenization
|
22783 | cached.selector = selector;
|
22784 | }
|
22785 | return cached;
|
22786 | };
|
22787 |
|
22788 | /**
|
22789 | * A low-level selection function that works with Sizzle's compiled
|
22790 | * selector functions
|
22791 | * @param {String|Function} selector A selector or a pre-compiled
|
22792 | * selector function built with Sizzle.compile
|
22793 | * @param {Element} context
|
22794 | * @param {Array} [results]
|
22795 | * @param {Array} [seed] A set of elements to match against
|
22796 | */
|
22797 | select = Sizzle.select = function( selector, context, results, seed ) {
|
22798 | var i, tokens, token, type, find,
|
22799 | compiled = typeof selector === "function" && selector,
|
22800 | match = !seed && tokenize( (selector = compiled.selector || selector) );
|
22801 |
|
22802 | results = results || [];
|
22803 |
|
22804 | // Try to minimize operations if there is no seed and only one group
|
22805 | if ( match.length === 1 ) {
|
22806 |
|
22807 | // Take a shortcut and set the context if the root selector is an ID
|
22808 | tokens = match[0] = match[0].slice( 0 );
|
22809 | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
|
22810 | support.getById && context.nodeType === 9 && documentIsHTML &&
|
22811 | Expr.relative[ tokens[1].type ] ) {
|
22812 |
|
22813 | context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
|
22814 | if ( !context ) {
|
22815 | return results;
|
22816 |
|
22817 | // Precompiled matchers will still verify ancestry, so step up a level
|
22818 | } else if ( compiled ) {
|
22819 | context = context.parentNode;
|
22820 | }
|
22821 |
|
22822 | selector = selector.slice( tokens.shift().value.length );
|
22823 | }
|
22824 |
|
22825 | // Fetch a seed set for right-to-left matching
|
22826 | i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
|
22827 | while ( i-- ) {
|
22828 | token = tokens[i];
|
22829 |
|
22830 | // Abort if we hit a combinator
|
22831 | if ( Expr.relative[ (type = token.type) ] ) {
|
22832 | break;
|
22833 | }
|
22834 | if ( (find = Expr.find[ type ]) ) {
|
22835 | // Search, expanding context for leading sibling combinators
|
22836 | if ( (seed = find(
|
22837 | token.matches[0].replace( runescape, funescape ),
|
22838 | rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
|
22839 | )) ) {
|
22840 |
|
22841 | // If seed is empty or no tokens remain, we can return early
|
22842 | tokens.splice( i, 1 );
|
22843 | selector = seed.length && toSelector( tokens );
|
22844 | if ( !selector ) {
|
22845 | push.apply( results, seed );
|
22846 | return results;
|
22847 | }
|
22848 |
|
22849 | break;
|
22850 | }
|
22851 | }
|
22852 | }
|
22853 | }
|
22854 |
|
22855 | // Compile and execute a filtering function if one is not provided
|
22856 | // Provide `match` to avoid retokenization if we modified the selector above
|
22857 | ( compiled || compile( selector, match ) )(
|
22858 | seed,
|
22859 | context,
|
22860 | !documentIsHTML,
|
22861 | results,
|
22862 | rsibling.test( selector ) && testContext( context.parentNode ) || context
|
22863 | );
|
22864 | return results;
|
22865 | };
|
22866 |
|
22867 | // One-time assignments
|
22868 |
|
22869 | // Sort stability
|
22870 | support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
|
22871 |
|
22872 | // Support: Chrome 14-35+
|
22873 | // Always assume duplicates if they aren't passed to the comparison function
|
22874 | support.detectDuplicates = !!hasDuplicate;
|
22875 |
|
22876 | // Initialize against the default document
|
22877 | setDocument();
|
22878 |
|
22879 | // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
|
22880 | // Detached nodes confoundingly follow *each other*
|
22881 | support.sortDetached = assert(function( div1 ) {
|
22882 | // Should return 1, but returns 4 (following)
|
22883 | return div1.compareDocumentPosition( document.createElement("div") ) & 1;
|
22884 | });
|
22885 |
|
22886 | // Support: IE<8
|
22887 | // Prevent attribute/property "interpolation"
|
22888 | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
22889 | if ( !assert(function( div ) {
|
22890 | div.innerHTML = "<a href='#'></a>";
|
22891 | return div.firstChild.getAttribute("href") === "#" ;
|
22892 | }) ) {
|
22893 | addHandle( "type|href|height|width", function( elem, name, isXML ) {
|
22894 | if ( !isXML ) {
|
22895 | return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
|
22896 | }
|
22897 | });
|
22898 | }
|
22899 |
|
22900 | // Support: IE<9
|
22901 | // Use defaultValue in place of getAttribute("value")
|
22902 | if ( !support.attributes || !assert(function( div ) {
|
22903 | div.innerHTML = "<input/>";
|
22904 | div.firstChild.setAttribute( "value", "" );
|
22905 | return div.firstChild.getAttribute( "value" ) === "";
|
22906 | }) ) {
|
22907 | addHandle( "value", function( elem, name, isXML ) {
|
22908 | if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
|
22909 | return elem.defaultValue;
|
22910 | }
|
22911 | });
|
22912 | }
|
22913 |
|
22914 | // Support: IE<9
|
22915 | // Use getAttributeNode to fetch booleans when getAttribute lies
|
22916 | if ( !assert(function( div ) {
|
22917 | return div.getAttribute("disabled") == null;
|
22918 | }) ) {
|
22919 | addHandle( booleans, function( elem, name, isXML ) {
|
22920 | var val;
|
22921 | if ( !isXML ) {
|
22922 | return elem[ name ] === true ? name.toLowerCase() :
|
22923 | (val = elem.getAttributeNode( name )) && val.specified ?
|
22924 | val.value :
|
22925 | null;
|
22926 | }
|
22927 | });
|
22928 | }
|
22929 |
|
22930 | return Sizzle;
|
22931 |
|
22932 | })( window );
|
22933 |
|
22934 |
|
22935 |
|
22936 | jQuery.find = Sizzle;
|
22937 | jQuery.expr = Sizzle.selectors;
|
22938 | jQuery.expr[":"] = jQuery.expr.pseudos;
|
22939 | jQuery.unique = Sizzle.uniqueSort;
|
22940 | jQuery.text = Sizzle.getText;
|
22941 | jQuery.isXMLDoc = Sizzle.isXML;
|
22942 | jQuery.contains = Sizzle.contains;
|
22943 |
|
22944 |
|
22945 |
|
22946 | var rneedsContext = jQuery.expr.match.needsContext;
|
22947 |
|
22948 | var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
|
22949 |
|
22950 |
|
22951 |
|
22952 | var risSimple = /^.[^:#\[\.,]*$/;
|
22953 |
|
22954 | // Implement the identical functionality for filter and not
|
22955 | function winnow( elements, qualifier, not ) {
|
22956 | if ( jQuery.isFunction( qualifier ) ) {
|
22957 | return jQuery.grep( elements, function( elem, i ) {
|
22958 | /* jshint -W018 */
|
22959 | return !!qualifier.call( elem, i, elem ) !== not;
|
22960 | });
|
22961 |
|
22962 | }
|
22963 |
|
22964 | if ( qualifier.nodeType ) {
|
22965 | return jQuery.grep( elements, function( elem ) {
|
22966 | return ( elem === qualifier ) !== not;
|
22967 | });
|
22968 |
|
22969 | }
|
22970 |
|
22971 | if ( typeof qualifier === "string" ) {
|
22972 | if ( risSimple.test( qualifier ) ) {
|
22973 | return jQuery.filter( qualifier, elements, not );
|
22974 | }
|
22975 |
|
22976 | qualifier = jQuery.filter( qualifier, elements );
|
22977 | }
|
22978 |
|
22979 | return jQuery.grep( elements, function( elem ) {
|
22980 | return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
|
22981 | });
|
22982 | }
|
22983 |
|
22984 | jQuery.filter = function( expr, elems, not ) {
|
22985 | var elem = elems[ 0 ];
|
22986 |
|
22987 | if ( not ) {
|
22988 | expr = ":not(" + expr + ")";
|
22989 | }
|
22990 |
|
22991 | return elems.length === 1 && elem.nodeType === 1 ?
|
22992 | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
|
22993 | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
|
22994 | return elem.nodeType === 1;
|
22995 | }));
|
22996 | };
|
22997 |
|
22998 | jQuery.fn.extend({
|
22999 | find: function( selector ) {
|
23000 | var i,
|
23001 | len = this.length,
|
23002 | ret = [],
|
23003 | self = this;
|
23004 |
|
23005 | if ( typeof selector !== "string" ) {
|
23006 | return this.pushStack( jQuery( selector ).filter(function() {
|
23007 | for ( i = 0; i < len; i++ ) {
|
23008 | if ( jQuery.contains( self[ i ], this ) ) {
|
23009 | return true;
|
23010 | }
|
23011 | }
|
23012 | }) );
|
23013 | }
|
23014 |
|
23015 | for ( i = 0; i < len; i++ ) {
|
23016 | jQuery.find( selector, self[ i ], ret );
|
23017 | }
|
23018 |
|
23019 | // Needed because $( selector, context ) becomes $( context ).find( selector )
|
23020 | ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
|
23021 | ret.selector = this.selector ? this.selector + " " + selector : selector;
|
23022 | return ret;
|
23023 | },
|
23024 | filter: function( selector ) {
|
23025 | return this.pushStack( winnow(this, selector || [], false) );
|
23026 | },
|
23027 | not: function( selector ) {
|
23028 | return this.pushStack( winnow(this, selector || [], true) );
|
23029 | },
|
23030 | is: function( selector ) {
|
23031 | return !!winnow(
|
23032 | this,
|
23033 |
|
23034 | // If this is a positional/relative selector, check membership in the returned set
|
23035 | // so $("p:first").is("p:last") won't return true for a doc with two "p".
|
23036 | typeof selector === "string" && rneedsContext.test( selector ) ?
|
23037 | jQuery( selector ) :
|
23038 | selector || [],
|
23039 | false
|
23040 | ).length;
|
23041 | }
|
23042 | });
|
23043 |
|
23044 |
|
23045 | // Initialize a jQuery object
|
23046 |
|
23047 |
|
23048 | // A central reference to the root jQuery(document)
|
23049 | var rootjQuery,
|
23050 |
|
23051 | // A simple way to check for HTML strings
|
23052 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
23053 | // Strict HTML recognition (#11290: must start with <)
|
23054 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
|
23055 |
|
23056 | init = jQuery.fn.init = function( selector, context ) {
|
23057 | var match, elem;
|
23058 |
|
23059 | // HANDLE: $(""), $(null), $(undefined), $(false)
|
23060 | if ( !selector ) {
|
23061 | return this;
|
23062 | }
|
23063 |
|
23064 | // Handle HTML strings
|
23065 | if ( typeof selector === "string" ) {
|
23066 | if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
|
23067 | // Assume that strings that start and end with <> are HTML and skip the regex check
|
23068 | match = [ null, selector, null ];
|
23069 |
|
23070 | } else {
|
23071 | match = rquickExpr.exec( selector );
|
23072 | }
|
23073 |
|
23074 | // Match html or make sure no context is specified for #id
|
23075 | if ( match && (match[1] || !context) ) {
|
23076 |
|
23077 | // HANDLE: $(html) -> $(array)
|
23078 | if ( match[1] ) {
|
23079 | context = context instanceof jQuery ? context[0] : context;
|
23080 |
|
23081 | // Option to run scripts is true for back-compat
|
23082 | // Intentionally let the error be thrown if parseHTML is not present
|
23083 | jQuery.merge( this, jQuery.parseHTML(
|
23084 | match[1],
|
23085 | context && context.nodeType ? context.ownerDocument || context : document,
|
23086 | true
|
23087 | ) );
|
23088 |
|
23089 | // HANDLE: $(html, props)
|
23090 | if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
|
23091 | for ( match in context ) {
|
23092 | // Properties of context are called as methods if possible
|
23093 | if ( jQuery.isFunction( this[ match ] ) ) {
|
23094 | this[ match ]( context[ match ] );
|
23095 |
|
23096 | // ...and otherwise set as attributes
|
23097 | } else {
|
23098 | this.attr( match, context[ match ] );
|
23099 | }
|
23100 | }
|
23101 | }
|
23102 |
|
23103 | return this;
|
23104 |
|
23105 | // HANDLE: $(#id)
|
23106 | } else {
|
23107 | elem = document.getElementById( match[2] );
|
23108 |
|
23109 | // Support: Blackberry 4.6
|
23110 | // gEBID returns nodes no longer in the document (#6963)
|
23111 | if ( elem && elem.parentNode ) {
|
23112 | // Inject the element directly into the jQuery object
|
23113 | this.length = 1;
|
23114 | this[0] = elem;
|
23115 | }
|
23116 |
|
23117 | this.context = document;
|
23118 | this.selector = selector;
|
23119 | return this;
|
23120 | }
|
23121 |
|
23122 | // HANDLE: $(expr, $(...))
|
23123 | } else if ( !context || context.jquery ) {
|
23124 | return ( context || rootjQuery ).find( selector );
|
23125 |
|
23126 | // HANDLE: $(expr, context)
|
23127 | // (which is just equivalent to: $(context).find(expr)
|
23128 | } else {
|
23129 | return this.constructor( context ).find( selector );
|
23130 | }
|
23131 |
|
23132 | // HANDLE: $(DOMElement)
|
23133 | } else if ( selector.nodeType ) {
|
23134 | this.context = this[0] = selector;
|
23135 | this.length = 1;
|
23136 | return this;
|
23137 |
|
23138 | // HANDLE: $(function)
|
23139 | // Shortcut for document ready
|
23140 | } else if ( jQuery.isFunction( selector ) ) {
|
23141 | return typeof rootjQuery.ready !== "undefined" ?
|
23142 | rootjQuery.ready( selector ) :
|
23143 | // Execute immediately if ready is not present
|
23144 | selector( jQuery );
|
23145 | }
|
23146 |
|
23147 | if ( selector.selector !== undefined ) {
|
23148 | this.selector = selector.selector;
|
23149 | this.context = selector.context;
|
23150 | }
|
23151 |
|
23152 | return jQuery.makeArray( selector, this );
|
23153 | };
|
23154 |
|
23155 | // Give the init function the jQuery prototype for later instantiation
|
23156 | init.prototype = jQuery.fn;
|
23157 |
|
23158 | // Initialize central reference
|
23159 | rootjQuery = jQuery( document );
|
23160 |
|
23161 |
|
23162 | var rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
23163 | // Methods guaranteed to produce a unique set when starting from a unique set
|
23164 | guaranteedUnique = {
|
23165 | children: true,
|
23166 | contents: true,
|
23167 | next: true,
|
23168 | prev: true
|
23169 | };
|
23170 |
|
23171 | jQuery.extend({
|
23172 | dir: function( elem, dir, until ) {
|
23173 | var matched = [],
|
23174 | truncate = until !== undefined;
|
23175 |
|
23176 | while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
|
23177 | if ( elem.nodeType === 1 ) {
|
23178 | if ( truncate && jQuery( elem ).is( until ) ) {
|
23179 | break;
|
23180 | }
|
23181 | matched.push( elem );
|
23182 | }
|
23183 | }
|
23184 | return matched;
|
23185 | },
|
23186 |
|
23187 | sibling: function( n, elem ) {
|
23188 | var matched = [];
|
23189 |
|
23190 | for ( ; n; n = n.nextSibling ) {
|
23191 | if ( n.nodeType === 1 && n !== elem ) {
|
23192 | matched.push( n );
|
23193 | }
|
23194 | }
|
23195 |
|
23196 | return matched;
|
23197 | }
|
23198 | });
|
23199 |
|
23200 | jQuery.fn.extend({
|
23201 | has: function( target ) {
|
23202 | var targets = jQuery( target, this ),
|
23203 | l = targets.length;
|
23204 |
|
23205 | return this.filter(function() {
|
23206 | var i = 0;
|
23207 | for ( ; i < l; i++ ) {
|
23208 | if ( jQuery.contains( this, targets[i] ) ) {
|
23209 | return true;
|
23210 | }
|
23211 | }
|
23212 | });
|
23213 | },
|
23214 |
|
23215 | closest: function( selectors, context ) {
|
23216 | var cur,
|
23217 | i = 0,
|
23218 | l = this.length,
|
23219 | matched = [],
|
23220 | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
|
23221 | jQuery( selectors, context || this.context ) :
|
23222 | 0;
|
23223 |
|
23224 | for ( ; i < l; i++ ) {
|
23225 | for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
|
23226 | // Always skip document fragments
|
23227 | if ( cur.nodeType < 11 && (pos ?
|
23228 | pos.index(cur) > -1 :
|
23229 |
|
23230 | // Don't pass non-elements to Sizzle
|
23231 | cur.nodeType === 1 &&
|
23232 | jQuery.find.matchesSelector(cur, selectors)) ) {
|
23233 |
|
23234 | matched.push( cur );
|
23235 | break;
|
23236 | }
|
23237 | }
|
23238 | }
|
23239 |
|
23240 | return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
|
23241 | },
|
23242 |
|
23243 | // Determine the position of an element within the set
|
23244 | index: function( elem ) {
|
23245 |
|
23246 | // No argument, return index in parent
|
23247 | if ( !elem ) {
|
23248 | return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
|
23249 | }
|
23250 |
|
23251 | // Index in selector
|
23252 | if ( typeof elem === "string" ) {
|
23253 | return indexOf.call( jQuery( elem ), this[ 0 ] );
|
23254 | }
|
23255 |
|
23256 | // Locate the position of the desired element
|
23257 | return indexOf.call( this,
|
23258 |
|
23259 | // If it receives a jQuery object, the first element is used
|
23260 | elem.jquery ? elem[ 0 ] : elem
|
23261 | );
|
23262 | },
|
23263 |
|
23264 | add: function( selector, context ) {
|
23265 | return this.pushStack(
|
23266 | jQuery.unique(
|
23267 | jQuery.merge( this.get(), jQuery( selector, context ) )
|
23268 | )
|
23269 | );
|
23270 | },
|
23271 |
|
23272 | addBack: function( selector ) {
|
23273 | return this.add( selector == null ?
|
23274 | this.prevObject : this.prevObject.filter(selector)
|
23275 | );
|
23276 | }
|
23277 | });
|
23278 |
|
23279 | function sibling( cur, dir ) {
|
23280 | while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
|
23281 | return cur;
|
23282 | }
|
23283 |
|
23284 | jQuery.each({
|
23285 | parent: function( elem ) {
|
23286 | var parent = elem.parentNode;
|
23287 | return parent && parent.nodeType !== 11 ? parent : null;
|
23288 | },
|
23289 | parents: function( elem ) {
|
23290 | return jQuery.dir( elem, "parentNode" );
|
23291 | },
|
23292 | parentsUntil: function( elem, i, until ) {
|
23293 | return jQuery.dir( elem, "parentNode", until );
|
23294 | },
|
23295 | next: function( elem ) {
|
23296 | return sibling( elem, "nextSibling" );
|
23297 | },
|
23298 | prev: function( elem ) {
|
23299 | return sibling( elem, "previousSibling" );
|
23300 | },
|
23301 | nextAll: function( elem ) {
|
23302 | return jQuery.dir( elem, "nextSibling" );
|
23303 | },
|
23304 | prevAll: function( elem ) {
|
23305 | return jQuery.dir( elem, "previousSibling" );
|
23306 | },
|
23307 | nextUntil: function( elem, i, until ) {
|
23308 | return jQuery.dir( elem, "nextSibling", until );
|
23309 | },
|
23310 | prevUntil: function( elem, i, until ) {
|
23311 | return jQuery.dir( elem, "previousSibling", until );
|
23312 | },
|
23313 | siblings: function( elem ) {
|
23314 | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
|
23315 | },
|
23316 | children: function( elem ) {
|
23317 | return jQuery.sibling( elem.firstChild );
|
23318 | },
|
23319 | contents: function( elem ) {
|
23320 | return elem.contentDocument || jQuery.merge( [], elem.childNodes );
|
23321 | }
|
23322 | }, function( name, fn ) {
|
23323 | jQuery.fn[ name ] = function( until, selector ) {
|
23324 | var matched = jQuery.map( this, fn, until );
|
23325 |
|
23326 | if ( name.slice( -5 ) !== "Until" ) {
|
23327 | selector = until;
|
23328 | }
|
23329 |
|
23330 | if ( selector && typeof selector === "string" ) {
|
23331 | matched = jQuery.filter( selector, matched );
|
23332 | }
|
23333 |
|
23334 | if ( this.length > 1 ) {
|
23335 | // Remove duplicates
|
23336 | if ( !guaranteedUnique[ name ] ) {
|
23337 | jQuery.unique( matched );
|
23338 | }
|
23339 |
|
23340 | // Reverse order for parents* and prev-derivatives
|
23341 | if ( rparentsprev.test( name ) ) {
|
23342 | matched.reverse();
|
23343 | }
|
23344 | }
|
23345 |
|
23346 | return this.pushStack( matched );
|
23347 | };
|
23348 | });
|
23349 | var rnotwhite = (/\S+/g);
|
23350 |
|
23351 |
|
23352 |
|
23353 | // String to Object options format cache
|
23354 | var optionsCache = {};
|
23355 |
|
23356 | // Convert String-formatted options into Object-formatted ones and store in cache
|
23357 | function createOptions( options ) {
|
23358 | var object = optionsCache[ options ] = {};
|
23359 | jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
|
23360 | object[ flag ] = true;
|
23361 | });
|
23362 | return object;
|
23363 | }
|
23364 |
|
23365 | /*
|
23366 | * Create a callback list using the following parameters:
|
23367 | *
|
23368 | * options: an optional list of space-separated options that will change how
|
23369 | * the callback list behaves or a more traditional option object
|
23370 | *
|
23371 | * By default a callback list will act like an event callback list and can be
|
23372 | * "fired" multiple times.
|
23373 | *
|
23374 | * Possible options:
|
23375 | *
|
23376 | * once: will ensure the callback list can only be fired once (like a Deferred)
|
23377 | *
|
23378 | * memory: will keep track of previous values and will call any callback added
|
23379 | * after the list has been fired right away with the latest "memorized"
|
23380 | * values (like a Deferred)
|
23381 | *
|
23382 | * unique: will ensure a callback can only be added once (no duplicate in the list)
|
23383 | *
|
23384 | * stopOnFalse: interrupt callings when a callback returns false
|
23385 | *
|
23386 | */
|
23387 | jQuery.Callbacks = function( options ) {
|
23388 |
|
23389 | // Convert options from String-formatted to Object-formatted if needed
|
23390 | // (we check in cache first)
|
23391 | options = typeof options === "string" ?
|
23392 | ( optionsCache[ options ] || createOptions( options ) ) :
|
23393 | jQuery.extend( {}, options );
|
23394 |
|
23395 | var // Last fire value (for non-forgettable lists)
|
23396 | memory,
|
23397 | // Flag to know if list was already fired
|
23398 | fired,
|
23399 | // Flag to know if list is currently firing
|
23400 | firing,
|
23401 | // First callback to fire (used internally by add and fireWith)
|
23402 | firingStart,
|
23403 | // End of the loop when firing
|
23404 | firingLength,
|
23405 | // Index of currently firing callback (modified by remove if needed)
|
23406 | firingIndex,
|
23407 | // Actual callback list
|
23408 | list = [],
|
23409 | // Stack of fire calls for repeatable lists
|
23410 | stack = !options.once && [],
|
23411 | // Fire callbacks
|
23412 | fire = function( data ) {
|
23413 | memory = options.memory && data;
|
23414 | fired = true;
|
23415 | firingIndex = firingStart || 0;
|
23416 | firingStart = 0;
|
23417 | firingLength = list.length;
|
23418 | firing = true;
|
23419 | for ( ; list && firingIndex < firingLength; firingIndex++ ) {
|
23420 | if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
|
23421 | memory = false; // To prevent further calls using add
|
23422 | break;
|
23423 | }
|
23424 | }
|
23425 | firing = false;
|
23426 | if ( list ) {
|
23427 | if ( stack ) {
|
23428 | if ( stack.length ) {
|
23429 | fire( stack.shift() );
|
23430 | }
|
23431 | } else if ( memory ) {
|
23432 | list = [];
|
23433 | } else {
|
23434 | self.disable();
|
23435 | }
|
23436 | }
|
23437 | },
|
23438 | // Actual Callbacks object
|
23439 | self = {
|
23440 | // Add a callback or a collection of callbacks to the list
|
23441 | add: function() {
|
23442 | if ( list ) {
|
23443 | // First, we save the current length
|
23444 | var start = list.length;
|
23445 | (function add( args ) {
|
23446 | jQuery.each( args, function( _, arg ) {
|
23447 | var type = jQuery.type( arg );
|
23448 | if ( type === "function" ) {
|
23449 | if ( !options.unique || !self.has( arg ) ) {
|
23450 | list.push( arg );
|
23451 | }
|
23452 | } else if ( arg && arg.length && type !== "string" ) {
|
23453 | // Inspect recursively
|
23454 | add( arg );
|
23455 | }
|
23456 | });
|
23457 | })( arguments );
|
23458 | // Do we need to add the callbacks to the
|
23459 | // current firing batch?
|
23460 | if ( firing ) {
|
23461 | firingLength = list.length;
|
23462 | // With memory, if we're not firing then
|
23463 | // we should call right away
|
23464 | } else if ( memory ) {
|
23465 | firingStart = start;
|
23466 | fire( memory );
|
23467 | }
|
23468 | }
|
23469 | return this;
|
23470 | },
|
23471 | // Remove a callback from the list
|
23472 | remove: function() {
|
23473 | if ( list ) {
|
23474 | jQuery.each( arguments, function( _, arg ) {
|
23475 | var index;
|
23476 | while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
23477 | list.splice( index, 1 );
|
23478 | // Handle firing indexes
|
23479 | if ( firing ) {
|
23480 | if ( index <= firingLength ) {
|
23481 | firingLength--;
|
23482 | }
|
23483 | if ( index <= firingIndex ) {
|
23484 | firingIndex--;
|
23485 | }
|
23486 | }
|
23487 | }
|
23488 | });
|
23489 | }
|
23490 | return this;
|
23491 | },
|
23492 | // Check if a given callback is in the list.
|
23493 | // If no argument is given, return whether or not list has callbacks attached.
|
23494 | has: function( fn ) {
|
23495 | return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
|
23496 | },
|
23497 | // Remove all callbacks from the list
|
23498 | empty: function() {
|
23499 | list = [];
|
23500 | firingLength = 0;
|
23501 | return this;
|
23502 | },
|
23503 | // Have the list do nothing anymore
|
23504 | disable: function() {
|
23505 | list = stack = memory = undefined;
|
23506 | return this;
|
23507 | },
|
23508 | // Is it disabled?
|
23509 | disabled: function() {
|
23510 | return !list;
|
23511 | },
|
23512 | // Lock the list in its current state
|
23513 | lock: function() {
|
23514 | stack = undefined;
|
23515 | if ( !memory ) {
|
23516 | self.disable();
|
23517 | }
|
23518 | return this;
|
23519 | },
|
23520 | // Is it locked?
|
23521 | locked: function() {
|
23522 | return !stack;
|
23523 | },
|
23524 | // Call all callbacks with the given context and arguments
|
23525 | fireWith: function( context, args ) {
|
23526 | if ( list && ( !fired || stack ) ) {
|
23527 | args = args || [];
|
23528 | args = [ context, args.slice ? args.slice() : args ];
|
23529 | if ( firing ) {
|
23530 | stack.push( args );
|
23531 | } else {
|
23532 | fire( args );
|
23533 | }
|
23534 | }
|
23535 | return this;
|
23536 | },
|
23537 | // Call all the callbacks with the given arguments
|
23538 | fire: function() {
|
23539 | self.fireWith( this, arguments );
|
23540 | return this;
|
23541 | },
|
23542 | // To know if the callbacks have already been called at least once
|
23543 | fired: function() {
|
23544 | return !!fired;
|
23545 | }
|
23546 | };
|
23547 |
|
23548 | return self;
|
23549 | };
|
23550 |
|
23551 |
|
23552 | jQuery.extend({
|
23553 |
|
23554 | Deferred: function( func ) {
|
23555 | var tuples = [
|
23556 | // action, add listener, listener list, final state
|
23557 | [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
|
23558 | [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
|
23559 | [ "notify", "progress", jQuery.Callbacks("memory") ]
|
23560 | ],
|
23561 | state = "pending",
|
23562 | promise = {
|
23563 | state: function() {
|
23564 | return state;
|
23565 | },
|
23566 | always: function() {
|
23567 | deferred.done( arguments ).fail( arguments );
|
23568 | return this;
|
23569 | },
|
23570 | then: function( /* fnDone, fnFail, fnProgress */ ) {
|
23571 | var fns = arguments;
|
23572 | return jQuery.Deferred(function( newDefer ) {
|
23573 | jQuery.each( tuples, function( i, tuple ) {
|
23574 | var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
23575 | // deferred[ done | fail | progress ] for forwarding actions to newDefer
|
23576 | deferred[ tuple[1] ](function() {
|
23577 | var returned = fn && fn.apply( this, arguments );
|
23578 | if ( returned && jQuery.isFunction( returned.promise ) ) {
|
23579 | returned.promise()
|
23580 | .done( newDefer.resolve )
|
23581 | .fail( newDefer.reject )
|
23582 | .progress( newDefer.notify );
|
23583 | } else {
|
23584 | newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
|
23585 | }
|
23586 | });
|
23587 | });
|
23588 | fns = null;
|
23589 | }).promise();
|
23590 | },
|
23591 | // Get a promise for this deferred
|
23592 | // If obj is provided, the promise aspect is added to the object
|
23593 | promise: function( obj ) {
|
23594 | return obj != null ? jQuery.extend( obj, promise ) : promise;
|
23595 | }
|
23596 | },
|
23597 | deferred = {};
|
23598 |
|
23599 | // Keep pipe for back-compat
|
23600 | promise.pipe = promise.then;
|
23601 |
|
23602 | // Add list-specific methods
|
23603 | jQuery.each( tuples, function( i, tuple ) {
|
23604 | var list = tuple[ 2 ],
|
23605 | stateString = tuple[ 3 ];
|
23606 |
|
23607 | // promise[ done | fail | progress ] = list.add
|
23608 | promise[ tuple[1] ] = list.add;
|
23609 |
|
23610 | // Handle state
|
23611 | if ( stateString ) {
|
23612 | list.add(function() {
|
23613 | // state = [ resolved | rejected ]
|
23614 | state = stateString;
|
23615 |
|
23616 | // [ reject_list | resolve_list ].disable; progress_list.lock
|
23617 | }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
|
23618 | }
|
23619 |
|
23620 | // deferred[ resolve | reject | notify ]
|
23621 | deferred[ tuple[0] ] = function() {
|
23622 | deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
|
23623 | return this;
|
23624 | };
|
23625 | deferred[ tuple[0] + "With" ] = list.fireWith;
|
23626 | });
|
23627 |
|
23628 | // Make the deferred a promise
|
23629 | promise.promise( deferred );
|
23630 |
|
23631 | // Call given func if any
|
23632 | if ( func ) {
|
23633 | func.call( deferred, deferred );
|
23634 | }
|
23635 |
|
23636 | // All done!
|
23637 | return deferred;
|
23638 | },
|
23639 |
|
23640 | // Deferred helper
|
23641 | when: function( subordinate /* , ..., subordinateN */ ) {
|
23642 | var i = 0,
|
23643 | resolveValues = slice.call( arguments ),
|
23644 | length = resolveValues.length,
|
23645 |
|
23646 | // the count of uncompleted subordinates
|
23647 | remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
|
23648 |
|
23649 | // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
|
23650 | deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
|
23651 |
|
23652 | // Update function for both resolve and progress values
|
23653 | updateFunc = function( i, contexts, values ) {
|
23654 | return function( value ) {
|
23655 | contexts[ i ] = this;
|
23656 | values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
|
23657 | if ( values === progressValues ) {
|
23658 | deferred.notifyWith( contexts, values );
|
23659 | } else if ( !( --remaining ) ) {
|
23660 | deferred.resolveWith( contexts, values );
|
23661 | }
|
23662 | };
|
23663 | },
|
23664 |
|
23665 | progressValues, progressContexts, resolveContexts;
|
23666 |
|
23667 | // Add listeners to Deferred subordinates; treat others as resolved
|
23668 | if ( length > 1 ) {
|
23669 | progressValues = new Array( length );
|
23670 | progressContexts = new Array( length );
|
23671 | resolveContexts = new Array( length );
|
23672 | for ( ; i < length; i++ ) {
|
23673 | if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
|
23674 | resolveValues[ i ].promise()
|
23675 | .done( updateFunc( i, resolveContexts, resolveValues ) )
|
23676 | .fail( deferred.reject )
|
23677 | .progress( updateFunc( i, progressContexts, progressValues ) );
|
23678 | } else {
|
23679 | --remaining;
|
23680 | }
|
23681 | }
|
23682 | }
|
23683 |
|
23684 | // If we're not waiting on anything, resolve the master
|
23685 | if ( !remaining ) {
|
23686 | deferred.resolveWith( resolveContexts, resolveValues );
|
23687 | }
|
23688 |
|
23689 | return deferred.promise();
|
23690 | }
|
23691 | });
|
23692 |
|
23693 |
|
23694 | // The deferred used on DOM ready
|
23695 | var readyList;
|
23696 |
|
23697 | jQuery.fn.ready = function( fn ) {
|
23698 | // Add the callback
|
23699 | jQuery.ready.promise().done( fn );
|
23700 |
|
23701 | return this;
|
23702 | };
|
23703 |
|
23704 | jQuery.extend({
|
23705 | // Is the DOM ready to be used? Set to true once it occurs.
|
23706 | isReady: false,
|
23707 |
|
23708 | // A counter to track how many items to wait for before
|
23709 | // the ready event fires. See #6781
|
23710 | readyWait: 1,
|
23711 |
|
23712 | // Hold (or release) the ready event
|
23713 | holdReady: function( hold ) {
|
23714 | if ( hold ) {
|
23715 | jQuery.readyWait++;
|
23716 | } else {
|
23717 | jQuery.ready( true );
|
23718 | }
|
23719 | },
|
23720 |
|
23721 | // Handle when the DOM is ready
|
23722 | ready: function( wait ) {
|
23723 |
|
23724 | // Abort if there are pending holds or we're already ready
|
23725 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
23726 | return;
|
23727 | }
|
23728 |
|
23729 | // Remember that the DOM is ready
|
23730 | jQuery.isReady = true;
|
23731 |
|
23732 | // If a normal DOM Ready event fired, decrement, and wait if need be
|
23733 | if ( wait !== true && --jQuery.readyWait > 0 ) {
|
23734 | return;
|
23735 | }
|
23736 |
|
23737 | // If there are functions bound, to execute
|
23738 | readyList.resolveWith( document, [ jQuery ] );
|
23739 |
|
23740 | // Trigger any bound ready events
|
23741 | if ( jQuery.fn.triggerHandler ) {
|
23742 | jQuery( document ).triggerHandler( "ready" );
|
23743 | jQuery( document ).off( "ready" );
|
23744 | }
|
23745 | }
|
23746 | });
|
23747 |
|
23748 | /**
|
23749 | * The ready event handler and self cleanup method
|
23750 | */
|
23751 | function completed() {
|
23752 | document.removeEventListener( "DOMContentLoaded", completed, false );
|
23753 | window.removeEventListener( "load", completed, false );
|
23754 | jQuery.ready();
|
23755 | }
|
23756 |
|
23757 | jQuery.ready.promise = function( obj ) {
|
23758 | if ( !readyList ) {
|
23759 |
|
23760 | readyList = jQuery.Deferred();
|
23761 |
|
23762 | // Catch cases where $(document).ready() is called after the browser event has already occurred.
|
23763 | // We once tried to use readyState "interactive" here, but it caused issues like the one
|
23764 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
23765 | if ( document.readyState === "complete" ) {
|
23766 | // Handle it asynchronously to allow scripts the opportunity to delay ready
|
23767 | setTimeout( jQuery.ready );
|
23768 |
|
23769 | } else {
|
23770 |
|
23771 | // Use the handy event callback
|
23772 | document.addEventListener( "DOMContentLoaded", completed, false );
|
23773 |
|
23774 | // A fallback to window.onload, that will always work
|
23775 | window.addEventListener( "load", completed, false );
|
23776 | }
|
23777 | }
|
23778 | return readyList.promise( obj );
|
23779 | };
|
23780 |
|
23781 | // Kick off the DOM ready check even if the user does not
|
23782 | jQuery.ready.promise();
|
23783 |
|
23784 |
|
23785 |
|
23786 |
|
23787 | // Multifunctional method to get and set values of a collection
|
23788 | // The value/s can optionally be executed if it's a function
|
23789 | var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
23790 | var i = 0,
|
23791 | len = elems.length,
|
23792 | bulk = key == null;
|
23793 |
|
23794 | // Sets many values
|
23795 | if ( jQuery.type( key ) === "object" ) {
|
23796 | chainable = true;
|
23797 | for ( i in key ) {
|
23798 | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
|
23799 | }
|
23800 |
|
23801 | // Sets one value
|
23802 | } else if ( value !== undefined ) {
|
23803 | chainable = true;
|
23804 |
|
23805 | if ( !jQuery.isFunction( value ) ) {
|
23806 | raw = true;
|
23807 | }
|
23808 |
|
23809 | if ( bulk ) {
|
23810 | // Bulk operations run against the entire set
|
23811 | if ( raw ) {
|
23812 | fn.call( elems, value );
|
23813 | fn = null;
|
23814 |
|
23815 | // ...except when executing function values
|
23816 | } else {
|
23817 | bulk = fn;
|
23818 | fn = function( elem, key, value ) {
|
23819 | return bulk.call( jQuery( elem ), value );
|
23820 | };
|
23821 | }
|
23822 | }
|
23823 |
|
23824 | if ( fn ) {
|
23825 | for ( ; i < len; i++ ) {
|
23826 | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
|
23827 | }
|
23828 | }
|
23829 | }
|
23830 |
|
23831 | return chainable ?
|
23832 | elems :
|
23833 |
|
23834 | // Gets
|
23835 | bulk ?
|
23836 | fn.call( elems ) :
|
23837 | len ? fn( elems[0], key ) : emptyGet;
|
23838 | };
|
23839 |
|
23840 |
|
23841 | /**
|
23842 | * Determines whether an object can have data
|
23843 | */
|
23844 | jQuery.acceptData = function( owner ) {
|
23845 | // Accepts only:
|
23846 | // - Node
|
23847 | // - Node.ELEMENT_NODE
|
23848 | // - Node.DOCUMENT_NODE
|
23849 | // - Object
|
23850 | // - Any
|
23851 | /* jshint -W018 */
|
23852 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
|
23853 | };
|
23854 |
|
23855 |
|
23856 | function Data() {
|
23857 | // Support: Android<4,
|
23858 | // Old WebKit does not have Object.preventExtensions/freeze method,
|
23859 | // return new empty object instead with no [[set]] accessor
|
23860 | Object.defineProperty( this.cache = {}, 0, {
|
23861 | get: function() {
|
23862 | return {};
|
23863 | }
|
23864 | });
|
23865 |
|
23866 | this.expando = jQuery.expando + Data.uid++;
|
23867 | }
|
23868 |
|
23869 | Data.uid = 1;
|
23870 | Data.accepts = jQuery.acceptData;
|
23871 |
|
23872 | Data.prototype = {
|
23873 | key: function( owner ) {
|
23874 | // We can accept data for non-element nodes in modern browsers,
|
23875 | // but we should not, see #8335.
|
23876 | // Always return the key for a frozen object.
|
23877 | if ( !Data.accepts( owner ) ) {
|
23878 | return 0;
|
23879 | }
|
23880 |
|
23881 | var descriptor = {},
|
23882 | // Check if the owner object already has a cache key
|
23883 | unlock = owner[ this.expando ];
|
23884 |
|
23885 | // If not, create one
|
23886 | if ( !unlock ) {
|
23887 | unlock = Data.uid++;
|
23888 |
|
23889 | // Secure it in a non-enumerable, non-writable property
|
23890 | try {
|
23891 | descriptor[ this.expando ] = { value: unlock };
|
23892 | Object.defineProperties( owner, descriptor );
|
23893 |
|
23894 | // Support: Android<4
|
23895 | // Fallback to a less secure definition
|
23896 | } catch ( e ) {
|
23897 | descriptor[ this.expando ] = unlock;
|
23898 | jQuery.extend( owner, descriptor );
|
23899 | }
|
23900 | }
|
23901 |
|
23902 | // Ensure the cache object
|
23903 | if ( !this.cache[ unlock ] ) {
|
23904 | this.cache[ unlock ] = {};
|
23905 | }
|
23906 |
|
23907 | return unlock;
|
23908 | },
|
23909 | set: function( owner, data, value ) {
|
23910 | var prop,
|
23911 | // There may be an unlock assigned to this node,
|
23912 | // if there is no entry for this "owner", create one inline
|
23913 | // and set the unlock as though an owner entry had always existed
|
23914 | unlock = this.key( owner ),
|
23915 | cache = this.cache[ unlock ];
|
23916 |
|
23917 | // Handle: [ owner, key, value ] args
|
23918 | if ( typeof data === "string" ) {
|
23919 | cache[ data ] = value;
|
23920 |
|
23921 | // Handle: [ owner, { properties } ] args
|
23922 | } else {
|
23923 | // Fresh assignments by object are shallow copied
|
23924 | if ( jQuery.isEmptyObject( cache ) ) {
|
23925 | jQuery.extend( this.cache[ unlock ], data );
|
23926 | // Otherwise, copy the properties one-by-one to the cache object
|
23927 | } else {
|
23928 | for ( prop in data ) {
|
23929 | cache[ prop ] = data[ prop ];
|
23930 | }
|
23931 | }
|
23932 | }
|
23933 | return cache;
|
23934 | },
|
23935 | get: function( owner, key ) {
|
23936 | // Either a valid cache is found, or will be created.
|
23937 | // New caches will be created and the unlock returned,
|
23938 | // allowing direct access to the newly created
|
23939 | // empty data object. A valid owner object must be provided.
|
23940 | var cache = this.cache[ this.key( owner ) ];
|
23941 |
|
23942 | return key === undefined ?
|
23943 | cache : cache[ key ];
|
23944 | },
|
23945 | access: function( owner, key, value ) {
|
23946 | var stored;
|
23947 | // In cases where either:
|
23948 | //
|
23949 | // 1. No key was specified
|
23950 | // 2. A string key was specified, but no value provided
|
23951 | //
|
23952 | // Take the "read" path and allow the get method to determine
|
23953 | // which value to return, respectively either:
|
23954 | //
|
23955 | // 1. The entire cache object
|
23956 | // 2. The data stored at the key
|
23957 | //
|
23958 | if ( key === undefined ||
|
23959 | ((key && typeof key === "string") && value === undefined) ) {
|
23960 |
|
23961 | stored = this.get( owner, key );
|
23962 |
|
23963 | return stored !== undefined ?
|
23964 | stored : this.get( owner, jQuery.camelCase(key) );
|
23965 | }
|
23966 |
|
23967 | // [*]When the key is not a string, or both a key and value
|
23968 | // are specified, set or extend (existing objects) with either:
|
23969 | //
|
23970 | // 1. An object of properties
|
23971 | // 2. A key and value
|
23972 | //
|
23973 | this.set( owner, key, value );
|
23974 |
|
23975 | // Since the "set" path can have two possible entry points
|
23976 | // return the expected data based on which path was taken[*]
|
23977 | return value !== undefined ? value : key;
|
23978 | },
|
23979 | remove: function( owner, key ) {
|
23980 | var i, name, camel,
|
23981 | unlock = this.key( owner ),
|
23982 | cache = this.cache[ unlock ];
|
23983 |
|
23984 | if ( key === undefined ) {
|
23985 | this.cache[ unlock ] = {};
|
23986 |
|
23987 | } else {
|
23988 | // Support array or space separated string of keys
|
23989 | if ( jQuery.isArray( key ) ) {
|
23990 | // If "name" is an array of keys...
|
23991 | // When data is initially created, via ("key", "val") signature,
|
23992 | // keys will be converted to camelCase.
|
23993 | // Since there is no way to tell _how_ a key was added, remove
|
23994 | // both plain key and camelCase key. #12786
|
23995 | // This will only penalize the array argument path.
|
23996 | name = key.concat( key.map( jQuery.camelCase ) );
|
23997 | } else {
|
23998 | camel = jQuery.camelCase( key );
|
23999 | // Try the string as a key before any manipulation
|
24000 | if ( key in cache ) {
|
24001 | name = [ key, camel ];
|
24002 | } else {
|
24003 | // If a key with the spaces exists, use it.
|
24004 | // Otherwise, create an array by matching non-whitespace
|
24005 | name = camel;
|
24006 | name = name in cache ?
|
24007 | [ name ] : ( name.match( rnotwhite ) || [] );
|
24008 | }
|
24009 | }
|
24010 |
|
24011 | i = name.length;
|
24012 | while ( i-- ) {
|
24013 | delete cache[ name[ i ] ];
|
24014 | }
|
24015 | }
|
24016 | },
|
24017 | hasData: function( owner ) {
|
24018 | return !jQuery.isEmptyObject(
|
24019 | this.cache[ owner[ this.expando ] ] || {}
|
24020 | );
|
24021 | },
|
24022 | discard: function( owner ) {
|
24023 | if ( owner[ this.expando ] ) {
|
24024 | delete this.cache[ owner[ this.expando ] ];
|
24025 | }
|
24026 | }
|
24027 | };
|
24028 | var data_priv = new Data();
|
24029 |
|
24030 | var data_user = new Data();
|
24031 |
|
24032 |
|
24033 |
|
24034 | // Implementation Summary
|
24035 | //
|
24036 | // 1. Enforce API surface and semantic compatibility with 1.9.x branch
|
24037 | // 2. Improve the module's maintainability by reducing the storage
|
24038 | // paths to a single mechanism.
|
24039 | // 3. Use the same single mechanism to support "private" and "user" data.
|
24040 | // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
|
24041 | // 5. Avoid exposing implementation details on user objects (eg. expando properties)
|
24042 | // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
|
24043 |
|
24044 | var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
|
24045 | rmultiDash = /([A-Z])/g;
|
24046 |
|
24047 | function dataAttr( elem, key, data ) {
|
24048 | var name;
|
24049 |
|
24050 | // If nothing was found internally, try to fetch any
|
24051 | // data from the HTML5 data-* attribute
|
24052 | if ( data === undefined && elem.nodeType === 1 ) {
|
24053 | name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
24054 | data = elem.getAttribute( name );
|
24055 |
|
24056 | if ( typeof data === "string" ) {
|
24057 | try {
|
24058 | data = data === "true" ? true :
|
24059 | data === "false" ? false :
|
24060 | data === "null" ? null :
|
24061 | // Only convert to a number if it doesn't change the string
|
24062 | +data + "" === data ? +data :
|
24063 | rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
24064 | data;
|
24065 | } catch( e ) {}
|
24066 |
|
24067 | // Make sure we set the data so it isn't changed later
|
24068 | data_user.set( elem, key, data );
|
24069 | } else {
|
24070 | data = undefined;
|
24071 | }
|
24072 | }
|
24073 | return data;
|
24074 | }
|
24075 |
|
24076 | jQuery.extend({
|
24077 | hasData: function( elem ) {
|
24078 | return data_user.hasData( elem ) || data_priv.hasData( elem );
|
24079 | },
|
24080 |
|
24081 | data: function( elem, name, data ) {
|
24082 | return data_user.access( elem, name, data );
|
24083 | },
|
24084 |
|
24085 | removeData: function( elem, name ) {
|
24086 | data_user.remove( elem, name );
|
24087 | },
|
24088 |
|
24089 | // TODO: Now that all calls to _data and _removeData have been replaced
|
24090 | // with direct calls to data_priv methods, these can be deprecated.
|
24091 | _data: function( elem, name, data ) {
|
24092 | return data_priv.access( elem, name, data );
|
24093 | },
|
24094 |
|
24095 | _removeData: function( elem, name ) {
|
24096 | data_priv.remove( elem, name );
|
24097 | }
|
24098 | });
|
24099 |
|
24100 | jQuery.fn.extend({
|
24101 | data: function( key, value ) {
|
24102 | var i, name, data,
|
24103 | elem = this[ 0 ],
|
24104 | attrs = elem && elem.attributes;
|
24105 |
|
24106 | // Gets all values
|
24107 | if ( key === undefined ) {
|
24108 | if ( this.length ) {
|
24109 | data = data_user.get( elem );
|
24110 |
|
24111 | if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
|
24112 | i = attrs.length;
|
24113 | while ( i-- ) {
|
24114 |
|
24115 | // Support: IE11+
|
24116 | // The attrs elements can be null (#14894)
|
24117 | if ( attrs[ i ] ) {
|
24118 | name = attrs[ i ].name;
|
24119 | if ( name.indexOf( "data-" ) === 0 ) {
|
24120 | name = jQuery.camelCase( name.slice(5) );
|
24121 | dataAttr( elem, name, data[ name ] );
|
24122 | }
|
24123 | }
|
24124 | }
|
24125 | data_priv.set( elem, "hasDataAttrs", true );
|
24126 | }
|
24127 | }
|
24128 |
|
24129 | return data;
|
24130 | }
|
24131 |
|
24132 | // Sets multiple values
|
24133 | if ( typeof key === "object" ) {
|
24134 | return this.each(function() {
|
24135 | data_user.set( this, key );
|
24136 | });
|
24137 | }
|
24138 |
|
24139 | return access( this, function( value ) {
|
24140 | var data,
|
24141 | camelKey = jQuery.camelCase( key );
|
24142 |
|
24143 | // The calling jQuery object (element matches) is not empty
|
24144 | // (and therefore has an element appears at this[ 0 ]) and the
|
24145 | // `value` parameter was not undefined. An empty jQuery object
|
24146 | // will result in `undefined` for elem = this[ 0 ] which will
|
24147 | // throw an exception if an attempt to read a data cache is made.
|
24148 | if ( elem && value === undefined ) {
|
24149 | // Attempt to get data from the cache
|
24150 | // with the key as-is
|
24151 | data = data_user.get( elem, key );
|
24152 | if ( data !== undefined ) {
|
24153 | return data;
|
24154 | }
|
24155 |
|
24156 | // Attempt to get data from the cache
|
24157 | // with the key camelized
|
24158 | data = data_user.get( elem, camelKey );
|
24159 | if ( data !== undefined ) {
|
24160 | return data;
|
24161 | }
|
24162 |
|
24163 | // Attempt to "discover" the data in
|
24164 | // HTML5 custom data-* attrs
|
24165 | data = dataAttr( elem, camelKey, undefined );
|
24166 | if ( data !== undefined ) {
|
24167 | return data;
|
24168 | }
|
24169 |
|
24170 | // We tried really hard, but the data doesn't exist.
|
24171 | return;
|
24172 | }
|
24173 |
|
24174 | // Set the data...
|
24175 | this.each(function() {
|
24176 | // First, attempt to store a copy or reference of any
|
24177 | // data that might've been store with a camelCased key.
|
24178 | var data = data_user.get( this, camelKey );
|
24179 |
|
24180 | // For HTML5 data-* attribute interop, we have to
|
24181 | // store property names with dashes in a camelCase form.
|
24182 | // This might not apply to all properties...*
|
24183 | data_user.set( this, camelKey, value );
|
24184 |
|
24185 | // *... In the case of properties that might _actually_
|
24186 | // have dashes, we need to also store a copy of that
|
24187 | // unchanged property.
|
24188 | if ( key.indexOf("-") !== -1 && data !== undefined ) {
|
24189 | data_user.set( this, key, value );
|
24190 | }
|
24191 | });
|
24192 | }, null, value, arguments.length > 1, null, true );
|
24193 | },
|
24194 |
|
24195 | removeData: function( key ) {
|
24196 | return this.each(function() {
|
24197 | data_user.remove( this, key );
|
24198 | });
|
24199 | }
|
24200 | });
|
24201 |
|
24202 |
|
24203 | jQuery.extend({
|
24204 | queue: function( elem, type, data ) {
|
24205 | var queue;
|
24206 |
|
24207 | if ( elem ) {
|
24208 | type = ( type || "fx" ) + "queue";
|
24209 | queue = data_priv.get( elem, type );
|
24210 |
|
24211 | // Speed up dequeue by getting out quickly if this is just a lookup
|
24212 | if ( data ) {
|
24213 | if ( !queue || jQuery.isArray( data ) ) {
|
24214 | queue = data_priv.access( elem, type, jQuery.makeArray(data) );
|
24215 | } else {
|
24216 | queue.push( data );
|
24217 | }
|
24218 | }
|
24219 | return queue || [];
|
24220 | }
|
24221 | },
|
24222 |
|
24223 | dequeue: function( elem, type ) {
|
24224 | type = type || "fx";
|
24225 |
|
24226 | var queue = jQuery.queue( elem, type ),
|
24227 | startLength = queue.length,
|
24228 | fn = queue.shift(),
|
24229 | hooks = jQuery._queueHooks( elem, type ),
|
24230 | next = function() {
|
24231 | jQuery.dequeue( elem, type );
|
24232 | };
|
24233 |
|
24234 | // If the fx queue is dequeued, always remove the progress sentinel
|
24235 | if ( fn === "inprogress" ) {
|
24236 | fn = queue.shift();
|
24237 | startLength--;
|
24238 | }
|
24239 |
|
24240 | if ( fn ) {
|
24241 |
|
24242 | // Add a progress sentinel to prevent the fx queue from being
|
24243 | // automatically dequeued
|
24244 | if ( type === "fx" ) {
|
24245 | queue.unshift( "inprogress" );
|
24246 | }
|
24247 |
|
24248 | // Clear up the last queue stop function
|
24249 | delete hooks.stop;
|
24250 | fn.call( elem, next, hooks );
|
24251 | }
|
24252 |
|
24253 | if ( !startLength && hooks ) {
|
24254 | hooks.empty.fire();
|
24255 | }
|
24256 | },
|
24257 |
|
24258 | // Not public - generate a queueHooks object, or return the current one
|
24259 | _queueHooks: function( elem, type ) {
|
24260 | var key = type + "queueHooks";
|
24261 | return data_priv.get( elem, key ) || data_priv.access( elem, key, {
|
24262 | empty: jQuery.Callbacks("once memory").add(function() {
|
24263 | data_priv.remove( elem, [ type + "queue", key ] );
|
24264 | })
|
24265 | });
|
24266 | }
|
24267 | });
|
24268 |
|
24269 | jQuery.fn.extend({
|
24270 | queue: function( type, data ) {
|
24271 | var setter = 2;
|
24272 |
|
24273 | if ( typeof type !== "string" ) {
|
24274 | data = type;
|
24275 | type = "fx";
|
24276 | setter--;
|
24277 | }
|
24278 |
|
24279 | if ( arguments.length < setter ) {
|
24280 | return jQuery.queue( this[0], type );
|
24281 | }
|
24282 |
|
24283 | return data === undefined ?
|
24284 | this :
|
24285 | this.each(function() {
|
24286 | var queue = jQuery.queue( this, type, data );
|
24287 |
|
24288 | // Ensure a hooks for this queue
|
24289 | jQuery._queueHooks( this, type );
|
24290 |
|
24291 | if ( type === "fx" && queue[0] !== "inprogress" ) {
|
24292 | jQuery.dequeue( this, type );
|
24293 | }
|
24294 | });
|
24295 | },
|
24296 | dequeue: function( type ) {
|
24297 | return this.each(function() {
|
24298 | jQuery.dequeue( this, type );
|
24299 | });
|
24300 | },
|
24301 | clearQueue: function( type ) {
|
24302 | return this.queue( type || "fx", [] );
|
24303 | },
|
24304 | // Get a promise resolved when queues of a certain type
|
24305 | // are emptied (fx is the type by default)
|
24306 | promise: function( type, obj ) {
|
24307 | var tmp,
|
24308 | count = 1,
|
24309 | defer = jQuery.Deferred(),
|
24310 | elements = this,
|
24311 | i = this.length,
|
24312 | resolve = function() {
|
24313 | if ( !( --count ) ) {
|
24314 | defer.resolveWith( elements, [ elements ] );
|
24315 | }
|
24316 | };
|
24317 |
|
24318 | if ( typeof type !== "string" ) {
|
24319 | obj = type;
|
24320 | type = undefined;
|
24321 | }
|
24322 | type = type || "fx";
|
24323 |
|
24324 | while ( i-- ) {
|
24325 | tmp = data_priv.get( elements[ i ], type + "queueHooks" );
|
24326 | if ( tmp && tmp.empty ) {
|
24327 | count++;
|
24328 | tmp.empty.add( resolve );
|
24329 | }
|
24330 | }
|
24331 | resolve();
|
24332 | return defer.promise( obj );
|
24333 | }
|
24334 | });
|
24335 | var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
|
24336 |
|
24337 | var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
|
24338 |
|
24339 | var isHidden = function( elem, el ) {
|
24340 | // isHidden might be called from jQuery#filter function;
|
24341 | // in that case, element will be second argument
|
24342 | elem = el || elem;
|
24343 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
|
24344 | };
|
24345 |
|
24346 | var rcheckableType = (/^(?:checkbox|radio)$/i);
|
24347 |
|
24348 |
|
24349 |
|
24350 | (function() {
|
24351 | var fragment = document.createDocumentFragment(),
|
24352 | div = fragment.appendChild( document.createElement( "div" ) ),
|
24353 | input = document.createElement( "input" );
|
24354 |
|
24355 | // Support: Safari<=5.1
|
24356 | // Check state lost if the name is set (#11217)
|
24357 | // Support: Windows Web Apps (WWA)
|
24358 | // `name` and `type` must use .setAttribute for WWA (#14901)
|
24359 | input.setAttribute( "type", "radio" );
|
24360 | input.setAttribute( "checked", "checked" );
|
24361 | input.setAttribute( "name", "t" );
|
24362 |
|
24363 | div.appendChild( input );
|
24364 |
|
24365 | // Support: Safari<=5.1, Android<4.2
|
24366 | // Older WebKit doesn't clone checked state correctly in fragments
|
24367 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
24368 |
|
24369 | // Support: IE<=11+
|
24370 | // Make sure textarea (and checkbox) defaultValue is properly cloned
|
24371 | div.innerHTML = "<textarea>x</textarea>";
|
24372 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
|
24373 | })();
|
24374 | var strundefined = typeof undefined;
|
24375 |
|
24376 |
|
24377 |
|
24378 | support.focusinBubbles = "onfocusin" in window;
|
24379 |
|
24380 |
|
24381 | var
|
24382 | rkeyEvent = /^key/,
|
24383 | rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
|
24384 | rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
24385 | rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
|
24386 |
|
24387 | function returnTrue() {
|
24388 | return true;
|
24389 | }
|
24390 |
|
24391 | function returnFalse() {
|
24392 | return false;
|
24393 | }
|
24394 |
|
24395 | function safeActiveElement() {
|
24396 | try {
|
24397 | return document.activeElement;
|
24398 | } catch ( err ) { }
|
24399 | }
|
24400 |
|
24401 | /*
|
24402 | * Helper functions for managing events -- not part of the public interface.
|
24403 | * Props to Dean Edwards' addEvent library for many of the ideas.
|
24404 | */
|
24405 | jQuery.event = {
|
24406 |
|
24407 | global: {},
|
24408 |
|
24409 | add: function( elem, types, handler, data, selector ) {
|
24410 |
|
24411 | var handleObjIn, eventHandle, tmp,
|
24412 | events, t, handleObj,
|
24413 | special, handlers, type, namespaces, origType,
|
24414 | elemData = data_priv.get( elem );
|
24415 |
|
24416 | // Don't attach events to noData or text/comment nodes (but allow plain objects)
|
24417 | if ( !elemData ) {
|
24418 | return;
|
24419 | }
|
24420 |
|
24421 | // Caller can pass in an object of custom data in lieu of the handler
|
24422 | if ( handler.handler ) {
|
24423 | handleObjIn = handler;
|
24424 | handler = handleObjIn.handler;
|
24425 | selector = handleObjIn.selector;
|
24426 | }
|
24427 |
|
24428 | // Make sure that the handler has a unique ID, used to find/remove it later
|
24429 | if ( !handler.guid ) {
|
24430 | handler.guid = jQuery.guid++;
|
24431 | }
|
24432 |
|
24433 | // Init the element's event structure and main handler, if this is the first
|
24434 | if ( !(events = elemData.events) ) {
|
24435 | events = elemData.events = {};
|
24436 | }
|
24437 | if ( !(eventHandle = elemData.handle) ) {
|
24438 | eventHandle = elemData.handle = function( e ) {
|
24439 | // Discard the second event of a jQuery.event.trigger() and
|
24440 | // when an event is called after a page has unloaded
|
24441 | return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
|
24442 | jQuery.event.dispatch.apply( elem, arguments ) : undefined;
|
24443 | };
|
24444 | }
|
24445 |
|
24446 | // Handle multiple events separated by a space
|
24447 | types = ( types || "" ).match( rnotwhite ) || [ "" ];
|
24448 | t = types.length;
|
24449 | while ( t-- ) {
|
24450 | tmp = rtypenamespace.exec( types[t] ) || [];
|
24451 | type = origType = tmp[1];
|
24452 | namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
24453 |
|
24454 | // There *must* be a type, no attaching namespace-only handlers
|
24455 | if ( !type ) {
|
24456 | continue;
|
24457 | }
|
24458 |
|
24459 | // If event changes its type, use the special event handlers for the changed type
|
24460 | special = jQuery.event.special[ type ] || {};
|
24461 |
|
24462 | // If selector defined, determine special event api type, otherwise given type
|
24463 | type = ( selector ? special.delegateType : special.bindType ) || type;
|
24464 |
|
24465 | // Update special based on newly reset type
|
24466 | special = jQuery.event.special[ type ] || {};
|
24467 |
|
24468 | // handleObj is passed to all event handlers
|
24469 | handleObj = jQuery.extend({
|
24470 | type: type,
|
24471 | origType: origType,
|
24472 | data: data,
|
24473 | handler: handler,
|
24474 | guid: handler.guid,
|
24475 | selector: selector,
|
24476 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
|
24477 | namespace: namespaces.join(".")
|
24478 | }, handleObjIn );
|
24479 |
|
24480 | // Init the event handler queue if we're the first
|
24481 | if ( !(handlers = events[ type ]) ) {
|
24482 | handlers = events[ type ] = [];
|
24483 | handlers.delegateCount = 0;
|
24484 |
|
24485 | // Only use addEventListener if the special events handler returns false
|
24486 | if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
24487 | if ( elem.addEventListener ) {
|
24488 | elem.addEventListener( type, eventHandle, false );
|
24489 | }
|
24490 | }
|
24491 | }
|
24492 |
|
24493 | if ( special.add ) {
|
24494 | special.add.call( elem, handleObj );
|
24495 |
|
24496 | if ( !handleObj.handler.guid ) {
|
24497 | handleObj.handler.guid = handler.guid;
|
24498 | }
|
24499 | }
|
24500 |
|
24501 | // Add to the element's handler list, delegates in front
|
24502 | if ( selector ) {
|
24503 | handlers.splice( handlers.delegateCount++, 0, handleObj );
|
24504 | } else {
|
24505 | handlers.push( handleObj );
|
24506 | }
|
24507 |
|
24508 | // Keep track of which events have ever been used, for event optimization
|
24509 | jQuery.event.global[ type ] = true;
|
24510 | }
|
24511 |
|
24512 | },
|
24513 |
|
24514 | // Detach an event or set of events from an element
|
24515 | remove: function( elem, types, handler, selector, mappedTypes ) {
|
24516 |
|
24517 | var j, origCount, tmp,
|
24518 | events, t, handleObj,
|
24519 | special, handlers, type, namespaces, origType,
|
24520 | elemData = data_priv.hasData( elem ) && data_priv.get( elem );
|
24521 |
|
24522 | if ( !elemData || !(events = elemData.events) ) {
|
24523 | return;
|
24524 | }
|
24525 |
|
24526 | // Once for each type.namespace in types; type may be omitted
|
24527 | types = ( types || "" ).match( rnotwhite ) || [ "" ];
|
24528 | t = types.length;
|
24529 | while ( t-- ) {
|
24530 | tmp = rtypenamespace.exec( types[t] ) || [];
|
24531 | type = origType = tmp[1];
|
24532 | namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
24533 |
|
24534 | // Unbind all events (on this namespace, if provided) for the element
|
24535 | if ( !type ) {
|
24536 | for ( type in events ) {
|
24537 | jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
|
24538 | }
|
24539 | continue;
|
24540 | }
|
24541 |
|
24542 | special = jQuery.event.special[ type ] || {};
|
24543 | type = ( selector ? special.delegateType : special.bindType ) || type;
|
24544 | handlers = events[ type ] || [];
|
24545 | tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
|
24546 |
|
24547 | // Remove matching events
|
24548 | origCount = j = handlers.length;
|
24549 | while ( j-- ) {
|
24550 | handleObj = handlers[ j ];
|
24551 |
|
24552 | if ( ( mappedTypes || origType === handleObj.origType ) &&
|
24553 | ( !handler || handler.guid === handleObj.guid ) &&
|
24554 | ( !tmp || tmp.test( handleObj.namespace ) ) &&
|
24555 | ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
|
24556 | handlers.splice( j, 1 );
|
24557 |
|
24558 | if ( handleObj.selector ) {
|
24559 | handlers.delegateCount--;
|
24560 | }
|
24561 | if ( special.remove ) {
|
24562 | special.remove.call( elem, handleObj );
|
24563 | }
|
24564 | }
|
24565 | }
|
24566 |
|
24567 | // Remove generic event handler if we removed something and no more handlers exist
|
24568 | // (avoids potential for endless recursion during removal of special event handlers)
|
24569 | if ( origCount && !handlers.length ) {
|
24570 | if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
|
24571 | jQuery.removeEvent( elem, type, elemData.handle );
|
24572 | }
|
24573 |
|
24574 | delete events[ type ];
|
24575 | }
|
24576 | }
|
24577 |
|
24578 | // Remove the expando if it's no longer used
|
24579 | if ( jQuery.isEmptyObject( events ) ) {
|
24580 | delete elemData.handle;
|
24581 | data_priv.remove( elem, "events" );
|
24582 | }
|
24583 | },
|
24584 |
|
24585 | trigger: function( event, data, elem, onlyHandlers ) {
|
24586 |
|
24587 | var i, cur, tmp, bubbleType, ontype, handle, special,
|
24588 | eventPath = [ elem || document ],
|
24589 | type = hasOwn.call( event, "type" ) ? event.type : event,
|
24590 | namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
|
24591 |
|
24592 | cur = tmp = elem = elem || document;
|
24593 |
|
24594 | // Don't do events on text and comment nodes
|
24595 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
24596 | return;
|
24597 | }
|
24598 |
|
24599 | // focus/blur morphs to focusin/out; ensure we're not firing them right now
|
24600 | if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
|
24601 | return;
|
24602 | }
|
24603 |
|
24604 | if ( type.indexOf(".") >= 0 ) {
|
24605 | // Namespaced trigger; create a regexp to match event type in handle()
|
24606 | namespaces = type.split(".");
|
24607 | type = namespaces.shift();
|
24608 | namespaces.sort();
|
24609 | }
|
24610 | ontype = type.indexOf(":") < 0 && "on" + type;
|
24611 |
|
24612 | // Caller can pass in a jQuery.Event object, Object, or just an event type string
|
24613 | event = event[ jQuery.expando ] ?
|
24614 | event :
|
24615 | new jQuery.Event( type, typeof event === "object" && event );
|
24616 |
|
24617 | // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
|
24618 | event.isTrigger = onlyHandlers ? 2 : 3;
|
24619 | event.namespace = namespaces.join(".");
|
24620 | event.namespace_re = event.namespace ?
|
24621 | new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
|
24622 | null;
|
24623 |
|
24624 | // Clean up the event in case it is being reused
|
24625 | event.result = undefined;
|
24626 | if ( !event.target ) {
|
24627 | event.target = elem;
|
24628 | }
|
24629 |
|
24630 | // Clone any incoming data and prepend the event, creating the handler arg list
|
24631 | data = data == null ?
|
24632 | [ event ] :
|
24633 | jQuery.makeArray( data, [ event ] );
|
24634 |
|
24635 | // Allow special events to draw outside the lines
|
24636 | special = jQuery.event.special[ type ] || {};
|
24637 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
|
24638 | return;
|
24639 | }
|
24640 |
|
24641 | // Determine event propagation path in advance, per W3C events spec (#9951)
|
24642 | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
24643 | if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
|
24644 |
|
24645 | bubbleType = special.delegateType || type;
|
24646 | if ( !rfocusMorph.test( bubbleType + type ) ) {
|
24647 | cur = cur.parentNode;
|
24648 | }
|
24649 | for ( ; cur; cur = cur.parentNode ) {
|
24650 | eventPath.push( cur );
|
24651 | tmp = cur;
|
24652 | }
|
24653 |
|
24654 | // Only add window if we got to document (e.g., not plain obj or detached DOM)
|
24655 | if ( tmp === (elem.ownerDocument || document) ) {
|
24656 | eventPath.push( tmp.defaultView || tmp.parentWindow || window );
|
24657 | }
|
24658 | }
|
24659 |
|
24660 | // Fire handlers on the event path
|
24661 | i = 0;
|
24662 | while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
|
24663 |
|
24664 | event.type = i > 1 ?
|
24665 | bubbleType :
|
24666 | special.bindType || type;
|
24667 |
|
24668 | // jQuery handler
|
24669 | handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
|
24670 | if ( handle ) {
|
24671 | handle.apply( cur, data );
|
24672 | }
|
24673 |
|
24674 | // Native handler
|
24675 | handle = ontype && cur[ ontype ];
|
24676 | if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
|
24677 | event.result = handle.apply( cur, data );
|
24678 | if ( event.result === false ) {
|
24679 | event.preventDefault();
|
24680 | }
|
24681 | }
|
24682 | }
|
24683 | event.type = type;
|
24684 |
|
24685 | // If nobody prevented the default action, do it now
|
24686 | if ( !onlyHandlers && !event.isDefaultPrevented() ) {
|
24687 |
|
24688 | if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
|
24689 | jQuery.acceptData( elem ) ) {
|
24690 |
|
24691 | // Call a native DOM method on the target with the same name name as the event.
|
24692 | // Don't do default actions on window, that's where global variables be (#6170)
|
24693 | if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
|
24694 |
|
24695 | // Don't re-trigger an onFOO event when we call its FOO() method
|
24696 | tmp = elem[ ontype ];
|
24697 |
|
24698 | if ( tmp ) {
|
24699 | elem[ ontype ] = null;
|
24700 | }
|
24701 |
|
24702 | // Prevent re-triggering of the same event, since we already bubbled it above
|
24703 | jQuery.event.triggered = type;
|
24704 | elem[ type ]();
|
24705 | jQuery.event.triggered = undefined;
|
24706 |
|
24707 | if ( tmp ) {
|
24708 | elem[ ontype ] = tmp;
|
24709 | }
|
24710 | }
|
24711 | }
|
24712 | }
|
24713 |
|
24714 | return event.result;
|
24715 | },
|
24716 |
|
24717 | dispatch: function( event ) {
|
24718 |
|
24719 | // Make a writable jQuery.Event from the native event object
|
24720 | event = jQuery.event.fix( event );
|
24721 |
|
24722 | var i, j, ret, matched, handleObj,
|
24723 | handlerQueue = [],
|
24724 | args = slice.call( arguments ),
|
24725 | handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
|
24726 | special = jQuery.event.special[ event.type ] || {};
|
24727 |
|
24728 | // Use the fix-ed jQuery.Event rather than the (read-only) native event
|
24729 | args[0] = event;
|
24730 | event.delegateTarget = this;
|
24731 |
|
24732 | // Call the preDispatch hook for the mapped type, and let it bail if desired
|
24733 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
24734 | return;
|
24735 | }
|
24736 |
|
24737 | // Determine handlers
|
24738 | handlerQueue = jQuery.event.handlers.call( this, event, handlers );
|
24739 |
|
24740 | // Run delegates first; they may want to stop propagation beneath us
|
24741 | i = 0;
|
24742 | while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
|
24743 | event.currentTarget = matched.elem;
|
24744 |
|
24745 | j = 0;
|
24746 | while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
|
24747 |
|
24748 | // Triggered event must either 1) have no namespace, or 2) have namespace(s)
|
24749 | // a subset or equal to those in the bound event (both can have no namespace).
|
24750 | if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
|
24751 |
|
24752 | event.handleObj = handleObj;
|
24753 | event.data = handleObj.data;
|
24754 |
|
24755 | ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
|
24756 | .apply( matched.elem, args );
|
24757 |
|
24758 | if ( ret !== undefined ) {
|
24759 | if ( (event.result = ret) === false ) {
|
24760 | event.preventDefault();
|
24761 | event.stopPropagation();
|
24762 | }
|
24763 | }
|
24764 | }
|
24765 | }
|
24766 | }
|
24767 |
|
24768 | // Call the postDispatch hook for the mapped type
|
24769 | if ( special.postDispatch ) {
|
24770 | special.postDispatch.call( this, event );
|
24771 | }
|
24772 |
|
24773 | return event.result;
|
24774 | },
|
24775 |
|
24776 | handlers: function( event, handlers ) {
|
24777 | var i, matches, sel, handleObj,
|
24778 | handlerQueue = [],
|
24779 | delegateCount = handlers.delegateCount,
|
24780 | cur = event.target;
|
24781 |
|
24782 | // Find delegate handlers
|
24783 | // Black-hole SVG <use> instance trees (#13180)
|
24784 | // Avoid non-left-click bubbling in Firefox (#3861)
|
24785 | if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
|
24786 |
|
24787 | for ( ; cur !== this; cur = cur.parentNode || this ) {
|
24788 |
|
24789 | // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
|
24790 | if ( cur.disabled !== true || event.type !== "click" ) {
|
24791 | matches = [];
|
24792 | for ( i = 0; i < delegateCount; i++ ) {
|
24793 | handleObj = handlers[ i ];
|
24794 |
|
24795 | // Don't conflict with Object.prototype properties (#13203)
|
24796 | sel = handleObj.selector + " ";
|
24797 |
|
24798 | if ( matches[ sel ] === undefined ) {
|
24799 | matches[ sel ] = handleObj.needsContext ?
|
24800 | jQuery( sel, this ).index( cur ) >= 0 :
|
24801 | jQuery.find( sel, this, null, [ cur ] ).length;
|
24802 | }
|
24803 | if ( matches[ sel ] ) {
|
24804 | matches.push( handleObj );
|
24805 | }
|
24806 | }
|
24807 | if ( matches.length ) {
|
24808 | handlerQueue.push({ elem: cur, handlers: matches });
|
24809 | }
|
24810 | }
|
24811 | }
|
24812 | }
|
24813 |
|
24814 | // Add the remaining (directly-bound) handlers
|
24815 | if ( delegateCount < handlers.length ) {
|
24816 | handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
|
24817 | }
|
24818 |
|
24819 | return handlerQueue;
|
24820 | },
|
24821 |
|
24822 | // Includes some event props shared by KeyEvent and MouseEvent
|
24823 | props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
|
24824 |
|
24825 | fixHooks: {},
|
24826 |
|
24827 | keyHooks: {
|
24828 | props: "char charCode key keyCode".split(" "),
|
24829 | filter: function( event, original ) {
|
24830 |
|
24831 | // Add which for key events
|
24832 | if ( event.which == null ) {
|
24833 | event.which = original.charCode != null ? original.charCode : original.keyCode;
|
24834 | }
|
24835 |
|
24836 | return event;
|
24837 | }
|
24838 | },
|
24839 |
|
24840 | mouseHooks: {
|
24841 | props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
|
24842 | filter: function( event, original ) {
|
24843 | var eventDoc, doc, body,
|
24844 | button = original.button;
|
24845 |
|
24846 | // Calculate pageX/Y if missing and clientX/Y available
|
24847 | if ( event.pageX == null && original.clientX != null ) {
|
24848 | eventDoc = event.target.ownerDocument || document;
|
24849 | doc = eventDoc.documentElement;
|
24850 | body = eventDoc.body;
|
24851 |
|
24852 | event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
|
24853 | event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
|
24854 | }
|
24855 |
|
24856 | // Add which for click: 1 === left; 2 === middle; 3 === right
|
24857 | // Note: button is not normalized, so don't use it
|
24858 | if ( !event.which && button !== undefined ) {
|
24859 | event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
24860 | }
|
24861 |
|
24862 | return event;
|
24863 | }
|
24864 | },
|
24865 |
|
24866 | fix: function( event ) {
|
24867 | if ( event[ jQuery.expando ] ) {
|
24868 | return event;
|
24869 | }
|
24870 |
|
24871 | // Create a writable copy of the event object and normalize some properties
|
24872 | var i, prop, copy,
|
24873 | type = event.type,
|
24874 | originalEvent = event,
|
24875 | fixHook = this.fixHooks[ type ];
|
24876 |
|
24877 | if ( !fixHook ) {
|
24878 | this.fixHooks[ type ] = fixHook =
|
24879 | rmouseEvent.test( type ) ? this.mouseHooks :
|
24880 | rkeyEvent.test( type ) ? this.keyHooks :
|
24881 | {};
|
24882 | }
|
24883 | copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
|
24884 |
|
24885 | event = new jQuery.Event( originalEvent );
|
24886 |
|
24887 | i = copy.length;
|
24888 | while ( i-- ) {
|
24889 | prop = copy[ i ];
|
24890 | event[ prop ] = originalEvent[ prop ];
|
24891 | }
|
24892 |
|
24893 | // Support: Cordova 2.5 (WebKit) (#13255)
|
24894 | // All events should have a target; Cordova deviceready doesn't
|
24895 | if ( !event.target ) {
|
24896 | event.target = document;
|
24897 | }
|
24898 |
|
24899 | // Support: Safari 6.0+, Chrome<28
|
24900 | // Target should not be a text node (#504, #13143)
|
24901 | if ( event.target.nodeType === 3 ) {
|
24902 | event.target = event.target.parentNode;
|
24903 | }
|
24904 |
|
24905 | return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
24906 | },
|
24907 |
|
24908 | special: {
|
24909 | load: {
|
24910 | // Prevent triggered image.load events from bubbling to window.load
|
24911 | noBubble: true
|
24912 | },
|
24913 | focus: {
|
24914 | // Fire native event if possible so blur/focus sequence is correct
|
24915 | trigger: function() {
|
24916 | if ( this !== safeActiveElement() && this.focus ) {
|
24917 | this.focus();
|
24918 | return false;
|
24919 | }
|
24920 | },
|
24921 | delegateType: "focusin"
|
24922 | },
|
24923 | blur: {
|
24924 | trigger: function() {
|
24925 | if ( this === safeActiveElement() && this.blur ) {
|
24926 | this.blur();
|
24927 | return false;
|
24928 | }
|
24929 | },
|
24930 | delegateType: "focusout"
|
24931 | },
|
24932 | click: {
|
24933 | // For checkbox, fire native event so checked state will be right
|
24934 | trigger: function() {
|
24935 | if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
|
24936 | this.click();
|
24937 | return false;
|
24938 | }
|
24939 | },
|
24940 |
|
24941 | // For cross-browser consistency, don't fire native .click() on links
|
24942 | _default: function( event ) {
|
24943 | return jQuery.nodeName( event.target, "a" );
|
24944 | }
|
24945 | },
|
24946 |
|
24947 | beforeunload: {
|
24948 | postDispatch: function( event ) {
|
24949 |
|
24950 | // Support: Firefox 20+
|
24951 | // Firefox doesn't alert if the returnValue field is not set.
|
24952 | if ( event.result !== undefined && event.originalEvent ) {
|
24953 | event.originalEvent.returnValue = event.result;
|
24954 | }
|
24955 | }
|
24956 | }
|
24957 | },
|
24958 |
|
24959 | simulate: function( type, elem, event, bubble ) {
|
24960 | // Piggyback on a donor event to simulate a different one.
|
24961 | // Fake originalEvent to avoid donor's stopPropagation, but if the
|
24962 | // simulated event prevents default then we do the same on the donor.
|
24963 | var e = jQuery.extend(
|
24964 | new jQuery.Event(),
|
24965 | event,
|
24966 | {
|
24967 | type: type,
|
24968 | isSimulated: true,
|
24969 | originalEvent: {}
|
24970 | }
|
24971 | );
|
24972 | if ( bubble ) {
|
24973 | jQuery.event.trigger( e, null, elem );
|
24974 | } else {
|
24975 | jQuery.event.dispatch.call( elem, e );
|
24976 | }
|
24977 | if ( e.isDefaultPrevented() ) {
|
24978 | event.preventDefault();
|
24979 | }
|
24980 | }
|
24981 | };
|
24982 |
|
24983 | jQuery.removeEvent = function( elem, type, handle ) {
|
24984 | if ( elem.removeEventListener ) {
|
24985 | elem.removeEventListener( type, handle, false );
|
24986 | }
|
24987 | };
|
24988 |
|
24989 | jQuery.Event = function( src, props ) {
|
24990 | // Allow instantiation without the 'new' keyword
|
24991 | if ( !(this instanceof jQuery.Event) ) {
|
24992 | return new jQuery.Event( src, props );
|
24993 | }
|
24994 |
|
24995 | // Event object
|
24996 | if ( src && src.type ) {
|
24997 | this.originalEvent = src;
|
24998 | this.type = src.type;
|
24999 |
|
25000 | // Events bubbling up the document may have been marked as prevented
|
25001 | // by a handler lower down the tree; reflect the correct value.
|
25002 | this.isDefaultPrevented = src.defaultPrevented ||
|
25003 | src.defaultPrevented === undefined &&
|
25004 | // Support: Android<4.0
|
25005 | src.returnValue === false ?
|
25006 | returnTrue :
|
25007 | returnFalse;
|
25008 |
|
25009 | // Event type
|
25010 | } else {
|
25011 | this.type = src;
|
25012 | }
|
25013 |
|
25014 | // Put explicitly provided properties onto the event object
|
25015 | if ( props ) {
|
25016 | jQuery.extend( this, props );
|
25017 | }
|
25018 |
|
25019 | // Create a timestamp if incoming event doesn't have one
|
25020 | this.timeStamp = src && src.timeStamp || jQuery.now();
|
25021 |
|
25022 | // Mark it as fixed
|
25023 | this[ jQuery.expando ] = true;
|
25024 | };
|
25025 |
|
25026 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
25027 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
25028 | jQuery.Event.prototype = {
|
25029 | isDefaultPrevented: returnFalse,
|
25030 | isPropagationStopped: returnFalse,
|
25031 | isImmediatePropagationStopped: returnFalse,
|
25032 |
|
25033 | preventDefault: function() {
|
25034 | var e = this.originalEvent;
|
25035 |
|
25036 | this.isDefaultPrevented = returnTrue;
|
25037 |
|
25038 | if ( e && e.preventDefault ) {
|
25039 | e.preventDefault();
|
25040 | }
|
25041 | },
|
25042 | stopPropagation: function() {
|
25043 | var e = this.originalEvent;
|
25044 |
|
25045 | this.isPropagationStopped = returnTrue;
|
25046 |
|
25047 | if ( e && e.stopPropagation ) {
|
25048 | e.stopPropagation();
|
25049 | }
|
25050 | },
|
25051 | stopImmediatePropagation: function() {
|
25052 | var e = this.originalEvent;
|
25053 |
|
25054 | this.isImmediatePropagationStopped = returnTrue;
|
25055 |
|
25056 | if ( e && e.stopImmediatePropagation ) {
|
25057 | e.stopImmediatePropagation();
|
25058 | }
|
25059 |
|
25060 | this.stopPropagation();
|
25061 | }
|
25062 | };
|
25063 |
|
25064 | // Create mouseenter/leave events using mouseover/out and event-time checks
|
25065 | // Support: Chrome 15+
|
25066 | jQuery.each({
|
25067 | mouseenter: "mouseover",
|
25068 | mouseleave: "mouseout",
|
25069 | pointerenter: "pointerover",
|
25070 | pointerleave: "pointerout"
|
25071 | }, function( orig, fix ) {
|
25072 | jQuery.event.special[ orig ] = {
|
25073 | delegateType: fix,
|
25074 | bindType: fix,
|
25075 |
|
25076 | handle: function( event ) {
|
25077 | var ret,
|
25078 | target = this,
|
25079 | related = event.relatedTarget,
|
25080 | handleObj = event.handleObj;
|
25081 |
|
25082 | // For mousenter/leave call the handler if related is outside the target.
|
25083 | // NB: No relatedTarget if the mouse left/entered the browser window
|
25084 | if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
|
25085 | event.type = handleObj.origType;
|
25086 | ret = handleObj.handler.apply( this, arguments );
|
25087 | event.type = fix;
|
25088 | }
|
25089 | return ret;
|
25090 | }
|
25091 | };
|
25092 | });
|
25093 |
|
25094 | // Support: Firefox, Chrome, Safari
|
25095 | // Create "bubbling" focus and blur events
|
25096 | if ( !support.focusinBubbles ) {
|
25097 | jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
25098 |
|
25099 | // Attach a single capturing handler on the document while someone wants focusin/focusout
|
25100 | var handler = function( event ) {
|
25101 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
|
25102 | };
|
25103 |
|
25104 | jQuery.event.special[ fix ] = {
|
25105 | setup: function() {
|
25106 | var doc = this.ownerDocument || this,
|
25107 | attaches = data_priv.access( doc, fix );
|
25108 |
|
25109 | if ( !attaches ) {
|
25110 | doc.addEventListener( orig, handler, true );
|
25111 | }
|
25112 | data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
|
25113 | },
|
25114 | teardown: function() {
|
25115 | var doc = this.ownerDocument || this,
|
25116 | attaches = data_priv.access( doc, fix ) - 1;
|
25117 |
|
25118 | if ( !attaches ) {
|
25119 | doc.removeEventListener( orig, handler, true );
|
25120 | data_priv.remove( doc, fix );
|
25121 |
|
25122 | } else {
|
25123 | data_priv.access( doc, fix, attaches );
|
25124 | }
|
25125 | }
|
25126 | };
|
25127 | });
|
25128 | }
|
25129 |
|
25130 | jQuery.fn.extend({
|
25131 |
|
25132 | on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
|
25133 | var origFn, type;
|
25134 |
|
25135 | // Types can be a map of types/handlers
|
25136 | if ( typeof types === "object" ) {
|
25137 | // ( types-Object, selector, data )
|
25138 | if ( typeof selector !== "string" ) {
|
25139 | // ( types-Object, data )
|
25140 | data = data || selector;
|
25141 | selector = undefined;
|
25142 | }
|
25143 | for ( type in types ) {
|
25144 | this.on( type, selector, data, types[ type ], one );
|
25145 | }
|
25146 | return this;
|
25147 | }
|
25148 |
|
25149 | if ( data == null && fn == null ) {
|
25150 | // ( types, fn )
|
25151 | fn = selector;
|
25152 | data = selector = undefined;
|
25153 | } else if ( fn == null ) {
|
25154 | if ( typeof selector === "string" ) {
|
25155 | // ( types, selector, fn )
|
25156 | fn = data;
|
25157 | data = undefined;
|
25158 | } else {
|
25159 | // ( types, data, fn )
|
25160 | fn = data;
|
25161 | data = selector;
|
25162 | selector = undefined;
|
25163 | }
|
25164 | }
|
25165 | if ( fn === false ) {
|
25166 | fn = returnFalse;
|
25167 | } else if ( !fn ) {
|
25168 | return this;
|
25169 | }
|
25170 |
|
25171 | if ( one === 1 ) {
|
25172 | origFn = fn;
|
25173 | fn = function( event ) {
|
25174 | // Can use an empty set, since event contains the info
|
25175 | jQuery().off( event );
|
25176 | return origFn.apply( this, arguments );
|
25177 | };
|
25178 | // Use same guid so caller can remove using origFn
|
25179 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
|
25180 | }
|
25181 | return this.each( function() {
|
25182 | jQuery.event.add( this, types, fn, data, selector );
|
25183 | });
|
25184 | },
|
25185 | one: function( types, selector, data, fn ) {
|
25186 | return this.on( types, selector, data, fn, 1 );
|
25187 | },
|
25188 | off: function( types, selector, fn ) {
|
25189 | var handleObj, type;
|
25190 | if ( types && types.preventDefault && types.handleObj ) {
|
25191 | // ( event ) dispatched jQuery.Event
|
25192 | handleObj = types.handleObj;
|
25193 | jQuery( types.delegateTarget ).off(
|
25194 | handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
|
25195 | handleObj.selector,
|
25196 | handleObj.handler
|
25197 | );
|
25198 | return this;
|
25199 | }
|
25200 | if ( typeof types === "object" ) {
|
25201 | // ( types-object [, selector] )
|
25202 | for ( type in types ) {
|
25203 | this.off( type, selector, types[ type ] );
|
25204 | }
|
25205 | return this;
|
25206 | }
|
25207 | if ( selector === false || typeof selector === "function" ) {
|
25208 | // ( types [, fn] )
|
25209 | fn = selector;
|
25210 | selector = undefined;
|
25211 | }
|
25212 | if ( fn === false ) {
|
25213 | fn = returnFalse;
|
25214 | }
|
25215 | return this.each(function() {
|
25216 | jQuery.event.remove( this, types, fn, selector );
|
25217 | });
|
25218 | },
|
25219 |
|
25220 | trigger: function( type, data ) {
|
25221 | return this.each(function() {
|
25222 | jQuery.event.trigger( type, data, this );
|
25223 | });
|
25224 | },
|
25225 | triggerHandler: function( type, data ) {
|
25226 | var elem = this[0];
|
25227 | if ( elem ) {
|
25228 | return jQuery.event.trigger( type, data, elem, true );
|
25229 | }
|
25230 | }
|
25231 | });
|
25232 |
|
25233 |
|
25234 | var
|
25235 | rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
|
25236 | rtagName = /<([\w:]+)/,
|
25237 | rhtml = /<|&#?\w+;/,
|
25238 | rnoInnerhtml = /<(?:script|style|link)/i,
|
25239 | // checked="checked" or checked
|
25240 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
|
25241 | rscriptType = /^$|\/(?:java|ecma)script/i,
|
25242 | rscriptTypeMasked = /^true\/(.*)/,
|
25243 | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
|
25244 |
|
25245 | // We have to close these tags to support XHTML (#13200)
|
25246 | wrapMap = {
|
25247 |
|
25248 | // Support: IE9
|
25249 | option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
25250 |
|
25251 | thead: [ 1, "<table>", "</table>" ],
|
25252 | col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
25253 | tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
25254 | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
25255 |
|
25256 | _default: [ 0, "", "" ]
|
25257 | };
|
25258 |
|
25259 | // Support: IE9
|
25260 | wrapMap.optgroup = wrapMap.option;
|
25261 |
|
25262 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
25263 | wrapMap.th = wrapMap.td;
|
25264 |
|
25265 | // Support: 1.x compatibility
|
25266 | // Manipulating tables requires a tbody
|
25267 | function manipulationTarget( elem, content ) {
|
25268 | return jQuery.nodeName( elem, "table" ) &&
|
25269 | jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
|
25270 |
|
25271 | elem.getElementsByTagName("tbody")[0] ||
|
25272 | elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
|
25273 | elem;
|
25274 | }
|
25275 |
|
25276 | // Replace/restore the type attribute of script elements for safe DOM manipulation
|
25277 | function disableScript( elem ) {
|
25278 | elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
|
25279 | return elem;
|
25280 | }
|
25281 | function restoreScript( elem ) {
|
25282 | var match = rscriptTypeMasked.exec( elem.type );
|
25283 |
|
25284 | if ( match ) {
|
25285 | elem.type = match[ 1 ];
|
25286 | } else {
|
25287 | elem.removeAttribute("type");
|
25288 | }
|
25289 |
|
25290 | return elem;
|
25291 | }
|
25292 |
|
25293 | // Mark scripts as having already been evaluated
|
25294 | function setGlobalEval( elems, refElements ) {
|
25295 | var i = 0,
|
25296 | l = elems.length;
|
25297 |
|
25298 | for ( ; i < l; i++ ) {
|
25299 | data_priv.set(
|
25300 | elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
|
25301 | );
|
25302 | }
|
25303 | }
|
25304 |
|
25305 | function cloneCopyEvent( src, dest ) {
|
25306 | var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
|
25307 |
|
25308 | if ( dest.nodeType !== 1 ) {
|
25309 | return;
|
25310 | }
|
25311 |
|
25312 | // 1. Copy private data: events, handlers, etc.
|
25313 | if ( data_priv.hasData( src ) ) {
|
25314 | pdataOld = data_priv.access( src );
|
25315 | pdataCur = data_priv.set( dest, pdataOld );
|
25316 | events = pdataOld.events;
|
25317 |
|
25318 | if ( events ) {
|
25319 | delete pdataCur.handle;
|
25320 | pdataCur.events = {};
|
25321 |
|
25322 | for ( type in events ) {
|
25323 | for ( i = 0, l = events[ type ].length; i < l; i++ ) {
|
25324 | jQuery.event.add( dest, type, events[ type ][ i ] );
|
25325 | }
|
25326 | }
|
25327 | }
|
25328 | }
|
25329 |
|
25330 | // 2. Copy user data
|
25331 | if ( data_user.hasData( src ) ) {
|
25332 | udataOld = data_user.access( src );
|
25333 | udataCur = jQuery.extend( {}, udataOld );
|
25334 |
|
25335 | data_user.set( dest, udataCur );
|
25336 | }
|
25337 | }
|
25338 |
|
25339 | function getAll( context, tag ) {
|
25340 | var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
|
25341 | context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
|
25342 | [];
|
25343 |
|
25344 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
|
25345 | jQuery.merge( [ context ], ret ) :
|
25346 | ret;
|
25347 | }
|
25348 |
|
25349 | // Fix IE bugs, see support tests
|
25350 | function fixInput( src, dest ) {
|
25351 | var nodeName = dest.nodeName.toLowerCase();
|
25352 |
|
25353 | // Fails to persist the checked state of a cloned checkbox or radio button.
|
25354 | if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
|
25355 | dest.checked = src.checked;
|
25356 |
|
25357 | // Fails to return the selected option to the default selected state when cloning options
|
25358 | } else if ( nodeName === "input" || nodeName === "textarea" ) {
|
25359 | dest.defaultValue = src.defaultValue;
|
25360 | }
|
25361 | }
|
25362 |
|
25363 | jQuery.extend({
|
25364 | clone: function( elem, dataAndEvents, deepDataAndEvents ) {
|
25365 | var i, l, srcElements, destElements,
|
25366 | clone = elem.cloneNode( true ),
|
25367 | inPage = jQuery.contains( elem.ownerDocument, elem );
|
25368 |
|
25369 | // Fix IE cloning issues
|
25370 | if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
|
25371 | !jQuery.isXMLDoc( elem ) ) {
|
25372 |
|
25373 | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
25374 | destElements = getAll( clone );
|
25375 | srcElements = getAll( elem );
|
25376 |
|
25377 | for ( i = 0, l = srcElements.length; i < l; i++ ) {
|
25378 | fixInput( srcElements[ i ], destElements[ i ] );
|
25379 | }
|
25380 | }
|
25381 |
|
25382 | // Copy the events from the original to the clone
|
25383 | if ( dataAndEvents ) {
|
25384 | if ( deepDataAndEvents ) {
|
25385 | srcElements = srcElements || getAll( elem );
|
25386 | destElements = destElements || getAll( clone );
|
25387 |
|
25388 | for ( i = 0, l = srcElements.length; i < l; i++ ) {
|
25389 | cloneCopyEvent( srcElements[ i ], destElements[ i ] );
|
25390 | }
|
25391 | } else {
|
25392 | cloneCopyEvent( elem, clone );
|
25393 | }
|
25394 | }
|
25395 |
|
25396 | // Preserve script evaluation history
|
25397 | destElements = getAll( clone, "script" );
|
25398 | if ( destElements.length > 0 ) {
|
25399 | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
|
25400 | }
|
25401 |
|
25402 | // Return the cloned set
|
25403 | return clone;
|
25404 | },
|
25405 |
|
25406 | buildFragment: function( elems, context, scripts, selection ) {
|
25407 | var elem, tmp, tag, wrap, contains, j,
|
25408 | fragment = context.createDocumentFragment(),
|
25409 | nodes = [],
|
25410 | i = 0,
|
25411 | l = elems.length;
|
25412 |
|
25413 | for ( ; i < l; i++ ) {
|
25414 | elem = elems[ i ];
|
25415 |
|
25416 | if ( elem || elem === 0 ) {
|
25417 |
|
25418 | // Add nodes directly
|
25419 | if ( jQuery.type( elem ) === "object" ) {
|
25420 | // Support: QtWebKit, PhantomJS
|
25421 | // push.apply(_, arraylike) throws on ancient WebKit
|
25422 | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
|
25423 |
|
25424 | // Convert non-html into a text node
|
25425 | } else if ( !rhtml.test( elem ) ) {
|
25426 | nodes.push( context.createTextNode( elem ) );
|
25427 |
|
25428 | // Convert html into DOM nodes
|
25429 | } else {
|
25430 | tmp = tmp || fragment.appendChild( context.createElement("div") );
|
25431 |
|
25432 | // Deserialize a standard representation
|
25433 | tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
|
25434 | wrap = wrapMap[ tag ] || wrapMap._default;
|
25435 | tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
|
25436 |
|
25437 | // Descend through wrappers to the right content
|
25438 | j = wrap[ 0 ];
|
25439 | while ( j-- ) {
|
25440 | tmp = tmp.lastChild;
|
25441 | }
|
25442 |
|
25443 | // Support: QtWebKit, PhantomJS
|
25444 | // push.apply(_, arraylike) throws on ancient WebKit
|
25445 | jQuery.merge( nodes, tmp.childNodes );
|
25446 |
|
25447 | // Remember the top-level container
|
25448 | tmp = fragment.firstChild;
|
25449 |
|
25450 | // Ensure the created nodes are orphaned (#12392)
|
25451 | tmp.textContent = "";
|
25452 | }
|
25453 | }
|
25454 | }
|
25455 |
|
25456 | // Remove wrapper from fragment
|
25457 | fragment.textContent = "";
|
25458 |
|
25459 | i = 0;
|
25460 | while ( (elem = nodes[ i++ ]) ) {
|
25461 |
|
25462 | // #4087 - If origin and destination elements are the same, and this is
|
25463 | // that element, do not do anything
|
25464 | if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
|
25465 | continue;
|
25466 | }
|
25467 |
|
25468 | contains = jQuery.contains( elem.ownerDocument, elem );
|
25469 |
|
25470 | // Append to fragment
|
25471 | tmp = getAll( fragment.appendChild( elem ), "script" );
|
25472 |
|
25473 | // Preserve script evaluation history
|
25474 | if ( contains ) {
|
25475 | setGlobalEval( tmp );
|
25476 | }
|
25477 |
|
25478 | // Capture executables
|
25479 | if ( scripts ) {
|
25480 | j = 0;
|
25481 | while ( (elem = tmp[ j++ ]) ) {
|
25482 | if ( rscriptType.test( elem.type || "" ) ) {
|
25483 | scripts.push( elem );
|
25484 | }
|
25485 | }
|
25486 | }
|
25487 | }
|
25488 |
|
25489 | return fragment;
|
25490 | },
|
25491 |
|
25492 | cleanData: function( elems ) {
|
25493 | var data, elem, type, key,
|
25494 | special = jQuery.event.special,
|
25495 | i = 0;
|
25496 |
|
25497 | for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
|
25498 | if ( jQuery.acceptData( elem ) ) {
|
25499 | key = elem[ data_priv.expando ];
|
25500 |
|
25501 | if ( key && (data = data_priv.cache[ key ]) ) {
|
25502 | if ( data.events ) {
|
25503 | for ( type in data.events ) {
|
25504 | if ( special[ type ] ) {
|
25505 | jQuery.event.remove( elem, type );
|
25506 |
|
25507 | // This is a shortcut to avoid jQuery.event.remove's overhead
|
25508 | } else {
|
25509 | jQuery.removeEvent( elem, type, data.handle );
|
25510 | }
|
25511 | }
|
25512 | }
|
25513 | if ( data_priv.cache[ key ] ) {
|
25514 | // Discard any remaining `private` data
|
25515 | delete data_priv.cache[ key ];
|
25516 | }
|
25517 | }
|
25518 | }
|
25519 | // Discard any remaining `user` data
|
25520 | delete data_user.cache[ elem[ data_user.expando ] ];
|
25521 | }
|
25522 | }
|
25523 | });
|
25524 |
|
25525 | jQuery.fn.extend({
|
25526 | text: function( value ) {
|
25527 | return access( this, function( value ) {
|
25528 | return value === undefined ?
|
25529 | jQuery.text( this ) :
|
25530 | this.empty().each(function() {
|
25531 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
25532 | this.textContent = value;
|
25533 | }
|
25534 | });
|
25535 | }, null, value, arguments.length );
|
25536 | },
|
25537 |
|
25538 | append: function() {
|
25539 | return this.domManip( arguments, function( elem ) {
|
25540 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
25541 | var target = manipulationTarget( this, elem );
|
25542 | target.appendChild( elem );
|
25543 | }
|
25544 | });
|
25545 | },
|
25546 |
|
25547 | prepend: function() {
|
25548 | return this.domManip( arguments, function( elem ) {
|
25549 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
25550 | var target = manipulationTarget( this, elem );
|
25551 | target.insertBefore( elem, target.firstChild );
|
25552 | }
|
25553 | });
|
25554 | },
|
25555 |
|
25556 | before: function() {
|
25557 | return this.domManip( arguments, function( elem ) {
|
25558 | if ( this.parentNode ) {
|
25559 | this.parentNode.insertBefore( elem, this );
|
25560 | }
|
25561 | });
|
25562 | },
|
25563 |
|
25564 | after: function() {
|
25565 | return this.domManip( arguments, function( elem ) {
|
25566 | if ( this.parentNode ) {
|
25567 | this.parentNode.insertBefore( elem, this.nextSibling );
|
25568 | }
|
25569 | });
|
25570 | },
|
25571 |
|
25572 | remove: function( selector, keepData /* Internal Use Only */ ) {
|
25573 | var elem,
|
25574 | elems = selector ? jQuery.filter( selector, this ) : this,
|
25575 | i = 0;
|
25576 |
|
25577 | for ( ; (elem = elems[i]) != null; i++ ) {
|
25578 | if ( !keepData && elem.nodeType === 1 ) {
|
25579 | jQuery.cleanData( getAll( elem ) );
|
25580 | }
|
25581 |
|
25582 | if ( elem.parentNode ) {
|
25583 | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
|
25584 | setGlobalEval( getAll( elem, "script" ) );
|
25585 | }
|
25586 | elem.parentNode.removeChild( elem );
|
25587 | }
|
25588 | }
|
25589 |
|
25590 | return this;
|
25591 | },
|
25592 |
|
25593 | empty: function() {
|
25594 | var elem,
|
25595 | i = 0;
|
25596 |
|
25597 | for ( ; (elem = this[i]) != null; i++ ) {
|
25598 | if ( elem.nodeType === 1 ) {
|
25599 |
|
25600 | // Prevent memory leaks
|
25601 | jQuery.cleanData( getAll( elem, false ) );
|
25602 |
|
25603 | // Remove any remaining nodes
|
25604 | elem.textContent = "";
|
25605 | }
|
25606 | }
|
25607 |
|
25608 | return this;
|
25609 | },
|
25610 |
|
25611 | clone: function( dataAndEvents, deepDataAndEvents ) {
|
25612 | dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
|
25613 | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
|
25614 |
|
25615 | return this.map(function() {
|
25616 | return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
|
25617 | });
|
25618 | },
|
25619 |
|
25620 | html: function( value ) {
|
25621 | return access( this, function( value ) {
|
25622 | var elem = this[ 0 ] || {},
|
25623 | i = 0,
|
25624 | l = this.length;
|
25625 |
|
25626 | if ( value === undefined && elem.nodeType === 1 ) {
|
25627 | return elem.innerHTML;
|
25628 | }
|
25629 |
|
25630 | // See if we can take a shortcut and just use innerHTML
|
25631 | if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
|
25632 | !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
|
25633 |
|
25634 | value = value.replace( rxhtmlTag, "<$1></$2>" );
|
25635 |
|
25636 | try {
|
25637 | for ( ; i < l; i++ ) {
|
25638 | elem = this[ i ] || {};
|
25639 |
|
25640 | // Remove element nodes and prevent memory leaks
|
25641 | if ( elem.nodeType === 1 ) {
|
25642 | jQuery.cleanData( getAll( elem, false ) );
|
25643 | elem.innerHTML = value;
|
25644 | }
|
25645 | }
|
25646 |
|
25647 | elem = 0;
|
25648 |
|
25649 | // If using innerHTML throws an exception, use the fallback method
|
25650 | } catch( e ) {}
|
25651 | }
|
25652 |
|
25653 | if ( elem ) {
|
25654 | this.empty().append( value );
|
25655 | }
|
25656 | }, null, value, arguments.length );
|
25657 | },
|
25658 |
|
25659 | replaceWith: function() {
|
25660 | var arg = arguments[ 0 ];
|
25661 |
|
25662 | // Make the changes, replacing each context element with the new content
|
25663 | this.domManip( arguments, function( elem ) {
|
25664 | arg = this.parentNode;
|
25665 |
|
25666 | jQuery.cleanData( getAll( this ) );
|
25667 |
|
25668 | if ( arg ) {
|
25669 | arg.replaceChild( elem, this );
|
25670 | }
|
25671 | });
|
25672 |
|
25673 | // Force removal if there was no new content (e.g., from empty arguments)
|
25674 | return arg && (arg.length || arg.nodeType) ? this : this.remove();
|
25675 | },
|
25676 |
|
25677 | detach: function( selector ) {
|
25678 | return this.remove( selector, true );
|
25679 | },
|
25680 |
|
25681 | domManip: function( args, callback ) {
|
25682 |
|
25683 | // Flatten any nested arrays
|
25684 | args = concat.apply( [], args );
|
25685 |
|
25686 | var fragment, first, scripts, hasScripts, node, doc,
|
25687 | i = 0,
|
25688 | l = this.length,
|
25689 | set = this,
|
25690 | iNoClone = l - 1,
|
25691 | value = args[ 0 ],
|
25692 | isFunction = jQuery.isFunction( value );
|
25693 |
|
25694 | // We can't cloneNode fragments that contain checked, in WebKit
|
25695 | if ( isFunction ||
|
25696 | ( l > 1 && typeof value === "string" &&
|
25697 | !support.checkClone && rchecked.test( value ) ) ) {
|
25698 | return this.each(function( index ) {
|
25699 | var self = set.eq( index );
|
25700 | if ( isFunction ) {
|
25701 | args[ 0 ] = value.call( this, index, self.html() );
|
25702 | }
|
25703 | self.domManip( args, callback );
|
25704 | });
|
25705 | }
|
25706 |
|
25707 | if ( l ) {
|
25708 | fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
|
25709 | first = fragment.firstChild;
|
25710 |
|
25711 | if ( fragment.childNodes.length === 1 ) {
|
25712 | fragment = first;
|
25713 | }
|
25714 |
|
25715 | if ( first ) {
|
25716 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
|
25717 | hasScripts = scripts.length;
|
25718 |
|
25719 | // Use the original fragment for the last item instead of the first because it can end up
|
25720 | // being emptied incorrectly in certain situations (#8070).
|
25721 | for ( ; i < l; i++ ) {
|
25722 | node = fragment;
|
25723 |
|
25724 | if ( i !== iNoClone ) {
|
25725 | node = jQuery.clone( node, true, true );
|
25726 |
|
25727 | // Keep references to cloned scripts for later restoration
|
25728 | if ( hasScripts ) {
|
25729 | // Support: QtWebKit
|
25730 | // jQuery.merge because push.apply(_, arraylike) throws
|
25731 | jQuery.merge( scripts, getAll( node, "script" ) );
|
25732 | }
|
25733 | }
|
25734 |
|
25735 | callback.call( this[ i ], node, i );
|
25736 | }
|
25737 |
|
25738 | if ( hasScripts ) {
|
25739 | doc = scripts[ scripts.length - 1 ].ownerDocument;
|
25740 |
|
25741 | // Reenable scripts
|
25742 | jQuery.map( scripts, restoreScript );
|
25743 |
|
25744 | // Evaluate executable scripts on first document insertion
|
25745 | for ( i = 0; i < hasScripts; i++ ) {
|
25746 | node = scripts[ i ];
|
25747 | if ( rscriptType.test( node.type || "" ) &&
|
25748 | !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
|
25749 |
|
25750 | if ( node.src ) {
|
25751 | // Optional AJAX dependency, but won't run scripts if not present
|
25752 | if ( jQuery._evalUrl ) {
|
25753 | jQuery._evalUrl( node.src );
|
25754 | }
|
25755 | } else {
|
25756 | jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
|
25757 | }
|
25758 | }
|
25759 | }
|
25760 | }
|
25761 | }
|
25762 | }
|
25763 |
|
25764 | return this;
|
25765 | }
|
25766 | });
|
25767 |
|
25768 | jQuery.each({
|
25769 | appendTo: "append",
|
25770 | prependTo: "prepend",
|
25771 | insertBefore: "before",
|
25772 | insertAfter: "after",
|
25773 | replaceAll: "replaceWith"
|
25774 | }, function( name, original ) {
|
25775 | jQuery.fn[ name ] = function( selector ) {
|
25776 | var elems,
|
25777 | ret = [],
|
25778 | insert = jQuery( selector ),
|
25779 | last = insert.length - 1,
|
25780 | i = 0;
|
25781 |
|
25782 | for ( ; i <= last; i++ ) {
|
25783 | elems = i === last ? this : this.clone( true );
|
25784 | jQuery( insert[ i ] )[ original ]( elems );
|
25785 |
|
25786 | // Support: QtWebKit
|
25787 | // .get() because push.apply(_, arraylike) throws
|
25788 | push.apply( ret, elems.get() );
|
25789 | }
|
25790 |
|
25791 | return this.pushStack( ret );
|
25792 | };
|
25793 | });
|
25794 |
|
25795 |
|
25796 | var iframe,
|
25797 | elemdisplay = {};
|
25798 |
|
25799 | /**
|
25800 | * Retrieve the actual display of a element
|
25801 | * @param {String} name nodeName of the element
|
25802 | * @param {Object} doc Document object
|
25803 | */
|
25804 | // Called only from within defaultDisplay
|
25805 | function actualDisplay( name, doc ) {
|
25806 | var style,
|
25807 | elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
|
25808 |
|
25809 | // getDefaultComputedStyle might be reliably used only on attached element
|
25810 | display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
|
25811 |
|
25812 | // Use of this method is a temporary fix (more like optimization) until something better comes along,
|
25813 | // since it was removed from specification and supported only in FF
|
25814 | style.display : jQuery.css( elem[ 0 ], "display" );
|
25815 |
|
25816 | // We don't have any data stored on the element,
|
25817 | // so use "detach" method as fast way to get rid of the element
|
25818 | elem.detach();
|
25819 |
|
25820 | return display;
|
25821 | }
|
25822 |
|
25823 | /**
|
25824 | * Try to determine the default display value of an element
|
25825 | * @param {String} nodeName
|
25826 | */
|
25827 | function defaultDisplay( nodeName ) {
|
25828 | var doc = document,
|
25829 | display = elemdisplay[ nodeName ];
|
25830 |
|
25831 | if ( !display ) {
|
25832 | display = actualDisplay( nodeName, doc );
|
25833 |
|
25834 | // If the simple way fails, read from inside an iframe
|
25835 | if ( display === "none" || !display ) {
|
25836 |
|
25837 | // Use the already-created iframe if possible
|
25838 | iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
|
25839 |
|
25840 | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
25841 | doc = iframe[ 0 ].contentDocument;
|
25842 |
|
25843 | // Support: IE
|
25844 | doc.write();
|
25845 | doc.close();
|
25846 |
|
25847 | display = actualDisplay( nodeName, doc );
|
25848 | iframe.detach();
|
25849 | }
|
25850 |
|
25851 | // Store the correct default display
|
25852 | elemdisplay[ nodeName ] = display;
|
25853 | }
|
25854 |
|
25855 | return display;
|
25856 | }
|
25857 | var rmargin = (/^margin/);
|
25858 |
|
25859 | var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
|
25860 |
|
25861 | var getStyles = function( elem ) {
|
25862 | // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
|
25863 | // IE throws on elements created in popups
|
25864 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
|
25865 | if ( elem.ownerDocument.defaultView.opener ) {
|
25866 | return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
|
25867 | }
|
25868 |
|
25869 | return window.getComputedStyle( elem, null );
|
25870 | };
|
25871 |
|
25872 |
|
25873 |
|
25874 | function curCSS( elem, name, computed ) {
|
25875 | var width, minWidth, maxWidth, ret,
|
25876 | style = elem.style;
|
25877 |
|
25878 | computed = computed || getStyles( elem );
|
25879 |
|
25880 | // Support: IE9
|
25881 | // getPropertyValue is only needed for .css('filter') (#12537)
|
25882 | if ( computed ) {
|
25883 | ret = computed.getPropertyValue( name ) || computed[ name ];
|
25884 | }
|
25885 |
|
25886 | if ( computed ) {
|
25887 |
|
25888 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
25889 | ret = jQuery.style( elem, name );
|
25890 | }
|
25891 |
|
25892 | // Support: iOS < 6
|
25893 | // A tribute to the "awesome hack by Dean Edwards"
|
25894 | // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
|
25895 | // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
25896 | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
|
25897 |
|
25898 | // Remember the original values
|
25899 | width = style.width;
|
25900 | minWidth = style.minWidth;
|
25901 | maxWidth = style.maxWidth;
|
25902 |
|
25903 | // Put in the new values to get a computed value out
|
25904 | style.minWidth = style.maxWidth = style.width = ret;
|
25905 | ret = computed.width;
|
25906 |
|
25907 | // Revert the changed values
|
25908 | style.width = width;
|
25909 | style.minWidth = minWidth;
|
25910 | style.maxWidth = maxWidth;
|
25911 | }
|
25912 | }
|
25913 |
|
25914 | return ret !== undefined ?
|
25915 | // Support: IE
|
25916 | // IE returns zIndex value as an integer.
|
25917 | ret + "" :
|
25918 | ret;
|
25919 | }
|
25920 |
|
25921 |
|
25922 | function addGetHookIf( conditionFn, hookFn ) {
|
25923 | // Define the hook, we'll check on the first run if it's really needed.
|
25924 | return {
|
25925 | get: function() {
|
25926 | if ( conditionFn() ) {
|
25927 | // Hook not needed (or it's not possible to use it due
|
25928 | // to missing dependency), remove it.
|
25929 | delete this.get;
|
25930 | return;
|
25931 | }
|
25932 |
|
25933 | // Hook needed; redefine it so that the support test is not executed again.
|
25934 | return (this.get = hookFn).apply( this, arguments );
|
25935 | }
|
25936 | };
|
25937 | }
|
25938 |
|
25939 |
|
25940 | (function() {
|
25941 | var pixelPositionVal, boxSizingReliableVal,
|
25942 | docElem = document.documentElement,
|
25943 | container = document.createElement( "div" ),
|
25944 | div = document.createElement( "div" );
|
25945 |
|
25946 | if ( !div.style ) {
|
25947 | return;
|
25948 | }
|
25949 |
|
25950 | // Support: IE9-11+
|
25951 | // Style of cloned element affects source element cloned (#8908)
|
25952 | div.style.backgroundClip = "content-box";
|
25953 | div.cloneNode( true ).style.backgroundClip = "";
|
25954 | support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
25955 |
|
25956 | container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
|
25957 | "position:absolute";
|
25958 | container.appendChild( div );
|
25959 |
|
25960 | // Executing both pixelPosition & boxSizingReliable tests require only one layout
|
25961 | // so they're executed at the same time to save the second computation.
|
25962 | function computePixelPositionAndBoxSizingReliable() {
|
25963 | div.style.cssText =
|
25964 | // Support: Firefox<29, Android 2.3
|
25965 | // Vendor-prefix box-sizing
|
25966 | "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
|
25967 | "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
|
25968 | "border:1px;padding:1px;width:4px;position:absolute";
|
25969 | div.innerHTML = "";
|
25970 | docElem.appendChild( container );
|
25971 |
|
25972 | var divStyle = window.getComputedStyle( div, null );
|
25973 | pixelPositionVal = divStyle.top !== "1%";
|
25974 | boxSizingReliableVal = divStyle.width === "4px";
|
25975 |
|
25976 | docElem.removeChild( container );
|
25977 | }
|
25978 |
|
25979 | // Support: node.js jsdom
|
25980 | // Don't assume that getComputedStyle is a property of the global object
|
25981 | if ( window.getComputedStyle ) {
|
25982 | jQuery.extend( support, {
|
25983 | pixelPosition: function() {
|
25984 |
|
25985 | // This test is executed only once but we still do memoizing
|
25986 | // since we can use the boxSizingReliable pre-computing.
|
25987 | // No need to check if the test was already performed, though.
|
25988 | computePixelPositionAndBoxSizingReliable();
|
25989 | return pixelPositionVal;
|
25990 | },
|
25991 | boxSizingReliable: function() {
|
25992 | if ( boxSizingReliableVal == null ) {
|
25993 | computePixelPositionAndBoxSizingReliable();
|
25994 | }
|
25995 | return boxSizingReliableVal;
|
25996 | },
|
25997 | reliableMarginRight: function() {
|
25998 |
|
25999 | // Support: Android 2.3
|
26000 | // Check if div with explicit width and no margin-right incorrectly
|
26001 | // gets computed margin-right based on width of container. (#3333)
|
26002 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
26003 | // This support function is only executed once so no memoizing is needed.
|
26004 | var ret,
|
26005 | marginDiv = div.appendChild( document.createElement( "div" ) );
|
26006 |
|
26007 | // Reset CSS: box-sizing; display; margin; border; padding
|
26008 | marginDiv.style.cssText = div.style.cssText =
|
26009 | // Support: Firefox<29, Android 2.3
|
26010 | // Vendor-prefix box-sizing
|
26011 | "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
|
26012 | "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
|
26013 | marginDiv.style.marginRight = marginDiv.style.width = "0";
|
26014 | div.style.width = "1px";
|
26015 | docElem.appendChild( container );
|
26016 |
|
26017 | ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
|
26018 |
|
26019 | docElem.removeChild( container );
|
26020 | div.removeChild( marginDiv );
|
26021 |
|
26022 | return ret;
|
26023 | }
|
26024 | });
|
26025 | }
|
26026 | })();
|
26027 |
|
26028 |
|
26029 | // A method for quickly swapping in/out CSS properties to get correct calculations.
|
26030 | jQuery.swap = function( elem, options, callback, args ) {
|
26031 | var ret, name,
|
26032 | old = {};
|
26033 |
|
26034 | // Remember the old values, and insert the new ones
|
26035 | for ( name in options ) {
|
26036 | old[ name ] = elem.style[ name ];
|
26037 | elem.style[ name ] = options[ name ];
|
26038 | }
|
26039 |
|
26040 | ret = callback.apply( elem, args || [] );
|
26041 |
|
26042 | // Revert the old values
|
26043 | for ( name in options ) {
|
26044 | elem.style[ name ] = old[ name ];
|
26045 | }
|
26046 |
|
26047 | return ret;
|
26048 | };
|
26049 |
|
26050 |
|
26051 | var
|
26052 | // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
|
26053 | // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
26054 | rdisplayswap = /^(none|table(?!-c[ea]).+)/,
|
26055 | rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
|
26056 | rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
|
26057 |
|
26058 | cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
26059 | cssNormalTransform = {
|
26060 | letterSpacing: "0",
|
26061 | fontWeight: "400"
|
26062 | },
|
26063 |
|
26064 | cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
|
26065 |
|
26066 | // Return a css property mapped to a potentially vendor prefixed property
|
26067 | function vendorPropName( style, name ) {
|
26068 |
|
26069 | // Shortcut for names that are not vendor prefixed
|
26070 | if ( name in style ) {
|
26071 | return name;
|
26072 | }
|
26073 |
|
26074 | // Check for vendor prefixed names
|
26075 | var capName = name[0].toUpperCase() + name.slice(1),
|
26076 | origName = name,
|
26077 | i = cssPrefixes.length;
|
26078 |
|
26079 | while ( i-- ) {
|
26080 | name = cssPrefixes[ i ] + capName;
|
26081 | if ( name in style ) {
|
26082 | return name;
|
26083 | }
|
26084 | }
|
26085 |
|
26086 | return origName;
|
26087 | }
|
26088 |
|
26089 | function setPositiveNumber( elem, value, subtract ) {
|
26090 | var matches = rnumsplit.exec( value );
|
26091 | return matches ?
|
26092 | // Guard against undefined "subtract", e.g., when used as in cssHooks
|
26093 | Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
|
26094 | value;
|
26095 | }
|
26096 |
|
26097 | function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
|
26098 | var i = extra === ( isBorderBox ? "border" : "content" ) ?
|
26099 | // If we already have the right measurement, avoid augmentation
|
26100 | 4 :
|
26101 | // Otherwise initialize for horizontal or vertical properties
|
26102 | name === "width" ? 1 : 0,
|
26103 |
|
26104 | val = 0;
|
26105 |
|
26106 | for ( ; i < 4; i += 2 ) {
|
26107 | // Both box models exclude margin, so add it if we want it
|
26108 | if ( extra === "margin" ) {
|
26109 | val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
|
26110 | }
|
26111 |
|
26112 | if ( isBorderBox ) {
|
26113 | // border-box includes padding, so remove it if we want content
|
26114 | if ( extra === "content" ) {
|
26115 | val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
26116 | }
|
26117 |
|
26118 | // At this point, extra isn't border nor margin, so remove border
|
26119 | if ( extra !== "margin" ) {
|
26120 | val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
26121 | }
|
26122 | } else {
|
26123 | // At this point, extra isn't content, so add padding
|
26124 | val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
26125 |
|
26126 | // At this point, extra isn't content nor padding, so add border
|
26127 | if ( extra !== "padding" ) {
|
26128 | val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
26129 | }
|
26130 | }
|
26131 | }
|
26132 |
|
26133 | return val;
|
26134 | }
|
26135 |
|
26136 | function getWidthOrHeight( elem, name, extra ) {
|
26137 |
|
26138 | // Start with offset property, which is equivalent to the border-box value
|
26139 | var valueIsBorderBox = true,
|
26140 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
26141 | styles = getStyles( elem ),
|
26142 | isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
26143 |
|
26144 | // Some non-html elements return undefined for offsetWidth, so check for null/undefined
|
26145 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
26146 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
|
26147 | if ( val <= 0 || val == null ) {
|
26148 | // Fall back to computed then uncomputed css if necessary
|
26149 | val = curCSS( elem, name, styles );
|
26150 | if ( val < 0 || val == null ) {
|
26151 | val = elem.style[ name ];
|
26152 | }
|
26153 |
|
26154 | // Computed unit is not pixels. Stop here and return.
|
26155 | if ( rnumnonpx.test(val) ) {
|
26156 | return val;
|
26157 | }
|
26158 |
|
26159 | // Check for style in case a browser which returns unreliable values
|
26160 | // for getComputedStyle silently falls back to the reliable elem.style
|
26161 | valueIsBorderBox = isBorderBox &&
|
26162 | ( support.boxSizingReliable() || val === elem.style[ name ] );
|
26163 |
|
26164 | // Normalize "", auto, and prepare for extra
|
26165 | val = parseFloat( val ) || 0;
|
26166 | }
|
26167 |
|
26168 | // Use the active box-sizing model to add/subtract irrelevant styles
|
26169 | return ( val +
|
26170 | augmentWidthOrHeight(
|
26171 | elem,
|
26172 | name,
|
26173 | extra || ( isBorderBox ? "border" : "content" ),
|
26174 | valueIsBorderBox,
|
26175 | styles
|
26176 | )
|
26177 | ) + "px";
|
26178 | }
|
26179 |
|
26180 | function showHide( elements, show ) {
|
26181 | var display, elem, hidden,
|
26182 | values = [],
|
26183 | index = 0,
|
26184 | length = elements.length;
|
26185 |
|
26186 | for ( ; index < length; index++ ) {
|
26187 | elem = elements[ index ];
|
26188 | if ( !elem.style ) {
|
26189 | continue;
|
26190 | }
|
26191 |
|
26192 | values[ index ] = data_priv.get( elem, "olddisplay" );
|
26193 | display = elem.style.display;
|
26194 | if ( show ) {
|
26195 | // Reset the inline display of this element to learn if it is
|
26196 | // being hidden by cascaded rules or not
|
26197 | if ( !values[ index ] && display === "none" ) {
|
26198 | elem.style.display = "";
|
26199 | }
|
26200 |
|
26201 | // Set elements which have been overridden with display: none
|
26202 | // in a stylesheet to whatever the default browser style is
|
26203 | // for such an element
|
26204 | if ( elem.style.display === "" && isHidden( elem ) ) {
|
26205 | values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
|
26206 | }
|
26207 | } else {
|
26208 | hidden = isHidden( elem );
|
26209 |
|
26210 | if ( display !== "none" || !hidden ) {
|
26211 | data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
|
26212 | }
|
26213 | }
|
26214 | }
|
26215 |
|
26216 | // Set the display of most of the elements in a second loop
|
26217 | // to avoid the constant reflow
|
26218 | for ( index = 0; index < length; index++ ) {
|
26219 | elem = elements[ index ];
|
26220 | if ( !elem.style ) {
|
26221 | continue;
|
26222 | }
|
26223 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
|
26224 | elem.style.display = show ? values[ index ] || "" : "none";
|
26225 | }
|
26226 | }
|
26227 |
|
26228 | return elements;
|
26229 | }
|
26230 |
|
26231 | jQuery.extend({
|
26232 |
|
26233 | // Add in style property hooks for overriding the default
|
26234 | // behavior of getting and setting a style property
|
26235 | cssHooks: {
|
26236 | opacity: {
|
26237 | get: function( elem, computed ) {
|
26238 | if ( computed ) {
|
26239 |
|
26240 | // We should always get a number back from opacity
|
26241 | var ret = curCSS( elem, "opacity" );
|
26242 | return ret === "" ? "1" : ret;
|
26243 | }
|
26244 | }
|
26245 | }
|
26246 | },
|
26247 |
|
26248 | // Don't automatically add "px" to these possibly-unitless properties
|
26249 | cssNumber: {
|
26250 | "columnCount": true,
|
26251 | "fillOpacity": true,
|
26252 | "flexGrow": true,
|
26253 | "flexShrink": true,
|
26254 | "fontWeight": true,
|
26255 | "lineHeight": true,
|
26256 | "opacity": true,
|
26257 | "order": true,
|
26258 | "orphans": true,
|
26259 | "widows": true,
|
26260 | "zIndex": true,
|
26261 | "zoom": true
|
26262 | },
|
26263 |
|
26264 | // Add in properties whose names you wish to fix before
|
26265 | // setting or getting the value
|
26266 | cssProps: {
|
26267 | "float": "cssFloat"
|
26268 | },
|
26269 |
|
26270 | // Get and set the style property on a DOM Node
|
26271 | style: function( elem, name, value, extra ) {
|
26272 |
|
26273 | // Don't set styles on text and comment nodes
|
26274 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
26275 | return;
|
26276 | }
|
26277 |
|
26278 | // Make sure that we're working with the right name
|
26279 | var ret, type, hooks,
|
26280 | origName = jQuery.camelCase( name ),
|
26281 | style = elem.style;
|
26282 |
|
26283 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
|
26284 |
|
26285 | // Gets hook for the prefixed version, then unprefixed version
|
26286 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
26287 |
|
26288 | // Check if we're setting a value
|
26289 | if ( value !== undefined ) {
|
26290 | type = typeof value;
|
26291 |
|
26292 | // Convert "+=" or "-=" to relative numbers (#7345)
|
26293 | if ( type === "string" && (ret = rrelNum.exec( value )) ) {
|
26294 | value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
|
26295 | // Fixes bug #9237
|
26296 | type = "number";
|
26297 | }
|
26298 |
|
26299 | // Make sure that null and NaN values aren't set (#7116)
|
26300 | if ( value == null || value !== value ) {
|
26301 | return;
|
26302 | }
|
26303 |
|
26304 | // If a number, add 'px' to the (except for certain CSS properties)
|
26305 | if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
|
26306 | value += "px";
|
26307 | }
|
26308 |
|
26309 | // Support: IE9-11+
|
26310 | // background-* props affect original clone's values
|
26311 | if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
|
26312 | style[ name ] = "inherit";
|
26313 | }
|
26314 |
|
26315 | // If a hook was provided, use that value, otherwise just set the specified value
|
26316 | if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
|
26317 | style[ name ] = value;
|
26318 | }
|
26319 |
|
26320 | } else {
|
26321 | // If a hook was provided get the non-computed value from there
|
26322 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
26323 | return ret;
|
26324 | }
|
26325 |
|
26326 | // Otherwise just get the value from the style object
|
26327 | return style[ name ];
|
26328 | }
|
26329 | },
|
26330 |
|
26331 | css: function( elem, name, extra, styles ) {
|
26332 | var val, num, hooks,
|
26333 | origName = jQuery.camelCase( name );
|
26334 |
|
26335 | // Make sure that we're working with the right name
|
26336 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
|
26337 |
|
26338 | // Try prefixed name followed by the unprefixed name
|
26339 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
26340 |
|
26341 | // If a hook was provided get the computed value from there
|
26342 | if ( hooks && "get" in hooks ) {
|
26343 | val = hooks.get( elem, true, extra );
|
26344 | }
|
26345 |
|
26346 | // Otherwise, if a way to get the computed value exists, use that
|
26347 | if ( val === undefined ) {
|
26348 | val = curCSS( elem, name, styles );
|
26349 | }
|
26350 |
|
26351 | // Convert "normal" to computed value
|
26352 | if ( val === "normal" && name in cssNormalTransform ) {
|
26353 | val = cssNormalTransform[ name ];
|
26354 | }
|
26355 |
|
26356 | // Make numeric if forced or a qualifier was provided and val looks numeric
|
26357 | if ( extra === "" || extra ) {
|
26358 | num = parseFloat( val );
|
26359 | return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
|
26360 | }
|
26361 | return val;
|
26362 | }
|
26363 | });
|
26364 |
|
26365 | jQuery.each([ "height", "width" ], function( i, name ) {
|
26366 | jQuery.cssHooks[ name ] = {
|
26367 | get: function( elem, computed, extra ) {
|
26368 | if ( computed ) {
|
26369 |
|
26370 | // Certain elements can have dimension info if we invisibly show them
|
26371 | // but it must have a current display style that would benefit
|
26372 | return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
|
26373 | jQuery.swap( elem, cssShow, function() {
|
26374 | return getWidthOrHeight( elem, name, extra );
|
26375 | }) :
|
26376 | getWidthOrHeight( elem, name, extra );
|
26377 | }
|
26378 | },
|
26379 |
|
26380 | set: function( elem, value, extra ) {
|
26381 | var styles = extra && getStyles( elem );
|
26382 | return setPositiveNumber( elem, value, extra ?
|
26383 | augmentWidthOrHeight(
|
26384 | elem,
|
26385 | name,
|
26386 | extra,
|
26387 | jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
26388 | styles
|
26389 | ) : 0
|
26390 | );
|
26391 | }
|
26392 | };
|
26393 | });
|
26394 |
|
26395 | // Support: Android 2.3
|
26396 | jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
|
26397 | function( elem, computed ) {
|
26398 | if ( computed ) {
|
26399 | return jQuery.swap( elem, { "display": "inline-block" },
|
26400 | curCSS, [ elem, "marginRight" ] );
|
26401 | }
|
26402 | }
|
26403 | );
|
26404 |
|
26405 | // These hooks are used by animate to expand properties
|
26406 | jQuery.each({
|
26407 | margin: "",
|
26408 | padding: "",
|
26409 | border: "Width"
|
26410 | }, function( prefix, suffix ) {
|
26411 | jQuery.cssHooks[ prefix + suffix ] = {
|
26412 | expand: function( value ) {
|
26413 | var i = 0,
|
26414 | expanded = {},
|
26415 |
|
26416 | // Assumes a single number if not a string
|
26417 | parts = typeof value === "string" ? value.split(" ") : [ value ];
|
26418 |
|
26419 | for ( ; i < 4; i++ ) {
|
26420 | expanded[ prefix + cssExpand[ i ] + suffix ] =
|
26421 | parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
|
26422 | }
|
26423 |
|
26424 | return expanded;
|
26425 | }
|
26426 | };
|
26427 |
|
26428 | if ( !rmargin.test( prefix ) ) {
|
26429 | jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
|
26430 | }
|
26431 | });
|
26432 |
|
26433 | jQuery.fn.extend({
|
26434 | css: function( name, value ) {
|
26435 | return access( this, function( elem, name, value ) {
|
26436 | var styles, len,
|
26437 | map = {},
|
26438 | i = 0;
|
26439 |
|
26440 | if ( jQuery.isArray( name ) ) {
|
26441 | styles = getStyles( elem );
|
26442 | len = name.length;
|
26443 |
|
26444 | for ( ; i < len; i++ ) {
|
26445 | map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
|
26446 | }
|
26447 |
|
26448 | return map;
|
26449 | }
|
26450 |
|
26451 | return value !== undefined ?
|
26452 | jQuery.style( elem, name, value ) :
|
26453 | jQuery.css( elem, name );
|
26454 | }, name, value, arguments.length > 1 );
|
26455 | },
|
26456 | show: function() {
|
26457 | return showHide( this, true );
|
26458 | },
|
26459 | hide: function() {
|
26460 | return showHide( this );
|
26461 | },
|
26462 | toggle: function( state ) {
|
26463 | if ( typeof state === "boolean" ) {
|
26464 | return state ? this.show() : this.hide();
|
26465 | }
|
26466 |
|
26467 | return this.each(function() {
|
26468 | if ( isHidden( this ) ) {
|
26469 | jQuery( this ).show();
|
26470 | } else {
|
26471 | jQuery( this ).hide();
|
26472 | }
|
26473 | });
|
26474 | }
|
26475 | });
|
26476 |
|
26477 |
|
26478 | function Tween( elem, options, prop, end, easing ) {
|
26479 | return new Tween.prototype.init( elem, options, prop, end, easing );
|
26480 | }
|
26481 | jQuery.Tween = Tween;
|
26482 |
|
26483 | Tween.prototype = {
|
26484 | constructor: Tween,
|
26485 | init: function( elem, options, prop, end, easing, unit ) {
|
26486 | this.elem = elem;
|
26487 | this.prop = prop;
|
26488 | this.easing = easing || "swing";
|
26489 | this.options = options;
|
26490 | this.start = this.now = this.cur();
|
26491 | this.end = end;
|
26492 | this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
|
26493 | },
|
26494 | cur: function() {
|
26495 | var hooks = Tween.propHooks[ this.prop ];
|
26496 |
|
26497 | return hooks && hooks.get ?
|
26498 | hooks.get( this ) :
|
26499 | Tween.propHooks._default.get( this );
|
26500 | },
|
26501 | run: function( percent ) {
|
26502 | var eased,
|
26503 | hooks = Tween.propHooks[ this.prop ];
|
26504 |
|
26505 | if ( this.options.duration ) {
|
26506 | this.pos = eased = jQuery.easing[ this.easing ](
|
26507 | percent, this.options.duration * percent, 0, 1, this.options.duration
|
26508 | );
|
26509 | } else {
|
26510 | this.pos = eased = percent;
|
26511 | }
|
26512 | this.now = ( this.end - this.start ) * eased + this.start;
|
26513 |
|
26514 | if ( this.options.step ) {
|
26515 | this.options.step.call( this.elem, this.now, this );
|
26516 | }
|
26517 |
|
26518 | if ( hooks && hooks.set ) {
|
26519 | hooks.set( this );
|
26520 | } else {
|
26521 | Tween.propHooks._default.set( this );
|
26522 | }
|
26523 | return this;
|
26524 | }
|
26525 | };
|
26526 |
|
26527 | Tween.prototype.init.prototype = Tween.prototype;
|
26528 |
|
26529 | Tween.propHooks = {
|
26530 | _default: {
|
26531 | get: function( tween ) {
|
26532 | var result;
|
26533 |
|
26534 | if ( tween.elem[ tween.prop ] != null &&
|
26535 | (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
26536 | return tween.elem[ tween.prop ];
|
26537 | }
|
26538 |
|
26539 | // Passing an empty string as a 3rd parameter to .css will automatically
|
26540 | // attempt a parseFloat and fallback to a string if the parse fails.
|
26541 | // Simple values such as "10px" are parsed to Float;
|
26542 | // complex values such as "rotate(1rad)" are returned as-is.
|
26543 | result = jQuery.css( tween.elem, tween.prop, "" );
|
26544 | // Empty strings, null, undefined and "auto" are converted to 0.
|
26545 | return !result || result === "auto" ? 0 : result;
|
26546 | },
|
26547 | set: function( tween ) {
|
26548 | // Use step hook for back compat.
|
26549 | // Use cssHook if its there.
|
26550 | // Use .style if available and use plain properties where available.
|
26551 | if ( jQuery.fx.step[ tween.prop ] ) {
|
26552 | jQuery.fx.step[ tween.prop ]( tween );
|
26553 | } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
|
26554 | jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
|
26555 | } else {
|
26556 | tween.elem[ tween.prop ] = tween.now;
|
26557 | }
|
26558 | }
|
26559 | }
|
26560 | };
|
26561 |
|
26562 | // Support: IE9
|
26563 | // Panic based approach to setting things on disconnected nodes
|
26564 | Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
26565 | set: function( tween ) {
|
26566 | if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
26567 | tween.elem[ tween.prop ] = tween.now;
|
26568 | }
|
26569 | }
|
26570 | };
|
26571 |
|
26572 | jQuery.easing = {
|
26573 | linear: function( p ) {
|
26574 | return p;
|
26575 | },
|
26576 | swing: function( p ) {
|
26577 | return 0.5 - Math.cos( p * Math.PI ) / 2;
|
26578 | }
|
26579 | };
|
26580 |
|
26581 | jQuery.fx = Tween.prototype.init;
|
26582 |
|
26583 | // Back Compat <1.8 extension point
|
26584 | jQuery.fx.step = {};
|
26585 |
|
26586 |
|
26587 |
|
26588 |
|
26589 | var
|
26590 | fxNow, timerId,
|
26591 | rfxtypes = /^(?:toggle|show|hide)$/,
|
26592 | rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
|
26593 | rrun = /queueHooks$/,
|
26594 | animationPrefilters = [ defaultPrefilter ],
|
26595 | tweeners = {
|
26596 | "*": [ function( prop, value ) {
|
26597 | var tween = this.createTween( prop, value ),
|
26598 | target = tween.cur(),
|
26599 | parts = rfxnum.exec( value ),
|
26600 | unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
|
26601 |
|
26602 | // Starting value computation is required for potential unit mismatches
|
26603 | start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
|
26604 | rfxnum.exec( jQuery.css( tween.elem, prop ) ),
|
26605 | scale = 1,
|
26606 | maxIterations = 20;
|
26607 |
|
26608 | if ( start && start[ 3 ] !== unit ) {
|
26609 | // Trust units reported by jQuery.css
|
26610 | unit = unit || start[ 3 ];
|
26611 |
|
26612 | // Make sure we update the tween properties later on
|
26613 | parts = parts || [];
|
26614 |
|
26615 | // Iteratively approximate from a nonzero starting point
|
26616 | start = +target || 1;
|
26617 |
|
26618 | do {
|
26619 | // If previous iteration zeroed out, double until we get *something*.
|
26620 | // Use string for doubling so we don't accidentally see scale as unchanged below
|
26621 | scale = scale || ".5";
|
26622 |
|
26623 | // Adjust and apply
|
26624 | start = start / scale;
|
26625 | jQuery.style( tween.elem, prop, start + unit );
|
26626 |
|
26627 | // Update scale, tolerating zero or NaN from tween.cur(),
|
26628 | // break the loop if scale is unchanged or perfect, or if we've just had enough
|
26629 | } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
|
26630 | }
|
26631 |
|
26632 | // Update tween properties
|
26633 | if ( parts ) {
|
26634 | start = tween.start = +start || +target || 0;
|
26635 | tween.unit = unit;
|
26636 | // If a +=/-= token was provided, we're doing a relative animation
|
26637 | tween.end = parts[ 1 ] ?
|
26638 | start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
|
26639 | +parts[ 2 ];
|
26640 | }
|
26641 |
|
26642 | return tween;
|
26643 | } ]
|
26644 | };
|
26645 |
|
26646 | // Animations created synchronously will run synchronously
|
26647 | function createFxNow() {
|
26648 | setTimeout(function() {
|
26649 | fxNow = undefined;
|
26650 | });
|
26651 | return ( fxNow = jQuery.now() );
|
26652 | }
|
26653 |
|
26654 | // Generate parameters to create a standard animation
|
26655 | function genFx( type, includeWidth ) {
|
26656 | var which,
|
26657 | i = 0,
|
26658 | attrs = { height: type };
|
26659 |
|
26660 | // If we include width, step value is 1 to do all cssExpand values,
|
26661 | // otherwise step value is 2 to skip over Left and Right
|
26662 | includeWidth = includeWidth ? 1 : 0;
|
26663 | for ( ; i < 4 ; i += 2 - includeWidth ) {
|
26664 | which = cssExpand[ i ];
|
26665 | attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
|
26666 | }
|
26667 |
|
26668 | if ( includeWidth ) {
|
26669 | attrs.opacity = attrs.width = type;
|
26670 | }
|
26671 |
|
26672 | return attrs;
|
26673 | }
|
26674 |
|
26675 | function createTween( value, prop, animation ) {
|
26676 | var tween,
|
26677 | collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
|
26678 | index = 0,
|
26679 | length = collection.length;
|
26680 | for ( ; index < length; index++ ) {
|
26681 | if ( (tween = collection[ index ].call( animation, prop, value )) ) {
|
26682 |
|
26683 | // We're done with this property
|
26684 | return tween;
|
26685 | }
|
26686 | }
|
26687 | }
|
26688 |
|
26689 | function defaultPrefilter( elem, props, opts ) {
|
26690 | /* jshint validthis: true */
|
26691 | var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
|
26692 | anim = this,
|
26693 | orig = {},
|
26694 | style = elem.style,
|
26695 | hidden = elem.nodeType && isHidden( elem ),
|
26696 | dataShow = data_priv.get( elem, "fxshow" );
|
26697 |
|
26698 | // Handle queue: false promises
|
26699 | if ( !opts.queue ) {
|
26700 | hooks = jQuery._queueHooks( elem, "fx" );
|
26701 | if ( hooks.unqueued == null ) {
|
26702 | hooks.unqueued = 0;
|
26703 | oldfire = hooks.empty.fire;
|
26704 | hooks.empty.fire = function() {
|
26705 | if ( !hooks.unqueued ) {
|
26706 | oldfire();
|
26707 | }
|
26708 | };
|
26709 | }
|
26710 | hooks.unqueued++;
|
26711 |
|
26712 | anim.always(function() {
|
26713 | // Ensure the complete handler is called before this completes
|
26714 | anim.always(function() {
|
26715 | hooks.unqueued--;
|
26716 | if ( !jQuery.queue( elem, "fx" ).length ) {
|
26717 | hooks.empty.fire();
|
26718 | }
|
26719 | });
|
26720 | });
|
26721 | }
|
26722 |
|
26723 | // Height/width overflow pass
|
26724 | if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
|
26725 | // Make sure that nothing sneaks out
|
26726 | // Record all 3 overflow attributes because IE9-10 do not
|
26727 | // change the overflow attribute when overflowX and
|
26728 | // overflowY are set to the same value
|
26729 | opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
|
26730 |
|
26731 | // Set display property to inline-block for height/width
|
26732 | // animations on inline elements that are having width/height animated
|
26733 | display = jQuery.css( elem, "display" );
|
26734 |
|
26735 | // Test default display if display is currently "none"
|
26736 | checkDisplay = display === "none" ?
|
26737 | data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
|
26738 |
|
26739 | if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
|
26740 | style.display = "inline-block";
|
26741 | }
|
26742 | }
|
26743 |
|
26744 | if ( opts.overflow ) {
|
26745 | style.overflow = "hidden";
|
26746 | anim.always(function() {
|
26747 | style.overflow = opts.overflow[ 0 ];
|
26748 | style.overflowX = opts.overflow[ 1 ];
|
26749 | style.overflowY = opts.overflow[ 2 ];
|
26750 | });
|
26751 | }
|
26752 |
|
26753 | // show/hide pass
|
26754 | for ( prop in props ) {
|
26755 | value = props[ prop ];
|
26756 | if ( rfxtypes.exec( value ) ) {
|
26757 | delete props[ prop ];
|
26758 | toggle = toggle || value === "toggle";
|
26759 | if ( value === ( hidden ? "hide" : "show" ) ) {
|
26760 |
|
26761 | // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
|
26762 | if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
|
26763 | hidden = true;
|
26764 | } else {
|
26765 | continue;
|
26766 | }
|
26767 | }
|
26768 | orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
|
26769 |
|
26770 | // Any non-fx value stops us from restoring the original display value
|
26771 | } else {
|
26772 | display = undefined;
|
26773 | }
|
26774 | }
|
26775 |
|
26776 | if ( !jQuery.isEmptyObject( orig ) ) {
|
26777 | if ( dataShow ) {
|
26778 | if ( "hidden" in dataShow ) {
|
26779 | hidden = dataShow.hidden;
|
26780 | }
|
26781 | } else {
|
26782 | dataShow = data_priv.access( elem, "fxshow", {} );
|
26783 | }
|
26784 |
|
26785 | // Store state if its toggle - enables .stop().toggle() to "reverse"
|
26786 | if ( toggle ) {
|
26787 | dataShow.hidden = !hidden;
|
26788 | }
|
26789 | if ( hidden ) {
|
26790 | jQuery( elem ).show();
|
26791 | } else {
|
26792 | anim.done(function() {
|
26793 | jQuery( elem ).hide();
|
26794 | });
|
26795 | }
|
26796 | anim.done(function() {
|
26797 | var prop;
|
26798 |
|
26799 | data_priv.remove( elem, "fxshow" );
|
26800 | for ( prop in orig ) {
|
26801 | jQuery.style( elem, prop, orig[ prop ] );
|
26802 | }
|
26803 | });
|
26804 | for ( prop in orig ) {
|
26805 | tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
|
26806 |
|
26807 | if ( !( prop in dataShow ) ) {
|
26808 | dataShow[ prop ] = tween.start;
|
26809 | if ( hidden ) {
|
26810 | tween.end = tween.start;
|
26811 | tween.start = prop === "width" || prop === "height" ? 1 : 0;
|
26812 | }
|
26813 | }
|
26814 | }
|
26815 |
|
26816 | // If this is a noop like .hide().hide(), restore an overwritten display value
|
26817 | } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
|
26818 | style.display = display;
|
26819 | }
|
26820 | }
|
26821 |
|
26822 | function propFilter( props, specialEasing ) {
|
26823 | var index, name, easing, value, hooks;
|
26824 |
|
26825 | // camelCase, specialEasing and expand cssHook pass
|
26826 | for ( index in props ) {
|
26827 | name = jQuery.camelCase( index );
|
26828 | easing = specialEasing[ name ];
|
26829 | value = props[ index ];
|
26830 | if ( jQuery.isArray( value ) ) {
|
26831 | easing = value[ 1 ];
|
26832 | value = props[ index ] = value[ 0 ];
|
26833 | }
|
26834 |
|
26835 | if ( index !== name ) {
|
26836 | props[ name ] = value;
|
26837 | delete props[ index ];
|
26838 | }
|
26839 |
|
26840 | hooks = jQuery.cssHooks[ name ];
|
26841 | if ( hooks && "expand" in hooks ) {
|
26842 | value = hooks.expand( value );
|
26843 | delete props[ name ];
|
26844 |
|
26845 | // Not quite $.extend, this won't overwrite existing keys.
|
26846 | // Reusing 'index' because we have the correct "name"
|
26847 | for ( index in value ) {
|
26848 | if ( !( index in props ) ) {
|
26849 | props[ index ] = value[ index ];
|
26850 | specialEasing[ index ] = easing;
|
26851 | }
|
26852 | }
|
26853 | } else {
|
26854 | specialEasing[ name ] = easing;
|
26855 | }
|
26856 | }
|
26857 | }
|
26858 |
|
26859 | function Animation( elem, properties, options ) {
|
26860 | var result,
|
26861 | stopped,
|
26862 | index = 0,
|
26863 | length = animationPrefilters.length,
|
26864 | deferred = jQuery.Deferred().always( function() {
|
26865 | // Don't match elem in the :animated selector
|
26866 | delete tick.elem;
|
26867 | }),
|
26868 | tick = function() {
|
26869 | if ( stopped ) {
|
26870 | return false;
|
26871 | }
|
26872 | var currentTime = fxNow || createFxNow(),
|
26873 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
26874 | // Support: Android 2.3
|
26875 | // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
|
26876 | temp = remaining / animation.duration || 0,
|
26877 | percent = 1 - temp,
|
26878 | index = 0,
|
26879 | length = animation.tweens.length;
|
26880 |
|
26881 | for ( ; index < length ; index++ ) {
|
26882 | animation.tweens[ index ].run( percent );
|
26883 | }
|
26884 |
|
26885 | deferred.notifyWith( elem, [ animation, percent, remaining ]);
|
26886 |
|
26887 | if ( percent < 1 && length ) {
|
26888 | return remaining;
|
26889 | } else {
|
26890 | deferred.resolveWith( elem, [ animation ] );
|
26891 | return false;
|
26892 | }
|
26893 | },
|
26894 | animation = deferred.promise({
|
26895 | elem: elem,
|
26896 | props: jQuery.extend( {}, properties ),
|
26897 | opts: jQuery.extend( true, { specialEasing: {} }, options ),
|
26898 | originalProperties: properties,
|
26899 | originalOptions: options,
|
26900 | startTime: fxNow || createFxNow(),
|
26901 | duration: options.duration,
|
26902 | tweens: [],
|
26903 | createTween: function( prop, end ) {
|
26904 | var tween = jQuery.Tween( elem, animation.opts, prop, end,
|
26905 | animation.opts.specialEasing[ prop ] || animation.opts.easing );
|
26906 | animation.tweens.push( tween );
|
26907 | return tween;
|
26908 | },
|
26909 | stop: function( gotoEnd ) {
|
26910 | var index = 0,
|
26911 | // If we are going to the end, we want to run all the tweens
|
26912 | // otherwise we skip this part
|
26913 | length = gotoEnd ? animation.tweens.length : 0;
|
26914 | if ( stopped ) {
|
26915 | return this;
|
26916 | }
|
26917 | stopped = true;
|
26918 | for ( ; index < length ; index++ ) {
|
26919 | animation.tweens[ index ].run( 1 );
|
26920 | }
|
26921 |
|
26922 | // Resolve when we played the last frame; otherwise, reject
|
26923 | if ( gotoEnd ) {
|
26924 | deferred.resolveWith( elem, [ animation, gotoEnd ] );
|
26925 | } else {
|
26926 | deferred.rejectWith( elem, [ animation, gotoEnd ] );
|
26927 | }
|
26928 | return this;
|
26929 | }
|
26930 | }),
|
26931 | props = animation.props;
|
26932 |
|
26933 | propFilter( props, animation.opts.specialEasing );
|
26934 |
|
26935 | for ( ; index < length ; index++ ) {
|
26936 | result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
|
26937 | if ( result ) {
|
26938 | return result;
|
26939 | }
|
26940 | }
|
26941 |
|
26942 | jQuery.map( props, createTween, animation );
|
26943 |
|
26944 | if ( jQuery.isFunction( animation.opts.start ) ) {
|
26945 | animation.opts.start.call( elem, animation );
|
26946 | }
|
26947 |
|
26948 | jQuery.fx.timer(
|
26949 | jQuery.extend( tick, {
|
26950 | elem: elem,
|
26951 | anim: animation,
|
26952 | queue: animation.opts.queue
|
26953 | })
|
26954 | );
|
26955 |
|
26956 | // attach callbacks from options
|
26957 | return animation.progress( animation.opts.progress )
|
26958 | .done( animation.opts.done, animation.opts.complete )
|
26959 | .fail( animation.opts.fail )
|
26960 | .always( animation.opts.always );
|
26961 | }
|
26962 |
|
26963 | jQuery.Animation = jQuery.extend( Animation, {
|
26964 |
|
26965 | tweener: function( props, callback ) {
|
26966 | if ( jQuery.isFunction( props ) ) {
|
26967 | callback = props;
|
26968 | props = [ "*" ];
|
26969 | } else {
|
26970 | props = props.split(" ");
|
26971 | }
|
26972 |
|
26973 | var prop,
|
26974 | index = 0,
|
26975 | length = props.length;
|
26976 |
|
26977 | for ( ; index < length ; index++ ) {
|
26978 | prop = props[ index ];
|
26979 | tweeners[ prop ] = tweeners[ prop ] || [];
|
26980 | tweeners[ prop ].unshift( callback );
|
26981 | }
|
26982 | },
|
26983 |
|
26984 | prefilter: function( callback, prepend ) {
|
26985 | if ( prepend ) {
|
26986 | animationPrefilters.unshift( callback );
|
26987 | } else {
|
26988 | animationPrefilters.push( callback );
|
26989 | }
|
26990 | }
|
26991 | });
|
26992 |
|
26993 | jQuery.speed = function( speed, easing, fn ) {
|
26994 | var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
|
26995 | complete: fn || !fn && easing ||
|
26996 | jQuery.isFunction( speed ) && speed,
|
26997 | duration: speed,
|
26998 | easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
|
26999 | };
|
27000 |
|
27001 | opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
27002 | opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
|
27003 |
|
27004 | // Normalize opt.queue - true/undefined/null -> "fx"
|
27005 | if ( opt.queue == null || opt.queue === true ) {
|
27006 | opt.queue = "fx";
|
27007 | }
|
27008 |
|
27009 | // Queueing
|
27010 | opt.old = opt.complete;
|
27011 |
|
27012 | opt.complete = function() {
|
27013 | if ( jQuery.isFunction( opt.old ) ) {
|
27014 | opt.old.call( this );
|
27015 | }
|
27016 |
|
27017 | if ( opt.queue ) {
|
27018 | jQuery.dequeue( this, opt.queue );
|
27019 | }
|
27020 | };
|
27021 |
|
27022 | return opt;
|
27023 | };
|
27024 |
|
27025 | jQuery.fn.extend({
|
27026 | fadeTo: function( speed, to, easing, callback ) {
|
27027 |
|
27028 | // Show any hidden elements after setting opacity to 0
|
27029 | return this.filter( isHidden ).css( "opacity", 0 ).show()
|
27030 |
|
27031 | // Animate to the value specified
|
27032 | .end().animate({ opacity: to }, speed, easing, callback );
|
27033 | },
|
27034 | animate: function( prop, speed, easing, callback ) {
|
27035 | var empty = jQuery.isEmptyObject( prop ),
|
27036 | optall = jQuery.speed( speed, easing, callback ),
|
27037 | doAnimation = function() {
|
27038 | // Operate on a copy of prop so per-property easing won't be lost
|
27039 | var anim = Animation( this, jQuery.extend( {}, prop ), optall );
|
27040 |
|
27041 | // Empty animations, or finishing resolves immediately
|
27042 | if ( empty || data_priv.get( this, "finish" ) ) {
|
27043 | anim.stop( true );
|
27044 | }
|
27045 | };
|
27046 | doAnimation.finish = doAnimation;
|
27047 |
|
27048 | return empty || optall.queue === false ?
|
27049 | this.each( doAnimation ) :
|
27050 | this.queue( optall.queue, doAnimation );
|
27051 | },
|
27052 | stop: function( type, clearQueue, gotoEnd ) {
|
27053 | var stopQueue = function( hooks ) {
|
27054 | var stop = hooks.stop;
|
27055 | delete hooks.stop;
|
27056 | stop( gotoEnd );
|
27057 | };
|
27058 |
|
27059 | if ( typeof type !== "string" ) {
|
27060 | gotoEnd = clearQueue;
|
27061 | clearQueue = type;
|
27062 | type = undefined;
|
27063 | }
|
27064 | if ( clearQueue && type !== false ) {
|
27065 | this.queue( type || "fx", [] );
|
27066 | }
|
27067 |
|
27068 | return this.each(function() {
|
27069 | var dequeue = true,
|
27070 | index = type != null && type + "queueHooks",
|
27071 | timers = jQuery.timers,
|
27072 | data = data_priv.get( this );
|
27073 |
|
27074 | if ( index ) {
|
27075 | if ( data[ index ] && data[ index ].stop ) {
|
27076 | stopQueue( data[ index ] );
|
27077 | }
|
27078 | } else {
|
27079 | for ( index in data ) {
|
27080 | if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
|
27081 | stopQueue( data[ index ] );
|
27082 | }
|
27083 | }
|
27084 | }
|
27085 |
|
27086 | for ( index = timers.length; index--; ) {
|
27087 | if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
|
27088 | timers[ index ].anim.stop( gotoEnd );
|
27089 | dequeue = false;
|
27090 | timers.splice( index, 1 );
|
27091 | }
|
27092 | }
|
27093 |
|
27094 | // Start the next in the queue if the last step wasn't forced.
|
27095 | // Timers currently will call their complete callbacks, which
|
27096 | // will dequeue but only if they were gotoEnd.
|
27097 | if ( dequeue || !gotoEnd ) {
|
27098 | jQuery.dequeue( this, type );
|
27099 | }
|
27100 | });
|
27101 | },
|
27102 | finish: function( type ) {
|
27103 | if ( type !== false ) {
|
27104 | type = type || "fx";
|
27105 | }
|
27106 | return this.each(function() {
|
27107 | var index,
|
27108 | data = data_priv.get( this ),
|
27109 | queue = data[ type + "queue" ],
|
27110 | hooks = data[ type + "queueHooks" ],
|
27111 | timers = jQuery.timers,
|
27112 | length = queue ? queue.length : 0;
|
27113 |
|
27114 | // Enable finishing flag on private data
|
27115 | data.finish = true;
|
27116 |
|
27117 | // Empty the queue first
|
27118 | jQuery.queue( this, type, [] );
|
27119 |
|
27120 | if ( hooks && hooks.stop ) {
|
27121 | hooks.stop.call( this, true );
|
27122 | }
|
27123 |
|
27124 | // Look for any active animations, and finish them
|
27125 | for ( index = timers.length; index--; ) {
|
27126 | if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
|
27127 | timers[ index ].anim.stop( true );
|
27128 | timers.splice( index, 1 );
|
27129 | }
|
27130 | }
|
27131 |
|
27132 | // Look for any animations in the old queue and finish them
|
27133 | for ( index = 0; index < length; index++ ) {
|
27134 | if ( queue[ index ] && queue[ index ].finish ) {
|
27135 | queue[ index ].finish.call( this );
|
27136 | }
|
27137 | }
|
27138 |
|
27139 | // Turn off finishing flag
|
27140 | delete data.finish;
|
27141 | });
|
27142 | }
|
27143 | });
|
27144 |
|
27145 | jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
|
27146 | var cssFn = jQuery.fn[ name ];
|
27147 | jQuery.fn[ name ] = function( speed, easing, callback ) {
|
27148 | return speed == null || typeof speed === "boolean" ?
|
27149 | cssFn.apply( this, arguments ) :
|
27150 | this.animate( genFx( name, true ), speed, easing, callback );
|
27151 | };
|
27152 | });
|
27153 |
|
27154 | // Generate shortcuts for custom animations
|
27155 | jQuery.each({
|
27156 | slideDown: genFx("show"),
|
27157 | slideUp: genFx("hide"),
|
27158 | slideToggle: genFx("toggle"),
|
27159 | fadeIn: { opacity: "show" },
|
27160 | fadeOut: { opacity: "hide" },
|
27161 | fadeToggle: { opacity: "toggle" }
|
27162 | }, function( name, props ) {
|
27163 | jQuery.fn[ name ] = function( speed, easing, callback ) {
|
27164 | return this.animate( props, speed, easing, callback );
|
27165 | };
|
27166 | });
|
27167 |
|
27168 | jQuery.timers = [];
|
27169 | jQuery.fx.tick = function() {
|
27170 | var timer,
|
27171 | i = 0,
|
27172 | timers = jQuery.timers;
|
27173 |
|
27174 | fxNow = jQuery.now();
|
27175 |
|
27176 | for ( ; i < timers.length; i++ ) {
|
27177 | timer = timers[ i ];
|
27178 | // Checks the timer has not already been removed
|
27179 | if ( !timer() && timers[ i ] === timer ) {
|
27180 | timers.splice( i--, 1 );
|
27181 | }
|
27182 | }
|
27183 |
|
27184 | if ( !timers.length ) {
|
27185 | jQuery.fx.stop();
|
27186 | }
|
27187 | fxNow = undefined;
|
27188 | };
|
27189 |
|
27190 | jQuery.fx.timer = function( timer ) {
|
27191 | jQuery.timers.push( timer );
|
27192 | if ( timer() ) {
|
27193 | jQuery.fx.start();
|
27194 | } else {
|
27195 | jQuery.timers.pop();
|
27196 | }
|
27197 | };
|
27198 |
|
27199 | jQuery.fx.interval = 13;
|
27200 |
|
27201 | jQuery.fx.start = function() {
|
27202 | if ( !timerId ) {
|
27203 | timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
|
27204 | }
|
27205 | };
|
27206 |
|
27207 | jQuery.fx.stop = function() {
|
27208 | clearInterval( timerId );
|
27209 | timerId = null;
|
27210 | };
|
27211 |
|
27212 | jQuery.fx.speeds = {
|
27213 | slow: 600,
|
27214 | fast: 200,
|
27215 | // Default speed
|
27216 | _default: 400
|
27217 | };
|
27218 |
|
27219 |
|
27220 | // Based off of the plugin by Clint Helfers, with permission.
|
27221 | // http://blindsignals.com/index.php/2009/07/jquery-delay/
|
27222 | jQuery.fn.delay = function( time, type ) {
|
27223 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
|
27224 | type = type || "fx";
|
27225 |
|
27226 | return this.queue( type, function( next, hooks ) {
|
27227 | var timeout = setTimeout( next, time );
|
27228 | hooks.stop = function() {
|
27229 | clearTimeout( timeout );
|
27230 | };
|
27231 | });
|
27232 | };
|
27233 |
|
27234 |
|
27235 | (function() {
|
27236 | var input = document.createElement( "input" ),
|
27237 | select = document.createElement( "select" ),
|
27238 | opt = select.appendChild( document.createElement( "option" ) );
|
27239 |
|
27240 | input.type = "checkbox";
|
27241 |
|
27242 | // Support: iOS<=5.1, Android<=4.2+
|
27243 | // Default value for a checkbox should be "on"
|
27244 | support.checkOn = input.value !== "";
|
27245 |
|
27246 | // Support: IE<=11+
|
27247 | // Must access selectedIndex to make default options select
|
27248 | support.optSelected = opt.selected;
|
27249 |
|
27250 | // Support: Android<=2.3
|
27251 | // Options inside disabled selects are incorrectly marked as disabled
|
27252 | select.disabled = true;
|
27253 | support.optDisabled = !opt.disabled;
|
27254 |
|
27255 | // Support: IE<=11+
|
27256 | // An input loses its value after becoming a radio
|
27257 | input = document.createElement( "input" );
|
27258 | input.value = "t";
|
27259 | input.type = "radio";
|
27260 | support.radioValue = input.value === "t";
|
27261 | })();
|
27262 |
|
27263 |
|
27264 | var nodeHook, boolHook,
|
27265 | attrHandle = jQuery.expr.attrHandle;
|
27266 |
|
27267 | jQuery.fn.extend({
|
27268 | attr: function( name, value ) {
|
27269 | return access( this, jQuery.attr, name, value, arguments.length > 1 );
|
27270 | },
|
27271 |
|
27272 | removeAttr: function( name ) {
|
27273 | return this.each(function() {
|
27274 | jQuery.removeAttr( this, name );
|
27275 | });
|
27276 | }
|
27277 | });
|
27278 |
|
27279 | jQuery.extend({
|
27280 | attr: function( elem, name, value ) {
|
27281 | var hooks, ret,
|
27282 | nType = elem.nodeType;
|
27283 |
|
27284 | // don't get/set attributes on text, comment and attribute nodes
|
27285 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
27286 | return;
|
27287 | }
|
27288 |
|
27289 | // Fallback to prop when attributes are not supported
|
27290 | if ( typeof elem.getAttribute === strundefined ) {
|
27291 | return jQuery.prop( elem, name, value );
|
27292 | }
|
27293 |
|
27294 | // All attributes are lowercase
|
27295 | // Grab necessary hook if one is defined
|
27296 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
27297 | name = name.toLowerCase();
|
27298 | hooks = jQuery.attrHooks[ name ] ||
|
27299 | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
|
27300 | }
|
27301 |
|
27302 | if ( value !== undefined ) {
|
27303 |
|
27304 | if ( value === null ) {
|
27305 | jQuery.removeAttr( elem, name );
|
27306 |
|
27307 | } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
27308 | return ret;
|
27309 |
|
27310 | } else {
|
27311 | elem.setAttribute( name, value + "" );
|
27312 | return value;
|
27313 | }
|
27314 |
|
27315 | } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
27316 | return ret;
|
27317 |
|
27318 | } else {
|
27319 | ret = jQuery.find.attr( elem, name );
|
27320 |
|
27321 | // Non-existent attributes return null, we normalize to undefined
|
27322 | return ret == null ?
|
27323 | undefined :
|
27324 | ret;
|
27325 | }
|
27326 | },
|
27327 |
|
27328 | removeAttr: function( elem, value ) {
|
27329 | var name, propName,
|
27330 | i = 0,
|
27331 | attrNames = value && value.match( rnotwhite );
|
27332 |
|
27333 | if ( attrNames && elem.nodeType === 1 ) {
|
27334 | while ( (name = attrNames[i++]) ) {
|
27335 | propName = jQuery.propFix[ name ] || name;
|
27336 |
|
27337 | // Boolean attributes get special treatment (#10870)
|
27338 | if ( jQuery.expr.match.bool.test( name ) ) {
|
27339 | // Set corresponding property to false
|
27340 | elem[ propName ] = false;
|
27341 | }
|
27342 |
|
27343 | elem.removeAttribute( name );
|
27344 | }
|
27345 | }
|
27346 | },
|
27347 |
|
27348 | attrHooks: {
|
27349 | type: {
|
27350 | set: function( elem, value ) {
|
27351 | if ( !support.radioValue && value === "radio" &&
|
27352 | jQuery.nodeName( elem, "input" ) ) {
|
27353 | var val = elem.value;
|
27354 | elem.setAttribute( "type", value );
|
27355 | if ( val ) {
|
27356 | elem.value = val;
|
27357 | }
|
27358 | return value;
|
27359 | }
|
27360 | }
|
27361 | }
|
27362 | }
|
27363 | });
|
27364 |
|
27365 | // Hooks for boolean attributes
|
27366 | boolHook = {
|
27367 | set: function( elem, value, name ) {
|
27368 | if ( value === false ) {
|
27369 | // Remove boolean attributes when set to false
|
27370 | jQuery.removeAttr( elem, name );
|
27371 | } else {
|
27372 | elem.setAttribute( name, name );
|
27373 | }
|
27374 | return name;
|
27375 | }
|
27376 | };
|
27377 | jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
|
27378 | var getter = attrHandle[ name ] || jQuery.find.attr;
|
27379 |
|
27380 | attrHandle[ name ] = function( elem, name, isXML ) {
|
27381 | var ret, handle;
|
27382 | if ( !isXML ) {
|
27383 | // Avoid an infinite loop by temporarily removing this function from the getter
|
27384 | handle = attrHandle[ name ];
|
27385 | attrHandle[ name ] = ret;
|
27386 | ret = getter( elem, name, isXML ) != null ?
|
27387 | name.toLowerCase() :
|
27388 | null;
|
27389 | attrHandle[ name ] = handle;
|
27390 | }
|
27391 | return ret;
|
27392 | };
|
27393 | });
|
27394 |
|
27395 |
|
27396 |
|
27397 |
|
27398 | var rfocusable = /^(?:input|select|textarea|button)$/i;
|
27399 |
|
27400 | jQuery.fn.extend({
|
27401 | prop: function( name, value ) {
|
27402 | return access( this, jQuery.prop, name, value, arguments.length > 1 );
|
27403 | },
|
27404 |
|
27405 | removeProp: function( name ) {
|
27406 | return this.each(function() {
|
27407 | delete this[ jQuery.propFix[ name ] || name ];
|
27408 | });
|
27409 | }
|
27410 | });
|
27411 |
|
27412 | jQuery.extend({
|
27413 | propFix: {
|
27414 | "for": "htmlFor",
|
27415 | "class": "className"
|
27416 | },
|
27417 |
|
27418 | prop: function( elem, name, value ) {
|
27419 | var ret, hooks, notxml,
|
27420 | nType = elem.nodeType;
|
27421 |
|
27422 | // Don't get/set properties on text, comment and attribute nodes
|
27423 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
27424 | return;
|
27425 | }
|
27426 |
|
27427 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
27428 |
|
27429 | if ( notxml ) {
|
27430 | // Fix name and attach hooks
|
27431 | name = jQuery.propFix[ name ] || name;
|
27432 | hooks = jQuery.propHooks[ name ];
|
27433 | }
|
27434 |
|
27435 | if ( value !== undefined ) {
|
27436 | return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
|
27437 | ret :
|
27438 | ( elem[ name ] = value );
|
27439 |
|
27440 | } else {
|
27441 | return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
|
27442 | ret :
|
27443 | elem[ name ];
|
27444 | }
|
27445 | },
|
27446 |
|
27447 | propHooks: {
|
27448 | tabIndex: {
|
27449 | get: function( elem ) {
|
27450 | return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
|
27451 | elem.tabIndex :
|
27452 | -1;
|
27453 | }
|
27454 | }
|
27455 | }
|
27456 | });
|
27457 |
|
27458 | if ( !support.optSelected ) {
|
27459 | jQuery.propHooks.selected = {
|
27460 | get: function( elem ) {
|
27461 | var parent = elem.parentNode;
|
27462 | if ( parent && parent.parentNode ) {
|
27463 | parent.parentNode.selectedIndex;
|
27464 | }
|
27465 | return null;
|
27466 | }
|
27467 | };
|
27468 | }
|
27469 |
|
27470 | jQuery.each([
|
27471 | "tabIndex",
|
27472 | "readOnly",
|
27473 | "maxLength",
|
27474 | "cellSpacing",
|
27475 | "cellPadding",
|
27476 | "rowSpan",
|
27477 | "colSpan",
|
27478 | "useMap",
|
27479 | "frameBorder",
|
27480 | "contentEditable"
|
27481 | ], function() {
|
27482 | jQuery.propFix[ this.toLowerCase() ] = this;
|
27483 | });
|
27484 |
|
27485 |
|
27486 |
|
27487 |
|
27488 | var rclass = /[\t\r\n\f]/g;
|
27489 |
|
27490 | jQuery.fn.extend({
|
27491 | addClass: function( value ) {
|
27492 | var classes, elem, cur, clazz, j, finalValue,
|
27493 | proceed = typeof value === "string" && value,
|
27494 | i = 0,
|
27495 | len = this.length;
|
27496 |
|
27497 | if ( jQuery.isFunction( value ) ) {
|
27498 | return this.each(function( j ) {
|
27499 | jQuery( this ).addClass( value.call( this, j, this.className ) );
|
27500 | });
|
27501 | }
|
27502 |
|
27503 | if ( proceed ) {
|
27504 | // The disjunction here is for better compressibility (see removeClass)
|
27505 | classes = ( value || "" ).match( rnotwhite ) || [];
|
27506 |
|
27507 | for ( ; i < len; i++ ) {
|
27508 | elem = this[ i ];
|
27509 | cur = elem.nodeType === 1 && ( elem.className ?
|
27510 | ( " " + elem.className + " " ).replace( rclass, " " ) :
|
27511 | " "
|
27512 | );
|
27513 |
|
27514 | if ( cur ) {
|
27515 | j = 0;
|
27516 | while ( (clazz = classes[j++]) ) {
|
27517 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
27518 | cur += clazz + " ";
|
27519 | }
|
27520 | }
|
27521 |
|
27522 | // only assign if different to avoid unneeded rendering.
|
27523 | finalValue = jQuery.trim( cur );
|
27524 | if ( elem.className !== finalValue ) {
|
27525 | elem.className = finalValue;
|
27526 | }
|
27527 | }
|
27528 | }
|
27529 | }
|
27530 |
|
27531 | return this;
|
27532 | },
|
27533 |
|
27534 | removeClass: function( value ) {
|
27535 | var classes, elem, cur, clazz, j, finalValue,
|
27536 | proceed = arguments.length === 0 || typeof value === "string" && value,
|
27537 | i = 0,
|
27538 | len = this.length;
|
27539 |
|
27540 | if ( jQuery.isFunction( value ) ) {
|
27541 | return this.each(function( j ) {
|
27542 | jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
27543 | });
|
27544 | }
|
27545 | if ( proceed ) {
|
27546 | classes = ( value || "" ).match( rnotwhite ) || [];
|
27547 |
|
27548 | for ( ; i < len; i++ ) {
|
27549 | elem = this[ i ];
|
27550 | // This expression is here for better compressibility (see addClass)
|
27551 | cur = elem.nodeType === 1 && ( elem.className ?
|
27552 | ( " " + elem.className + " " ).replace( rclass, " " ) :
|
27553 | ""
|
27554 | );
|
27555 |
|
27556 | if ( cur ) {
|
27557 | j = 0;
|
27558 | while ( (clazz = classes[j++]) ) {
|
27559 | // Remove *all* instances
|
27560 | while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
|
27561 | cur = cur.replace( " " + clazz + " ", " " );
|
27562 | }
|
27563 | }
|
27564 |
|
27565 | // Only assign if different to avoid unneeded rendering.
|
27566 | finalValue = value ? jQuery.trim( cur ) : "";
|
27567 | if ( elem.className !== finalValue ) {
|
27568 | elem.className = finalValue;
|
27569 | }
|
27570 | }
|
27571 | }
|
27572 | }
|
27573 |
|
27574 | return this;
|
27575 | },
|
27576 |
|
27577 | toggleClass: function( value, stateVal ) {
|
27578 | var type = typeof value;
|
27579 |
|
27580 | if ( typeof stateVal === "boolean" && type === "string" ) {
|
27581 | return stateVal ? this.addClass( value ) : this.removeClass( value );
|
27582 | }
|
27583 |
|
27584 | if ( jQuery.isFunction( value ) ) {
|
27585 | return this.each(function( i ) {
|
27586 | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
27587 | });
|
27588 | }
|
27589 |
|
27590 | return this.each(function() {
|
27591 | if ( type === "string" ) {
|
27592 | // Toggle individual class names
|
27593 | var className,
|
27594 | i = 0,
|
27595 | self = jQuery( this ),
|
27596 | classNames = value.match( rnotwhite ) || [];
|
27597 |
|
27598 | while ( (className = classNames[ i++ ]) ) {
|
27599 | // Check each className given, space separated list
|
27600 | if ( self.hasClass( className ) ) {
|
27601 | self.removeClass( className );
|
27602 | } else {
|
27603 | self.addClass( className );
|
27604 | }
|
27605 | }
|
27606 |
|
27607 | // Toggle whole class name
|
27608 | } else if ( type === strundefined || type === "boolean" ) {
|
27609 | if ( this.className ) {
|
27610 | // store className if set
|
27611 | data_priv.set( this, "__className__", this.className );
|
27612 | }
|
27613 |
|
27614 | // If the element has a class name or if we're passed `false`,
|
27615 | // then remove the whole classname (if there was one, the above saved it).
|
27616 | // Otherwise bring back whatever was previously saved (if anything),
|
27617 | // falling back to the empty string if nothing was stored.
|
27618 | this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
|
27619 | }
|
27620 | });
|
27621 | },
|
27622 |
|
27623 | hasClass: function( selector ) {
|
27624 | var className = " " + selector + " ",
|
27625 | i = 0,
|
27626 | l = this.length;
|
27627 | for ( ; i < l; i++ ) {
|
27628 | if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
|
27629 | return true;
|
27630 | }
|
27631 | }
|
27632 |
|
27633 | return false;
|
27634 | }
|
27635 | });
|
27636 |
|
27637 |
|
27638 |
|
27639 |
|
27640 | var rreturn = /\r/g;
|
27641 |
|
27642 | jQuery.fn.extend({
|
27643 | val: function( value ) {
|
27644 | var hooks, ret, isFunction,
|
27645 | elem = this[0];
|
27646 |
|
27647 | if ( !arguments.length ) {
|
27648 | if ( elem ) {
|
27649 | hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
27650 |
|
27651 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
27652 | return ret;
|
27653 | }
|
27654 |
|
27655 | ret = elem.value;
|
27656 |
|
27657 | return typeof ret === "string" ?
|
27658 | // Handle most common string cases
|
27659 | ret.replace(rreturn, "") :
|
27660 | // Handle cases where value is null/undef or number
|
27661 | ret == null ? "" : ret;
|
27662 | }
|
27663 |
|
27664 | return;
|
27665 | }
|
27666 |
|
27667 | isFunction = jQuery.isFunction( value );
|
27668 |
|
27669 | return this.each(function( i ) {
|
27670 | var val;
|
27671 |
|
27672 | if ( this.nodeType !== 1 ) {
|
27673 | return;
|
27674 | }
|
27675 |
|
27676 | if ( isFunction ) {
|
27677 | val = value.call( this, i, jQuery( this ).val() );
|
27678 | } else {
|
27679 | val = value;
|
27680 | }
|
27681 |
|
27682 | // Treat null/undefined as ""; convert numbers to string
|
27683 | if ( val == null ) {
|
27684 | val = "";
|
27685 |
|
27686 | } else if ( typeof val === "number" ) {
|
27687 | val += "";
|
27688 |
|
27689 | } else if ( jQuery.isArray( val ) ) {
|
27690 | val = jQuery.map( val, function( value ) {
|
27691 | return value == null ? "" : value + "";
|
27692 | });
|
27693 | }
|
27694 |
|
27695 | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
27696 |
|
27697 | // If set returns undefined, fall back to normal setting
|
27698 | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
27699 | this.value = val;
|
27700 | }
|
27701 | });
|
27702 | }
|
27703 | });
|
27704 |
|
27705 | jQuery.extend({
|
27706 | valHooks: {
|
27707 | option: {
|
27708 | get: function( elem ) {
|
27709 | var val = jQuery.find.attr( elem, "value" );
|
27710 | return val != null ?
|
27711 | val :
|
27712 | // Support: IE10-11+
|
27713 | // option.text throws exceptions (#14686, #14858)
|
27714 | jQuery.trim( jQuery.text( elem ) );
|
27715 | }
|
27716 | },
|
27717 | select: {
|
27718 | get: function( elem ) {
|
27719 | var value, option,
|
27720 | options = elem.options,
|
27721 | index = elem.selectedIndex,
|
27722 | one = elem.type === "select-one" || index < 0,
|
27723 | values = one ? null : [],
|
27724 | max = one ? index + 1 : options.length,
|
27725 | i = index < 0 ?
|
27726 | max :
|
27727 | one ? index : 0;
|
27728 |
|
27729 | // Loop through all the selected options
|
27730 | for ( ; i < max; i++ ) {
|
27731 | option = options[ i ];
|
27732 |
|
27733 | // IE6-9 doesn't update selected after form reset (#2551)
|
27734 | if ( ( option.selected || i === index ) &&
|
27735 | // Don't return options that are disabled or in a disabled optgroup
|
27736 | ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
|
27737 | ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
27738 |
|
27739 | // Get the specific value for the option
|
27740 | value = jQuery( option ).val();
|
27741 |
|
27742 | // We don't need an array for one selects
|
27743 | if ( one ) {
|
27744 | return value;
|
27745 | }
|
27746 |
|
27747 | // Multi-Selects return an array
|
27748 | values.push( value );
|
27749 | }
|
27750 | }
|
27751 |
|
27752 | return values;
|
27753 | },
|
27754 |
|
27755 | set: function( elem, value ) {
|
27756 | var optionSet, option,
|
27757 | options = elem.options,
|
27758 | values = jQuery.makeArray( value ),
|
27759 | i = options.length;
|
27760 |
|
27761 | while ( i-- ) {
|
27762 | option = options[ i ];
|
27763 | if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
|
27764 | optionSet = true;
|
27765 | }
|
27766 | }
|
27767 |
|
27768 | // Force browsers to behave consistently when non-matching value is set
|
27769 | if ( !optionSet ) {
|
27770 | elem.selectedIndex = -1;
|
27771 | }
|
27772 | return values;
|
27773 | }
|
27774 | }
|
27775 | }
|
27776 | });
|
27777 |
|
27778 | // Radios and checkboxes getter/setter
|
27779 | jQuery.each([ "radio", "checkbox" ], function() {
|
27780 | jQuery.valHooks[ this ] = {
|
27781 | set: function( elem, value ) {
|
27782 | if ( jQuery.isArray( value ) ) {
|
27783 | return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
|
27784 | }
|
27785 | }
|
27786 | };
|
27787 | if ( !support.checkOn ) {
|
27788 | jQuery.valHooks[ this ].get = function( elem ) {
|
27789 | return elem.getAttribute("value") === null ? "on" : elem.value;
|
27790 | };
|
27791 | }
|
27792 | });
|
27793 |
|
27794 |
|
27795 |
|
27796 |
|
27797 | // Return jQuery for attributes-only inclusion
|
27798 |
|
27799 |
|
27800 | jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
27801 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
27802 | "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
|
27803 |
|
27804 | // Handle event binding
|
27805 | jQuery.fn[ name ] = function( data, fn ) {
|
27806 | return arguments.length > 0 ?
|
27807 | this.on( name, null, data, fn ) :
|
27808 | this.trigger( name );
|
27809 | };
|
27810 | });
|
27811 |
|
27812 | jQuery.fn.extend({
|
27813 | hover: function( fnOver, fnOut ) {
|
27814 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
27815 | },
|
27816 |
|
27817 | bind: function( types, data, fn ) {
|
27818 | return this.on( types, null, data, fn );
|
27819 | },
|
27820 | unbind: function( types, fn ) {
|
27821 | return this.off( types, null, fn );
|
27822 | },
|
27823 |
|
27824 | delegate: function( selector, types, data, fn ) {
|
27825 | return this.on( types, selector, data, fn );
|
27826 | },
|
27827 | undelegate: function( selector, types, fn ) {
|
27828 | // ( namespace ) or ( selector, types [, fn] )
|
27829 | return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
|
27830 | }
|
27831 | });
|
27832 |
|
27833 |
|
27834 | var nonce = jQuery.now();
|
27835 |
|
27836 | var rquery = (/\?/);
|
27837 |
|
27838 |
|
27839 |
|
27840 | // Support: Android 2.3
|
27841 | // Workaround failure to string-cast null input
|
27842 | jQuery.parseJSON = function( data ) {
|
27843 | return JSON.parse( data + "" );
|
27844 | };
|
27845 |
|
27846 |
|
27847 | // Cross-browser xml parsing
|
27848 | jQuery.parseXML = function( data ) {
|
27849 | var xml, tmp;
|
27850 | if ( !data || typeof data !== "string" ) {
|
27851 | return null;
|
27852 | }
|
27853 |
|
27854 | // Support: IE9
|
27855 | try {
|
27856 | tmp = new DOMParser();
|
27857 | xml = tmp.parseFromString( data, "text/xml" );
|
27858 | } catch ( e ) {
|
27859 | xml = undefined;
|
27860 | }
|
27861 |
|
27862 | if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
|
27863 | jQuery.error( "Invalid XML: " + data );
|
27864 | }
|
27865 | return xml;
|
27866 | };
|
27867 |
|
27868 |
|
27869 | var
|
27870 | rhash = /#.*$/,
|
27871 | rts = /([?&])_=[^&]*/,
|
27872 | rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
|
27873 | // #7653, #8125, #8152: local protocol detection
|
27874 | rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
|
27875 | rnoContent = /^(?:GET|HEAD)$/,
|
27876 | rprotocol = /^\/\//,
|
27877 | rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
|
27878 |
|
27879 | /* Prefilters
|
27880 | * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
27881 | * 2) These are called:
|
27882 | * - BEFORE asking for a transport
|
27883 | * - AFTER param serialization (s.data is a string if s.processData is true)
|
27884 | * 3) key is the dataType
|
27885 | * 4) the catchall symbol "*" can be used
|
27886 | * 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
27887 | */
|
27888 | prefilters = {},
|
27889 |
|
27890 | /* Transports bindings
|
27891 | * 1) key is the dataType
|
27892 | * 2) the catchall symbol "*" can be used
|
27893 | * 3) selection will start with transport dataType and THEN go to "*" if needed
|
27894 | */
|
27895 | transports = {},
|
27896 |
|
27897 | // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
27898 | allTypes = "*/".concat( "*" ),
|
27899 |
|
27900 | // Document location
|
27901 | ajaxLocation = window.location.href,
|
27902 |
|
27903 | // Segment location into parts
|
27904 | ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
|
27905 |
|
27906 | // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
27907 | function addToPrefiltersOrTransports( structure ) {
|
27908 |
|
27909 | // dataTypeExpression is optional and defaults to "*"
|
27910 | return function( dataTypeExpression, func ) {
|
27911 |
|
27912 | if ( typeof dataTypeExpression !== "string" ) {
|
27913 | func = dataTypeExpression;
|
27914 | dataTypeExpression = "*";
|
27915 | }
|
27916 |
|
27917 | var dataType,
|
27918 | i = 0,
|
27919 | dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
|
27920 |
|
27921 | if ( jQuery.isFunction( func ) ) {
|
27922 | // For each dataType in the dataTypeExpression
|
27923 | while ( (dataType = dataTypes[i++]) ) {
|
27924 | // Prepend if requested
|
27925 | if ( dataType[0] === "+" ) {
|
27926 | dataType = dataType.slice( 1 ) || "*";
|
27927 | (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
|
27928 |
|
27929 | // Otherwise append
|
27930 | } else {
|
27931 | (structure[ dataType ] = structure[ dataType ] || []).push( func );
|
27932 | }
|
27933 | }
|
27934 | }
|
27935 | };
|
27936 | }
|
27937 |
|
27938 | // Base inspection function for prefilters and transports
|
27939 | function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
27940 |
|
27941 | var inspected = {},
|
27942 | seekingTransport = ( structure === transports );
|
27943 |
|
27944 | function inspect( dataType ) {
|
27945 | var selected;
|
27946 | inspected[ dataType ] = true;
|
27947 | jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
|
27948 | var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
|
27949 | if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
|
27950 | options.dataTypes.unshift( dataTypeOrTransport );
|
27951 | inspect( dataTypeOrTransport );
|
27952 | return false;
|
27953 | } else if ( seekingTransport ) {
|
27954 | return !( selected = dataTypeOrTransport );
|
27955 | }
|
27956 | });
|
27957 | return selected;
|
27958 | }
|
27959 |
|
27960 | return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
27961 | }
|
27962 |
|
27963 | // A special extend for ajax options
|
27964 | // that takes "flat" options (not to be deep extended)
|
27965 | // Fixes #9887
|
27966 | function ajaxExtend( target, src ) {
|
27967 | var key, deep,
|
27968 | flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
27969 |
|
27970 | for ( key in src ) {
|
27971 | if ( src[ key ] !== undefined ) {
|
27972 | ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
|
27973 | }
|
27974 | }
|
27975 | if ( deep ) {
|
27976 | jQuery.extend( true, target, deep );
|
27977 | }
|
27978 |
|
27979 | return target;
|
27980 | }
|
27981 |
|
27982 | /* Handles responses to an ajax request:
|
27983 | * - finds the right dataType (mediates between content-type and expected dataType)
|
27984 | * - returns the corresponding response
|
27985 | */
|
27986 | function ajaxHandleResponses( s, jqXHR, responses ) {
|
27987 |
|
27988 | var ct, type, finalDataType, firstDataType,
|
27989 | contents = s.contents,
|
27990 | dataTypes = s.dataTypes;
|
27991 |
|
27992 | // Remove auto dataType and get content-type in the process
|
27993 | while ( dataTypes[ 0 ] === "*" ) {
|
27994 | dataTypes.shift();
|
27995 | if ( ct === undefined ) {
|
27996 | ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
|
27997 | }
|
27998 | }
|
27999 |
|
28000 | // Check if we're dealing with a known content-type
|
28001 | if ( ct ) {
|
28002 | for ( type in contents ) {
|
28003 | if ( contents[ type ] && contents[ type ].test( ct ) ) {
|
28004 | dataTypes.unshift( type );
|
28005 | break;
|
28006 | }
|
28007 | }
|
28008 | }
|
28009 |
|
28010 | // Check to see if we have a response for the expected dataType
|
28011 | if ( dataTypes[ 0 ] in responses ) {
|
28012 | finalDataType = dataTypes[ 0 ];
|
28013 | } else {
|
28014 | // Try convertible dataTypes
|
28015 | for ( type in responses ) {
|
28016 | if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
|
28017 | finalDataType = type;
|
28018 | break;
|
28019 | }
|
28020 | if ( !firstDataType ) {
|
28021 | firstDataType = type;
|
28022 | }
|
28023 | }
|
28024 | // Or just use first one
|
28025 | finalDataType = finalDataType || firstDataType;
|
28026 | }
|
28027 |
|
28028 | // If we found a dataType
|
28029 | // We add the dataType to the list if needed
|
28030 | // and return the corresponding response
|
28031 | if ( finalDataType ) {
|
28032 | if ( finalDataType !== dataTypes[ 0 ] ) {
|
28033 | dataTypes.unshift( finalDataType );
|
28034 | }
|
28035 | return responses[ finalDataType ];
|
28036 | }
|
28037 | }
|
28038 |
|
28039 | /* Chain conversions given the request and the original response
|
28040 | * Also sets the responseXXX fields on the jqXHR instance
|
28041 | */
|
28042 | function ajaxConvert( s, response, jqXHR, isSuccess ) {
|
28043 | var conv2, current, conv, tmp, prev,
|
28044 | converters = {},
|
28045 | // Work with a copy of dataTypes in case we need to modify it for conversion
|
28046 | dataTypes = s.dataTypes.slice();
|
28047 |
|
28048 | // Create converters map with lowercased keys
|
28049 | if ( dataTypes[ 1 ] ) {
|
28050 | for ( conv in s.converters ) {
|
28051 | converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
28052 | }
|
28053 | }
|
28054 |
|
28055 | current = dataTypes.shift();
|
28056 |
|
28057 | // Convert to each sequential dataType
|
28058 | while ( current ) {
|
28059 |
|
28060 | if ( s.responseFields[ current ] ) {
|
28061 | jqXHR[ s.responseFields[ current ] ] = response;
|
28062 | }
|
28063 |
|
28064 | // Apply the dataFilter if provided
|
28065 | if ( !prev && isSuccess && s.dataFilter ) {
|
28066 | response = s.dataFilter( response, s.dataType );
|
28067 | }
|
28068 |
|
28069 | prev = current;
|
28070 | current = dataTypes.shift();
|
28071 |
|
28072 | if ( current ) {
|
28073 |
|
28074 | // There's only work to do if current dataType is non-auto
|
28075 | if ( current === "*" ) {
|
28076 |
|
28077 | current = prev;
|
28078 |
|
28079 | // Convert response if prev dataType is non-auto and differs from current
|
28080 | } else if ( prev !== "*" && prev !== current ) {
|
28081 |
|
28082 | // Seek a direct converter
|
28083 | conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
28084 |
|
28085 | // If none found, seek a pair
|
28086 | if ( !conv ) {
|
28087 | for ( conv2 in converters ) {
|
28088 |
|
28089 | // If conv2 outputs current
|
28090 | tmp = conv2.split( " " );
|
28091 | if ( tmp[ 1 ] === current ) {
|
28092 |
|
28093 | // If prev can be converted to accepted input
|
28094 | conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
28095 | converters[ "* " + tmp[ 0 ] ];
|
28096 | if ( conv ) {
|
28097 | // Condense equivalence converters
|
28098 | if ( conv === true ) {
|
28099 | conv = converters[ conv2 ];
|
28100 |
|
28101 | // Otherwise, insert the intermediate dataType
|
28102 | } else if ( converters[ conv2 ] !== true ) {
|
28103 | current = tmp[ 0 ];
|
28104 | dataTypes.unshift( tmp[ 1 ] );
|
28105 | }
|
28106 | break;
|
28107 | }
|
28108 | }
|
28109 | }
|
28110 | }
|
28111 |
|
28112 | // Apply converter (if not an equivalence)
|
28113 | if ( conv !== true ) {
|
28114 |
|
28115 | // Unless errors are allowed to bubble, catch and return them
|
28116 | if ( conv && s[ "throws" ] ) {
|
28117 | response = conv( response );
|
28118 | } else {
|
28119 | try {
|
28120 | response = conv( response );
|
28121 | } catch ( e ) {
|
28122 | return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
|
28123 | }
|
28124 | }
|
28125 | }
|
28126 | }
|
28127 | }
|
28128 | }
|
28129 |
|
28130 | return { state: "success", data: response };
|
28131 | }
|
28132 |
|
28133 | jQuery.extend({
|
28134 |
|
28135 | // Counter for holding the number of active queries
|
28136 | active: 0,
|
28137 |
|
28138 | // Last-Modified header cache for next request
|
28139 | lastModified: {},
|
28140 | etag: {},
|
28141 |
|
28142 | ajaxSettings: {
|
28143 | url: ajaxLocation,
|
28144 | type: "GET",
|
28145 | isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
|
28146 | global: true,
|
28147 | processData: true,
|
28148 | async: true,
|
28149 | contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
28150 | /*
|
28151 | timeout: 0,
|
28152 | data: null,
|
28153 | dataType: null,
|
28154 | username: null,
|
28155 | password: null,
|
28156 | cache: null,
|
28157 | throws: false,
|
28158 | traditional: false,
|
28159 | headers: {},
|
28160 | */
|
28161 |
|
28162 | accepts: {
|
28163 | "*": allTypes,
|
28164 | text: "text/plain",
|
28165 | html: "text/html",
|
28166 | xml: "application/xml, text/xml",
|
28167 | json: "application/json, text/javascript"
|
28168 | },
|
28169 |
|
28170 | contents: {
|
28171 | xml: /xml/,
|
28172 | html: /html/,
|
28173 | json: /json/
|
28174 | },
|
28175 |
|
28176 | responseFields: {
|
28177 | xml: "responseXML",
|
28178 | text: "responseText",
|
28179 | json: "responseJSON"
|
28180 | },
|
28181 |
|
28182 | // Data converters
|
28183 | // Keys separate source (or catchall "*") and destination types with a single space
|
28184 | converters: {
|
28185 |
|
28186 | // Convert anything to text
|
28187 | "* text": String,
|
28188 |
|
28189 | // Text to html (true = no transformation)
|
28190 | "text html": true,
|
28191 |
|
28192 | // Evaluate text as a json expression
|
28193 | "text json": jQuery.parseJSON,
|
28194 |
|
28195 | // Parse text as xml
|
28196 | "text xml": jQuery.parseXML
|
28197 | },
|
28198 |
|
28199 | // For options that shouldn't be deep extended:
|
28200 | // you can add your own custom options here if
|
28201 | // and when you create one that shouldn't be
|
28202 | // deep extended (see ajaxExtend)
|
28203 | flatOptions: {
|
28204 | url: true,
|
28205 | context: true
|
28206 | }
|
28207 | },
|
28208 |
|
28209 | // Creates a full fledged settings object into target
|
28210 | // with both ajaxSettings and settings fields.
|
28211 | // If target is omitted, writes into ajaxSettings.
|
28212 | ajaxSetup: function( target, settings ) {
|
28213 | return settings ?
|
28214 |
|
28215 | // Building a settings object
|
28216 | ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
28217 |
|
28218 | // Extending ajaxSettings
|
28219 | ajaxExtend( jQuery.ajaxSettings, target );
|
28220 | },
|
28221 |
|
28222 | ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
28223 | ajaxTransport: addToPrefiltersOrTransports( transports ),
|
28224 |
|
28225 | // Main method
|
28226 | ajax: function( url, options ) {
|
28227 |
|
28228 | // If url is an object, simulate pre-1.5 signature
|
28229 | if ( typeof url === "object" ) {
|
28230 | options = url;
|
28231 | url = undefined;
|
28232 | }
|
28233 |
|
28234 | // Force options to be an object
|
28235 | options = options || {};
|
28236 |
|
28237 | var transport,
|
28238 | // URL without anti-cache param
|
28239 | cacheURL,
|
28240 | // Response headers
|
28241 | responseHeadersString,
|
28242 | responseHeaders,
|
28243 | // timeout handle
|
28244 | timeoutTimer,
|
28245 | // Cross-domain detection vars
|
28246 | parts,
|
28247 | // To know if global events are to be dispatched
|
28248 | fireGlobals,
|
28249 | // Loop variable
|
28250 | i,
|
28251 | // Create the final options object
|
28252 | s = jQuery.ajaxSetup( {}, options ),
|
28253 | // Callbacks context
|
28254 | callbackContext = s.context || s,
|
28255 | // Context for global events is callbackContext if it is a DOM node or jQuery collection
|
28256 | globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
|
28257 | jQuery( callbackContext ) :
|
28258 | jQuery.event,
|
28259 | // Deferreds
|
28260 | deferred = jQuery.Deferred(),
|
28261 | completeDeferred = jQuery.Callbacks("once memory"),
|
28262 | // Status-dependent callbacks
|
28263 | statusCode = s.statusCode || {},
|
28264 | // Headers (they are sent all at once)
|
28265 | requestHeaders = {},
|
28266 | requestHeadersNames = {},
|
28267 | // The jqXHR state
|
28268 | state = 0,
|
28269 | // Default abort message
|
28270 | strAbort = "canceled",
|
28271 | // Fake xhr
|
28272 | jqXHR = {
|
28273 | readyState: 0,
|
28274 |
|
28275 | // Builds headers hashtable if needed
|
28276 | getResponseHeader: function( key ) {
|
28277 | var match;
|
28278 | if ( state === 2 ) {
|
28279 | if ( !responseHeaders ) {
|
28280 | responseHeaders = {};
|
28281 | while ( (match = rheaders.exec( responseHeadersString )) ) {
|
28282 | responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
|
28283 | }
|
28284 | }
|
28285 | match = responseHeaders[ key.toLowerCase() ];
|
28286 | }
|
28287 | return match == null ? null : match;
|
28288 | },
|
28289 |
|
28290 | // Raw string
|
28291 | getAllResponseHeaders: function() {
|
28292 | return state === 2 ? responseHeadersString : null;
|
28293 | },
|
28294 |
|
28295 | // Caches the header
|
28296 | setRequestHeader: function( name, value ) {
|
28297 | var lname = name.toLowerCase();
|
28298 | if ( !state ) {
|
28299 | name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
|
28300 | requestHeaders[ name ] = value;
|
28301 | }
|
28302 | return this;
|
28303 | },
|
28304 |
|
28305 | // Overrides response content-type header
|
28306 | overrideMimeType: function( type ) {
|
28307 | if ( !state ) {
|
28308 | s.mimeType = type;
|
28309 | }
|
28310 | return this;
|
28311 | },
|
28312 |
|
28313 | // Status-dependent callbacks
|
28314 | statusCode: function( map ) {
|
28315 | var code;
|
28316 | if ( map ) {
|
28317 | if ( state < 2 ) {
|
28318 | for ( code in map ) {
|
28319 | // Lazy-add the new callback in a way that preserves old ones
|
28320 | statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
|
28321 | }
|
28322 | } else {
|
28323 | // Execute the appropriate callbacks
|
28324 | jqXHR.always( map[ jqXHR.status ] );
|
28325 | }
|
28326 | }
|
28327 | return this;
|
28328 | },
|
28329 |
|
28330 | // Cancel the request
|
28331 | abort: function( statusText ) {
|
28332 | var finalText = statusText || strAbort;
|
28333 | if ( transport ) {
|
28334 | transport.abort( finalText );
|
28335 | }
|
28336 | done( 0, finalText );
|
28337 | return this;
|
28338 | }
|
28339 | };
|
28340 |
|
28341 | // Attach deferreds
|
28342 | deferred.promise( jqXHR ).complete = completeDeferred.add;
|
28343 | jqXHR.success = jqXHR.done;
|
28344 | jqXHR.error = jqXHR.fail;
|
28345 |
|
28346 | // Remove hash character (#7531: and string promotion)
|
28347 | // Add protocol if not provided (prefilters might expect it)
|
28348 | // Handle falsy url in the settings object (#10093: consistency with old signature)
|
28349 | // We also use the url parameter if available
|
28350 | s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
|
28351 | .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
|
28352 |
|
28353 | // Alias method option to type as per ticket #12004
|
28354 | s.type = options.method || options.type || s.method || s.type;
|
28355 |
|
28356 | // Extract dataTypes list
|
28357 | s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
|
28358 |
|
28359 | // A cross-domain request is in order when we have a protocol:host:port mismatch
|
28360 | if ( s.crossDomain == null ) {
|
28361 | parts = rurl.exec( s.url.toLowerCase() );
|
28362 | s.crossDomain = !!( parts &&
|
28363 | ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
|
28364 | ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
|
28365 | ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
|
28366 | );
|
28367 | }
|
28368 |
|
28369 | // Convert data if not already a string
|
28370 | if ( s.data && s.processData && typeof s.data !== "string" ) {
|
28371 | s.data = jQuery.param( s.data, s.traditional );
|
28372 | }
|
28373 |
|
28374 | // Apply prefilters
|
28375 | inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
28376 |
|
28377 | // If request was aborted inside a prefilter, stop there
|
28378 | if ( state === 2 ) {
|
28379 | return jqXHR;
|
28380 | }
|
28381 |
|
28382 | // We can fire global events as of now if asked to
|
28383 | // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
|
28384 | fireGlobals = jQuery.event && s.global;
|
28385 |
|
28386 | // Watch for a new set of requests
|
28387 | if ( fireGlobals && jQuery.active++ === 0 ) {
|
28388 | jQuery.event.trigger("ajaxStart");
|
28389 | }
|
28390 |
|
28391 | // Uppercase the type
|
28392 | s.type = s.type.toUpperCase();
|
28393 |
|
28394 | // Determine if request has content
|
28395 | s.hasContent = !rnoContent.test( s.type );
|
28396 |
|
28397 | // Save the URL in case we're toying with the If-Modified-Since
|
28398 | // and/or If-None-Match header later on
|
28399 | cacheURL = s.url;
|
28400 |
|
28401 | // More options handling for requests with no content
|
28402 | if ( !s.hasContent ) {
|
28403 |
|
28404 | // If data is available, append data to url
|
28405 | if ( s.data ) {
|
28406 | cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
|
28407 | // #9682: remove data so that it's not used in an eventual retry
|
28408 | delete s.data;
|
28409 | }
|
28410 |
|
28411 | // Add anti-cache in url if needed
|
28412 | if ( s.cache === false ) {
|
28413 | s.url = rts.test( cacheURL ) ?
|
28414 |
|
28415 | // If there is already a '_' parameter, set its value
|
28416 | cacheURL.replace( rts, "$1_=" + nonce++ ) :
|
28417 |
|
28418 | // Otherwise add one to the end
|
28419 | cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
|
28420 | }
|
28421 | }
|
28422 |
|
28423 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
28424 | if ( s.ifModified ) {
|
28425 | if ( jQuery.lastModified[ cacheURL ] ) {
|
28426 | jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
|
28427 | }
|
28428 | if ( jQuery.etag[ cacheURL ] ) {
|
28429 | jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
28430 | }
|
28431 | }
|
28432 |
|
28433 | // Set the correct header, if data is being sent
|
28434 | if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
28435 | jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
28436 | }
|
28437 |
|
28438 | // Set the Accepts header for the server, depending on the dataType
|
28439 | jqXHR.setRequestHeader(
|
28440 | "Accept",
|
28441 | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
|
28442 | s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
28443 | s.accepts[ "*" ]
|
28444 | );
|
28445 |
|
28446 | // Check for headers option
|
28447 | for ( i in s.headers ) {
|
28448 | jqXHR.setRequestHeader( i, s.headers[ i ] );
|
28449 | }
|
28450 |
|
28451 | // Allow custom headers/mimetypes and early abort
|
28452 | if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
|
28453 | // Abort if not done already and return
|
28454 | return jqXHR.abort();
|
28455 | }
|
28456 |
|
28457 | // Aborting is no longer a cancellation
|
28458 | strAbort = "abort";
|
28459 |
|
28460 | // Install callbacks on deferreds
|
28461 | for ( i in { success: 1, error: 1, complete: 1 } ) {
|
28462 | jqXHR[ i ]( s[ i ] );
|
28463 | }
|
28464 |
|
28465 | // Get transport
|
28466 | transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
28467 |
|
28468 | // If no transport, we auto-abort
|
28469 | if ( !transport ) {
|
28470 | done( -1, "No Transport" );
|
28471 | } else {
|
28472 | jqXHR.readyState = 1;
|
28473 |
|
28474 | // Send global event
|
28475 | if ( fireGlobals ) {
|
28476 | globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
28477 | }
|
28478 | // Timeout
|
28479 | if ( s.async && s.timeout > 0 ) {
|
28480 | timeoutTimer = setTimeout(function() {
|
28481 | jqXHR.abort("timeout");
|
28482 | }, s.timeout );
|
28483 | }
|
28484 |
|
28485 | try {
|
28486 | state = 1;
|
28487 | transport.send( requestHeaders, done );
|
28488 | } catch ( e ) {
|
28489 | // Propagate exception as error if not done
|
28490 | if ( state < 2 ) {
|
28491 | done( -1, e );
|
28492 | // Simply rethrow otherwise
|
28493 | } else {
|
28494 | throw e;
|
28495 | }
|
28496 | }
|
28497 | }
|
28498 |
|
28499 | // Callback for when everything is done
|
28500 | function done( status, nativeStatusText, responses, headers ) {
|
28501 | var isSuccess, success, error, response, modified,
|
28502 | statusText = nativeStatusText;
|
28503 |
|
28504 | // Called once
|
28505 | if ( state === 2 ) {
|
28506 | return;
|
28507 | }
|
28508 |
|
28509 | // State is "done" now
|
28510 | state = 2;
|
28511 |
|
28512 | // Clear timeout if it exists
|
28513 | if ( timeoutTimer ) {
|
28514 | clearTimeout( timeoutTimer );
|
28515 | }
|
28516 |
|
28517 | // Dereference transport for early garbage collection
|
28518 | // (no matter how long the jqXHR object will be used)
|
28519 | transport = undefined;
|
28520 |
|
28521 | // Cache response headers
|
28522 | responseHeadersString = headers || "";
|
28523 |
|
28524 | // Set readyState
|
28525 | jqXHR.readyState = status > 0 ? 4 : 0;
|
28526 |
|
28527 | // Determine if successful
|
28528 | isSuccess = status >= 200 && status < 300 || status === 304;
|
28529 |
|
28530 | // Get response data
|
28531 | if ( responses ) {
|
28532 | response = ajaxHandleResponses( s, jqXHR, responses );
|
28533 | }
|
28534 |
|
28535 | // Convert no matter what (that way responseXXX fields are always set)
|
28536 | response = ajaxConvert( s, response, jqXHR, isSuccess );
|
28537 |
|
28538 | // If successful, handle type chaining
|
28539 | if ( isSuccess ) {
|
28540 |
|
28541 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
28542 | if ( s.ifModified ) {
|
28543 | modified = jqXHR.getResponseHeader("Last-Modified");
|
28544 | if ( modified ) {
|
28545 | jQuery.lastModified[ cacheURL ] = modified;
|
28546 | }
|
28547 | modified = jqXHR.getResponseHeader("etag");
|
28548 | if ( modified ) {
|
28549 | jQuery.etag[ cacheURL ] = modified;
|
28550 | }
|
28551 | }
|
28552 |
|
28553 | // if no content
|
28554 | if ( status === 204 || s.type === "HEAD" ) {
|
28555 | statusText = "nocontent";
|
28556 |
|
28557 | // if not modified
|
28558 | } else if ( status === 304 ) {
|
28559 | statusText = "notmodified";
|
28560 |
|
28561 | // If we have data, let's convert it
|
28562 | } else {
|
28563 | statusText = response.state;
|
28564 | success = response.data;
|
28565 | error = response.error;
|
28566 | isSuccess = !error;
|
28567 | }
|
28568 | } else {
|
28569 | // Extract error from statusText and normalize for non-aborts
|
28570 | error = statusText;
|
28571 | if ( status || !statusText ) {
|
28572 | statusText = "error";
|
28573 | if ( status < 0 ) {
|
28574 | status = 0;
|
28575 | }
|
28576 | }
|
28577 | }
|
28578 |
|
28579 | // Set data for the fake xhr object
|
28580 | jqXHR.status = status;
|
28581 | jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
28582 |
|
28583 | // Success/Error
|
28584 | if ( isSuccess ) {
|
28585 | deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
28586 | } else {
|
28587 | deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
28588 | }
|
28589 |
|
28590 | // Status-dependent callbacks
|
28591 | jqXHR.statusCode( statusCode );
|
28592 | statusCode = undefined;
|
28593 |
|
28594 | if ( fireGlobals ) {
|
28595 | globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
28596 | [ jqXHR, s, isSuccess ? success : error ] );
|
28597 | }
|
28598 |
|
28599 | // Complete
|
28600 | completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
28601 |
|
28602 | if ( fireGlobals ) {
|
28603 | globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
28604 | // Handle the global AJAX counter
|
28605 | if ( !( --jQuery.active ) ) {
|
28606 | jQuery.event.trigger("ajaxStop");
|
28607 | }
|
28608 | }
|
28609 | }
|
28610 |
|
28611 | return jqXHR;
|
28612 | },
|
28613 |
|
28614 | getJSON: function( url, data, callback ) {
|
28615 | return jQuery.get( url, data, callback, "json" );
|
28616 | },
|
28617 |
|
28618 | getScript: function( url, callback ) {
|
28619 | return jQuery.get( url, undefined, callback, "script" );
|
28620 | }
|
28621 | });
|
28622 |
|
28623 | jQuery.each( [ "get", "post" ], function( i, method ) {
|
28624 | jQuery[ method ] = function( url, data, callback, type ) {
|
28625 | // Shift arguments if data argument was omitted
|
28626 | if ( jQuery.isFunction( data ) ) {
|
28627 | type = type || callback;
|
28628 | callback = data;
|
28629 | data = undefined;
|
28630 | }
|
28631 |
|
28632 | return jQuery.ajax({
|
28633 | url: url,
|
28634 | type: method,
|
28635 | dataType: type,
|
28636 | data: data,
|
28637 | success: callback
|
28638 | });
|
28639 | };
|
28640 | });
|
28641 |
|
28642 |
|
28643 | jQuery._evalUrl = function( url ) {
|
28644 | return jQuery.ajax({
|
28645 | url: url,
|
28646 | type: "GET",
|
28647 | dataType: "script",
|
28648 | async: false,
|
28649 | global: false,
|
28650 | "throws": true
|
28651 | });
|
28652 | };
|
28653 |
|
28654 |
|
28655 | jQuery.fn.extend({
|
28656 | wrapAll: function( html ) {
|
28657 | var wrap;
|
28658 |
|
28659 | if ( jQuery.isFunction( html ) ) {
|
28660 | return this.each(function( i ) {
|
28661 | jQuery( this ).wrapAll( html.call(this, i) );
|
28662 | });
|
28663 | }
|
28664 |
|
28665 | if ( this[ 0 ] ) {
|
28666 |
|
28667 | // The elements to wrap the target around
|
28668 | wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
|
28669 |
|
28670 | if ( this[ 0 ].parentNode ) {
|
28671 | wrap.insertBefore( this[ 0 ] );
|
28672 | }
|
28673 |
|
28674 | wrap.map(function() {
|
28675 | var elem = this;
|
28676 |
|
28677 | while ( elem.firstElementChild ) {
|
28678 | elem = elem.firstElementChild;
|
28679 | }
|
28680 |
|
28681 | return elem;
|
28682 | }).append( this );
|
28683 | }
|
28684 |
|
28685 | return this;
|
28686 | },
|
28687 |
|
28688 | wrapInner: function( html ) {
|
28689 | if ( jQuery.isFunction( html ) ) {
|
28690 | return this.each(function( i ) {
|
28691 | jQuery( this ).wrapInner( html.call(this, i) );
|
28692 | });
|
28693 | }
|
28694 |
|
28695 | return this.each(function() {
|
28696 | var self = jQuery( this ),
|
28697 | contents = self.contents();
|
28698 |
|
28699 | if ( contents.length ) {
|
28700 | contents.wrapAll( html );
|
28701 |
|
28702 | } else {
|
28703 | self.append( html );
|
28704 | }
|
28705 | });
|
28706 | },
|
28707 |
|
28708 | wrap: function( html ) {
|
28709 | var isFunction = jQuery.isFunction( html );
|
28710 |
|
28711 | return this.each(function( i ) {
|
28712 | jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
|
28713 | });
|
28714 | },
|
28715 |
|
28716 | unwrap: function() {
|
28717 | return this.parent().each(function() {
|
28718 | if ( !jQuery.nodeName( this, "body" ) ) {
|
28719 | jQuery( this ).replaceWith( this.childNodes );
|
28720 | }
|
28721 | }).end();
|
28722 | }
|
28723 | });
|
28724 |
|
28725 |
|
28726 | jQuery.expr.filters.hidden = function( elem ) {
|
28727 | // Support: Opera <= 12.12
|
28728 | // Opera reports offsetWidths and offsetHeights less than zero on some elements
|
28729 | return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
|
28730 | };
|
28731 | jQuery.expr.filters.visible = function( elem ) {
|
28732 | return !jQuery.expr.filters.hidden( elem );
|
28733 | };
|
28734 |
|
28735 |
|
28736 |
|
28737 |
|
28738 | var r20 = /%20/g,
|
28739 | rbracket = /\[\]$/,
|
28740 | rCRLF = /\r?\n/g,
|
28741 | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
|
28742 | rsubmittable = /^(?:input|select|textarea|keygen)/i;
|
28743 |
|
28744 | function buildParams( prefix, obj, traditional, add ) {
|
28745 | var name;
|
28746 |
|
28747 | if ( jQuery.isArray( obj ) ) {
|
28748 | // Serialize array item.
|
28749 | jQuery.each( obj, function( i, v ) {
|
28750 | if ( traditional || rbracket.test( prefix ) ) {
|
28751 | // Treat each array item as a scalar.
|
28752 | add( prefix, v );
|
28753 |
|
28754 | } else {
|
28755 | // Item is non-scalar (array or object), encode its numeric index.
|
28756 | buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
|
28757 | }
|
28758 | });
|
28759 |
|
28760 | } else if ( !traditional && jQuery.type( obj ) === "object" ) {
|
28761 | // Serialize object item.
|
28762 | for ( name in obj ) {
|
28763 | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
|
28764 | }
|
28765 |
|
28766 | } else {
|
28767 | // Serialize scalar item.
|
28768 | add( prefix, obj );
|
28769 | }
|
28770 | }
|
28771 |
|
28772 | // Serialize an array of form elements or a set of
|
28773 | // key/values into a query string
|
28774 | jQuery.param = function( a, traditional ) {
|
28775 | var prefix,
|
28776 | s = [],
|
28777 | add = function( key, value ) {
|
28778 | // If value is a function, invoke it and return its value
|
28779 | value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
|
28780 | s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
|
28781 | };
|
28782 |
|
28783 | // Set traditional to true for jQuery <= 1.3.2 behavior.
|
28784 | if ( traditional === undefined ) {
|
28785 | traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
28786 | }
|
28787 |
|
28788 | // If an array was passed in, assume that it is an array of form elements.
|
28789 | if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
|
28790 | // Serialize the form elements
|
28791 | jQuery.each( a, function() {
|
28792 | add( this.name, this.value );
|
28793 | });
|
28794 |
|
28795 | } else {
|
28796 | // If traditional, encode the "old" way (the way 1.3.2 or older
|
28797 | // did it), otherwise encode params recursively.
|
28798 | for ( prefix in a ) {
|
28799 | buildParams( prefix, a[ prefix ], traditional, add );
|
28800 | }
|
28801 | }
|
28802 |
|
28803 | // Return the resulting serialization
|
28804 | return s.join( "&" ).replace( r20, "+" );
|
28805 | };
|
28806 |
|
28807 | jQuery.fn.extend({
|
28808 | serialize: function() {
|
28809 | return jQuery.param( this.serializeArray() );
|
28810 | },
|
28811 | serializeArray: function() {
|
28812 | return this.map(function() {
|
28813 | // Can add propHook for "elements" to filter or add form elements
|
28814 | var elements = jQuery.prop( this, "elements" );
|
28815 | return elements ? jQuery.makeArray( elements ) : this;
|
28816 | })
|
28817 | .filter(function() {
|
28818 | var type = this.type;
|
28819 |
|
28820 | // Use .is( ":disabled" ) so that fieldset[disabled] works
|
28821 | return this.name && !jQuery( this ).is( ":disabled" ) &&
|
28822 | rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
|
28823 | ( this.checked || !rcheckableType.test( type ) );
|
28824 | })
|
28825 | .map(function( i, elem ) {
|
28826 | var val = jQuery( this ).val();
|
28827 |
|
28828 | return val == null ?
|
28829 | null :
|
28830 | jQuery.isArray( val ) ?
|
28831 | jQuery.map( val, function( val ) {
|
28832 | return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
|
28833 | }) :
|
28834 | { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
|
28835 | }).get();
|
28836 | }
|
28837 | });
|
28838 |
|
28839 |
|
28840 | jQuery.ajaxSettings.xhr = function() {
|
28841 | try {
|
28842 | return new XMLHttpRequest();
|
28843 | } catch( e ) {}
|
28844 | };
|
28845 |
|
28846 | var xhrId = 0,
|
28847 | xhrCallbacks = {},
|
28848 | xhrSuccessStatus = {
|
28849 | // file protocol always yields status code 0, assume 200
|
28850 | 0: 200,
|
28851 | // Support: IE9
|
28852 | // #1450: sometimes IE returns 1223 when it should be 204
|
28853 | 1223: 204
|
28854 | },
|
28855 | xhrSupported = jQuery.ajaxSettings.xhr();
|
28856 |
|
28857 | // Support: IE9
|
28858 | // Open requests must be manually aborted on unload (#5280)
|
28859 | // See https://support.microsoft.com/kb/2856746 for more info
|
28860 | if ( window.attachEvent ) {
|
28861 | window.attachEvent( "onunload", function() {
|
28862 | for ( var key in xhrCallbacks ) {
|
28863 | xhrCallbacks[ key ]();
|
28864 | }
|
28865 | });
|
28866 | }
|
28867 |
|
28868 | support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
28869 | support.ajax = xhrSupported = !!xhrSupported;
|
28870 |
|
28871 | jQuery.ajaxTransport(function( options ) {
|
28872 | var callback;
|
28873 |
|
28874 | // Cross domain only allowed if supported through XMLHttpRequest
|
28875 | if ( support.cors || xhrSupported && !options.crossDomain ) {
|
28876 | return {
|
28877 | send: function( headers, complete ) {
|
28878 | var i,
|
28879 | xhr = options.xhr(),
|
28880 | id = ++xhrId;
|
28881 |
|
28882 | xhr.open( options.type, options.url, options.async, options.username, options.password );
|
28883 |
|
28884 | // Apply custom fields if provided
|
28885 | if ( options.xhrFields ) {
|
28886 | for ( i in options.xhrFields ) {
|
28887 | xhr[ i ] = options.xhrFields[ i ];
|
28888 | }
|
28889 | }
|
28890 |
|
28891 | // Override mime type if needed
|
28892 | if ( options.mimeType && xhr.overrideMimeType ) {
|
28893 | xhr.overrideMimeType( options.mimeType );
|
28894 | }
|
28895 |
|
28896 | // X-Requested-With header
|
28897 | // For cross-domain requests, seeing as conditions for a preflight are
|
28898 | // akin to a jigsaw puzzle, we simply never set it to be sure.
|
28899 | // (it can always be set on a per-request basis or even using ajaxSetup)
|
28900 | // For same-domain requests, won't change header if already provided.
|
28901 | if ( !options.crossDomain && !headers["X-Requested-With"] ) {
|
28902 | headers["X-Requested-With"] = "XMLHttpRequest";
|
28903 | }
|
28904 |
|
28905 | // Set headers
|
28906 | for ( i in headers ) {
|
28907 | xhr.setRequestHeader( i, headers[ i ] );
|
28908 | }
|
28909 |
|
28910 | // Callback
|
28911 | callback = function( type ) {
|
28912 | return function() {
|
28913 | if ( callback ) {
|
28914 | delete xhrCallbacks[ id ];
|
28915 | callback = xhr.onload = xhr.onerror = null;
|
28916 |
|
28917 | if ( type === "abort" ) {
|
28918 | xhr.abort();
|
28919 | } else if ( type === "error" ) {
|
28920 | complete(
|
28921 | // file: protocol always yields status 0; see #8605, #14207
|
28922 | xhr.status,
|
28923 | xhr.statusText
|
28924 | );
|
28925 | } else {
|
28926 | complete(
|
28927 | xhrSuccessStatus[ xhr.status ] || xhr.status,
|
28928 | xhr.statusText,
|
28929 | // Support: IE9
|
28930 | // Accessing binary-data responseText throws an exception
|
28931 | // (#11426)
|
28932 | typeof xhr.responseText === "string" ? {
|
28933 | text: xhr.responseText
|
28934 | } : undefined,
|
28935 | xhr.getAllResponseHeaders()
|
28936 | );
|
28937 | }
|
28938 | }
|
28939 | };
|
28940 | };
|
28941 |
|
28942 | // Listen to events
|
28943 | xhr.onload = callback();
|
28944 | xhr.onerror = callback("error");
|
28945 |
|
28946 | // Create the abort callback
|
28947 | callback = xhrCallbacks[ id ] = callback("abort");
|
28948 |
|
28949 | try {
|
28950 | // Do send the request (this may raise an exception)
|
28951 | xhr.send( options.hasContent && options.data || null );
|
28952 | } catch ( e ) {
|
28953 | // #14683: Only rethrow if this hasn't been notified as an error yet
|
28954 | if ( callback ) {
|
28955 | throw e;
|
28956 | }
|
28957 | }
|
28958 | },
|
28959 |
|
28960 | abort: function() {
|
28961 | if ( callback ) {
|
28962 | callback();
|
28963 | }
|
28964 | }
|
28965 | };
|
28966 | }
|
28967 | });
|
28968 |
|
28969 |
|
28970 |
|
28971 |
|
28972 | // Install script dataType
|
28973 | jQuery.ajaxSetup({
|
28974 | accepts: {
|
28975 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
28976 | },
|
28977 | contents: {
|
28978 | script: /(?:java|ecma)script/
|
28979 | },
|
28980 | converters: {
|
28981 | "text script": function( text ) {
|
28982 | jQuery.globalEval( text );
|
28983 | return text;
|
28984 | }
|
28985 | }
|
28986 | });
|
28987 |
|
28988 | // Handle cache's special case and crossDomain
|
28989 | jQuery.ajaxPrefilter( "script", function( s ) {
|
28990 | if ( s.cache === undefined ) {
|
28991 | s.cache = false;
|
28992 | }
|
28993 | if ( s.crossDomain ) {
|
28994 | s.type = "GET";
|
28995 | }
|
28996 | });
|
28997 |
|
28998 | // Bind script tag hack transport
|
28999 | jQuery.ajaxTransport( "script", function( s ) {
|
29000 | // This transport only deals with cross domain requests
|
29001 | if ( s.crossDomain ) {
|
29002 | var script, callback;
|
29003 | return {
|
29004 | send: function( _, complete ) {
|
29005 | script = jQuery("<script>").prop({
|
29006 | async: true,
|
29007 | charset: s.scriptCharset,
|
29008 | src: s.url
|
29009 | }).on(
|
29010 | "load error",
|
29011 | callback = function( evt ) {
|
29012 | script.remove();
|
29013 | callback = null;
|
29014 | if ( evt ) {
|
29015 | complete( evt.type === "error" ? 404 : 200, evt.type );
|
29016 | }
|
29017 | }
|
29018 | );
|
29019 | document.head.appendChild( script[ 0 ] );
|
29020 | },
|
29021 | abort: function() {
|
29022 | if ( callback ) {
|
29023 | callback();
|
29024 | }
|
29025 | }
|
29026 | };
|
29027 | }
|
29028 | });
|
29029 |
|
29030 |
|
29031 |
|
29032 |
|
29033 | var oldCallbacks = [],
|
29034 | rjsonp = /(=)\?(?=&|$)|\?\?/;
|
29035 |
|
29036 | // Default jsonp settings
|
29037 | jQuery.ajaxSetup({
|
29038 | jsonp: "callback",
|
29039 | jsonpCallback: function() {
|
29040 | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
|
29041 | this[ callback ] = true;
|
29042 | return callback;
|
29043 | }
|
29044 | });
|
29045 |
|
29046 | // Detect, normalize options and install callbacks for jsonp requests
|
29047 | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
29048 |
|
29049 | var callbackName, overwritten, responseContainer,
|
29050 | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
29051 | "url" :
|
29052 | typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
|
29053 | );
|
29054 |
|
29055 | // Handle iff the expected data type is "jsonp" or we have a parameter to set
|
29056 | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
29057 |
|
29058 | // Get callback name, remembering preexisting value associated with it
|
29059 | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
|
29060 | s.jsonpCallback() :
|
29061 | s.jsonpCallback;
|
29062 |
|
29063 | // Insert callback into url or form data
|
29064 | if ( jsonProp ) {
|
29065 | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
29066 | } else if ( s.jsonp !== false ) {
|
29067 | s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
29068 | }
|
29069 |
|
29070 | // Use data converter to retrieve json after script execution
|
29071 | s.converters["script json"] = function() {
|
29072 | if ( !responseContainer ) {
|
29073 | jQuery.error( callbackName + " was not called" );
|
29074 | }
|
29075 | return responseContainer[ 0 ];
|
29076 | };
|
29077 |
|
29078 | // force json dataType
|
29079 | s.dataTypes[ 0 ] = "json";
|
29080 |
|
29081 | // Install callback
|
29082 | overwritten = window[ callbackName ];
|
29083 | window[ callbackName ] = function() {
|
29084 | responseContainer = arguments;
|
29085 | };
|
29086 |
|
29087 | // Clean-up function (fires after converters)
|
29088 | jqXHR.always(function() {
|
29089 | // Restore preexisting value
|
29090 | window[ callbackName ] = overwritten;
|
29091 |
|
29092 | // Save back as free
|
29093 | if ( s[ callbackName ] ) {
|
29094 | // make sure that re-using the options doesn't screw things around
|
29095 | s.jsonpCallback = originalSettings.jsonpCallback;
|
29096 |
|
29097 | // save the callback name for future use
|
29098 | oldCallbacks.push( callbackName );
|
29099 | }
|
29100 |
|
29101 | // Call if it was a function and we have a response
|
29102 | if ( responseContainer && jQuery.isFunction( overwritten ) ) {
|
29103 | overwritten( responseContainer[ 0 ] );
|
29104 | }
|
29105 |
|
29106 | responseContainer = overwritten = undefined;
|
29107 | });
|
29108 |
|
29109 | // Delegate to script
|
29110 | return "script";
|
29111 | }
|
29112 | });
|
29113 |
|
29114 |
|
29115 |
|
29116 |
|
29117 | // data: string of html
|
29118 | // context (optional): If specified, the fragment will be created in this context, defaults to document
|
29119 | // keepScripts (optional): If true, will include scripts passed in the html string
|
29120 | jQuery.parseHTML = function( data, context, keepScripts ) {
|
29121 | if ( !data || typeof data !== "string" ) {
|
29122 | return null;
|
29123 | }
|
29124 | if ( typeof context === "boolean" ) {
|
29125 | keepScripts = context;
|
29126 | context = false;
|
29127 | }
|
29128 | context = context || document;
|
29129 |
|
29130 | var parsed = rsingleTag.exec( data ),
|
29131 | scripts = !keepScripts && [];
|
29132 |
|
29133 | // Single tag
|
29134 | if ( parsed ) {
|
29135 | return [ context.createElement( parsed[1] ) ];
|
29136 | }
|
29137 |
|
29138 | parsed = jQuery.buildFragment( [ data ], context, scripts );
|
29139 |
|
29140 | if ( scripts && scripts.length ) {
|
29141 | jQuery( scripts ).remove();
|
29142 | }
|
29143 |
|
29144 | return jQuery.merge( [], parsed.childNodes );
|
29145 | };
|
29146 |
|
29147 |
|
29148 | // Keep a copy of the old load method
|
29149 | var _load = jQuery.fn.load;
|
29150 |
|
29151 | /**
|
29152 | * Load a url into a page
|
29153 | */
|
29154 | jQuery.fn.load = function( url, params, callback ) {
|
29155 | if ( typeof url !== "string" && _load ) {
|
29156 | return _load.apply( this, arguments );
|
29157 | }
|
29158 |
|
29159 | var selector, type, response,
|
29160 | self = this,
|
29161 | off = url.indexOf(" ");
|
29162 |
|
29163 | if ( off >= 0 ) {
|
29164 | selector = jQuery.trim( url.slice( off ) );
|
29165 | url = url.slice( 0, off );
|
29166 | }
|
29167 |
|
29168 | // If it's a function
|
29169 | if ( jQuery.isFunction( params ) ) {
|
29170 |
|
29171 | // We assume that it's the callback
|
29172 | callback = params;
|
29173 | params = undefined;
|
29174 |
|
29175 | // Otherwise, build a param string
|
29176 | } else if ( params && typeof params === "object" ) {
|
29177 | type = "POST";
|
29178 | }
|
29179 |
|
29180 | // If we have elements to modify, make the request
|
29181 | if ( self.length > 0 ) {
|
29182 | jQuery.ajax({
|
29183 | url: url,
|
29184 |
|
29185 | // if "type" variable is undefined, then "GET" method will be used
|
29186 | type: type,
|
29187 | dataType: "html",
|
29188 | data: params
|
29189 | }).done(function( responseText ) {
|
29190 |
|
29191 | // Save response for use in complete callback
|
29192 | response = arguments;
|
29193 |
|
29194 | self.html( selector ?
|
29195 |
|
29196 | // If a selector was specified, locate the right elements in a dummy div
|
29197 | // Exclude scripts to avoid IE 'Permission Denied' errors
|
29198 | jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
29199 |
|
29200 | // Otherwise use the full result
|
29201 | responseText );
|
29202 |
|
29203 | }).complete( callback && function( jqXHR, status ) {
|
29204 | self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
|
29205 | });
|
29206 | }
|
29207 |
|
29208 | return this;
|
29209 | };
|
29210 |
|
29211 |
|
29212 |
|
29213 |
|
29214 | // Attach a bunch of functions for handling common AJAX events
|
29215 | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
|
29216 | jQuery.fn[ type ] = function( fn ) {
|
29217 | return this.on( type, fn );
|
29218 | };
|
29219 | });
|
29220 |
|
29221 |
|
29222 |
|
29223 |
|
29224 | jQuery.expr.filters.animated = function( elem ) {
|
29225 | return jQuery.grep(jQuery.timers, function( fn ) {
|
29226 | return elem === fn.elem;
|
29227 | }).length;
|
29228 | };
|
29229 |
|
29230 |
|
29231 |
|
29232 |
|
29233 | var docElem = window.document.documentElement;
|
29234 |
|
29235 | /**
|
29236 | * Gets a window from an element
|
29237 | */
|
29238 | function getWindow( elem ) {
|
29239 | return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
|
29240 | }
|
29241 |
|
29242 | jQuery.offset = {
|
29243 | setOffset: function( elem, options, i ) {
|
29244 | var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
|
29245 | position = jQuery.css( elem, "position" ),
|
29246 | curElem = jQuery( elem ),
|
29247 | props = {};
|
29248 |
|
29249 | // Set position first, in-case top/left are set even on static elem
|
29250 | if ( position === "static" ) {
|
29251 | elem.style.position = "relative";
|
29252 | }
|
29253 |
|
29254 | curOffset = curElem.offset();
|
29255 | curCSSTop = jQuery.css( elem, "top" );
|
29256 | curCSSLeft = jQuery.css( elem, "left" );
|
29257 | calculatePosition = ( position === "absolute" || position === "fixed" ) &&
|
29258 | ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
|
29259 |
|
29260 | // Need to be able to calculate position if either
|
29261 | // top or left is auto and position is either absolute or fixed
|
29262 | if ( calculatePosition ) {
|
29263 | curPosition = curElem.position();
|
29264 | curTop = curPosition.top;
|
29265 | curLeft = curPosition.left;
|
29266 |
|
29267 | } else {
|
29268 | curTop = parseFloat( curCSSTop ) || 0;
|
29269 | curLeft = parseFloat( curCSSLeft ) || 0;
|
29270 | }
|
29271 |
|
29272 | if ( jQuery.isFunction( options ) ) {
|
29273 | options = options.call( elem, i, curOffset );
|
29274 | }
|
29275 |
|
29276 | if ( options.top != null ) {
|
29277 | props.top = ( options.top - curOffset.top ) + curTop;
|
29278 | }
|
29279 | if ( options.left != null ) {
|
29280 | props.left = ( options.left - curOffset.left ) + curLeft;
|
29281 | }
|
29282 |
|
29283 | if ( "using" in options ) {
|
29284 | options.using.call( elem, props );
|
29285 |
|
29286 | } else {
|
29287 | curElem.css( props );
|
29288 | }
|
29289 | }
|
29290 | };
|
29291 |
|
29292 | jQuery.fn.extend({
|
29293 | offset: function( options ) {
|
29294 | if ( arguments.length ) {
|
29295 | return options === undefined ?
|
29296 | this :
|
29297 | this.each(function( i ) {
|
29298 | jQuery.offset.setOffset( this, options, i );
|
29299 | });
|
29300 | }
|
29301 |
|
29302 | var docElem, win,
|
29303 | elem = this[ 0 ],
|
29304 | box = { top: 0, left: 0 },
|
29305 | doc = elem && elem.ownerDocument;
|
29306 |
|
29307 | if ( !doc ) {
|
29308 | return;
|
29309 | }
|
29310 |
|
29311 | docElem = doc.documentElement;
|
29312 |
|
29313 | // Make sure it's not a disconnected DOM node
|
29314 | if ( !jQuery.contains( docElem, elem ) ) {
|
29315 | return box;
|
29316 | }
|
29317 |
|
29318 | // Support: BlackBerry 5, iOS 3 (original iPhone)
|
29319 | // If we don't have gBCR, just use 0,0 rather than error
|
29320 | if ( typeof elem.getBoundingClientRect !== strundefined ) {
|
29321 | box = elem.getBoundingClientRect();
|
29322 | }
|
29323 | win = getWindow( doc );
|
29324 | return {
|
29325 | top: box.top + win.pageYOffset - docElem.clientTop,
|
29326 | left: box.left + win.pageXOffset - docElem.clientLeft
|
29327 | };
|
29328 | },
|
29329 |
|
29330 | position: function() {
|
29331 | if ( !this[ 0 ] ) {
|
29332 | return;
|
29333 | }
|
29334 |
|
29335 | var offsetParent, offset,
|
29336 | elem = this[ 0 ],
|
29337 | parentOffset = { top: 0, left: 0 };
|
29338 |
|
29339 | // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
|
29340 | if ( jQuery.css( elem, "position" ) === "fixed" ) {
|
29341 | // Assume getBoundingClientRect is there when computed position is fixed
|
29342 | offset = elem.getBoundingClientRect();
|
29343 |
|
29344 | } else {
|
29345 | // Get *real* offsetParent
|
29346 | offsetParent = this.offsetParent();
|
29347 |
|
29348 | // Get correct offsets
|
29349 | offset = this.offset();
|
29350 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
|
29351 | parentOffset = offsetParent.offset();
|
29352 | }
|
29353 |
|
29354 | // Add offsetParent borders
|
29355 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
|
29356 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
|
29357 | }
|
29358 |
|
29359 | // Subtract parent offsets and element margins
|
29360 | return {
|
29361 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
|
29362 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
|
29363 | };
|
29364 | },
|
29365 |
|
29366 | offsetParent: function() {
|
29367 | return this.map(function() {
|
29368 | var offsetParent = this.offsetParent || docElem;
|
29369 |
|
29370 | while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
|
29371 | offsetParent = offsetParent.offsetParent;
|
29372 | }
|
29373 |
|
29374 | return offsetParent || docElem;
|
29375 | });
|
29376 | }
|
29377 | });
|
29378 |
|
29379 | // Create scrollLeft and scrollTop methods
|
29380 | jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
|
29381 | var top = "pageYOffset" === prop;
|
29382 |
|
29383 | jQuery.fn[ method ] = function( val ) {
|
29384 | return access( this, function( elem, method, val ) {
|
29385 | var win = getWindow( elem );
|
29386 |
|
29387 | if ( val === undefined ) {
|
29388 | return win ? win[ prop ] : elem[ method ];
|
29389 | }
|
29390 |
|
29391 | if ( win ) {
|
29392 | win.scrollTo(
|
29393 | !top ? val : window.pageXOffset,
|
29394 | top ? val : window.pageYOffset
|
29395 | );
|
29396 |
|
29397 | } else {
|
29398 | elem[ method ] = val;
|
29399 | }
|
29400 | }, method, val, arguments.length, null );
|
29401 | };
|
29402 | });
|
29403 |
|
29404 | // Support: Safari<7+, Chrome<37+
|
29405 | // Add the top/left cssHooks using jQuery.fn.position
|
29406 | // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
29407 | // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
|
29408 | // getComputedStyle returns percent when specified for top/left/bottom/right;
|
29409 | // rather than make the css module depend on the offset module, just check for it here
|
29410 | jQuery.each( [ "top", "left" ], function( i, prop ) {
|
29411 | jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
|
29412 | function( elem, computed ) {
|
29413 | if ( computed ) {
|
29414 | computed = curCSS( elem, prop );
|
29415 | // If curCSS returns percentage, fallback to offset
|
29416 | return rnumnonpx.test( computed ) ?
|
29417 | jQuery( elem ).position()[ prop ] + "px" :
|
29418 | computed;
|
29419 | }
|
29420 | }
|
29421 | );
|
29422 | });
|
29423 |
|
29424 |
|
29425 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
|
29426 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
29427 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
|
29428 | // Margin is only for outerHeight, outerWidth
|
29429 | jQuery.fn[ funcName ] = function( margin, value ) {
|
29430 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
29431 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
29432 |
|
29433 | return access( this, function( elem, type, value ) {
|
29434 | var doc;
|
29435 |
|
29436 | if ( jQuery.isWindow( elem ) ) {
|
29437 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
|
29438 | // isn't a whole lot we can do. See pull request at this URL for discussion:
|
29439 | // https://github.com/jquery/jquery/pull/764
|
29440 | return elem.document.documentElement[ "client" + name ];
|
29441 | }
|
29442 |
|
29443 | // Get document width or height
|
29444 | if ( elem.nodeType === 9 ) {
|
29445 | doc = elem.documentElement;
|
29446 |
|
29447 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
|
29448 | // whichever is greatest
|
29449 | return Math.max(
|
29450 | elem.body[ "scroll" + name ], doc[ "scroll" + name ],
|
29451 | elem.body[ "offset" + name ], doc[ "offset" + name ],
|
29452 | doc[ "client" + name ]
|
29453 | );
|
29454 | }
|
29455 |
|
29456 | return value === undefined ?
|
29457 | // Get width or height on the element, requesting but not forcing parseFloat
|
29458 | jQuery.css( elem, type, extra ) :
|
29459 |
|
29460 | // Set width or height on the element
|
29461 | jQuery.style( elem, type, value, extra );
|
29462 | }, type, chainable ? margin : undefined, chainable, null );
|
29463 | };
|
29464 | });
|
29465 | });
|
29466 |
|
29467 |
|
29468 | // The number of elements contained in the matched element set
|
29469 | jQuery.fn.size = function() {
|
29470 | return this.length;
|
29471 | };
|
29472 |
|
29473 | jQuery.fn.andSelf = jQuery.fn.addBack;
|
29474 |
|
29475 |
|
29476 |
|
29477 |
|
29478 | // Register as a named AMD module, since jQuery can be concatenated with other
|
29479 | // files that may use define, but not via a proper concatenation script that
|
29480 | // understands anonymous AMD modules. A named AMD is safest and most robust
|
29481 | // way to register. Lowercase jquery is used because AMD module names are
|
29482 | // derived from file names, and jQuery is normally delivered in a lowercase
|
29483 | // file name. Do this after creating the global so that if an AMD module wants
|
29484 | // to call noConflict to hide this version of jQuery, it will work.
|
29485 |
|
29486 | // Note that for maximum portability, libraries that are not jQuery should
|
29487 | // declare themselves as anonymous modules, and avoid setting a global if an
|
29488 | // AMD loader is present. jQuery is a special case. For more information, see
|
29489 | // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
|
29490 |
|
29491 | if ( true ) {
|
29492 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
29493 | return jQuery;
|
29494 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
29495 | }
|
29496 |
|
29497 |
|
29498 |
|
29499 |
|
29500 | var
|
29501 | // Map over jQuery in case of overwrite
|
29502 | _jQuery = window.jQuery,
|
29503 |
|
29504 | // Map over the $ in case of overwrite
|
29505 | _$ = window.$;
|
29506 |
|
29507 | jQuery.noConflict = function( deep ) {
|
29508 | if ( window.$ === jQuery ) {
|
29509 | window.$ = _$;
|
29510 | }
|
29511 |
|
29512 | if ( deep && window.jQuery === jQuery ) {
|
29513 | window.jQuery = _jQuery;
|
29514 | }
|
29515 |
|
29516 | return jQuery;
|
29517 | };
|
29518 |
|
29519 | // Expose jQuery and $ identifiers, even in AMD
|
29520 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
|
29521 | // and CommonJS for browser emulators (#13566)
|
29522 | if ( typeof noGlobal === strundefined ) {
|
29523 | window.jQuery = window.$ = jQuery;
|
29524 | }
|
29525 |
|
29526 |
|
29527 |
|
29528 |
|
29529 | return jQuery;
|
29530 |
|
29531 | }));
|
29532 |
|
29533 |
|
29534 | /***/ },
|
29535 | /* 167 */
|
29536 | /***/ function(module, exports, __webpack_require__) {
|
29537 |
|
29538 | 'use strict';
|
29539 |
|
29540 | Object.defineProperty(exports, "__esModule", {
|
29541 | value: true
|
29542 | });
|
29543 | exports.clearRange = clearRange;
|
29544 | exports.getRange = getRange;
|
29545 | exports.setRange = setRange;
|
29546 |
|
29547 | var _jquery = __webpack_require__(166);
|
29548 |
|
29549 | var _jquery2 = _interopRequireDefault(_jquery);
|
29550 |
|
29551 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29552 |
|
29553 | var selection = window.getSelection();
|
29554 |
|
29555 | function clearRange() {
|
29556 | // 是否可以 只移除特定range
|
29557 | selection.removeAllRanges();
|
29558 | }
|
29559 |
|
29560 | function getRange(dom) {
|
29561 | var count = selection.rangeCount;
|
29562 | for (var i = 0; i < count; i++) {
|
29563 | var range = selection.getRangeAt(i);
|
29564 | if ((0, _jquery2.default)(range.commonAncestorContainer).closest(dom).length) {
|
29565 | return range;
|
29566 | }
|
29567 | }
|
29568 | return null;
|
29569 | }
|
29570 |
|
29571 | function setRange(range) {
|
29572 | clearRange();
|
29573 | if (range) selection.addRange(range);
|
29574 | }
|
29575 |
|
29576 | /***/ }
|
29577 | /******/ ]); |
\ | No newline at end of file |