You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/10/30 02:07:25 UTC
[45/48] allura git commit: [#7919] Update to React v0.14.1
http://git-wip-us.apache.org/repos/asf/allura/blob/2d750f6a/Allura/allura/public/nf/js/react-with-addons.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/react-with-addons.js b/Allura/allura/public/nf/js/react-with-addons.js
index c1578b7..75fb558 100644
--- a/Allura/allura/public/nf/js/react-with-addons.js
+++ b/Allura/allura/public/nf/js/react-with-addons.js
@@ -1,6 +1,6 @@
-/**
- * React (with addons) v0.13.3
- */
+ /**
+ * React (with addons) v0.14.1
+ */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
@@ -22,18 +22,20 @@
'use strict';
-var LinkedStateMixin = _dereq_(25);
-var React = _dereq_(31);
-var ReactComponentWithPureRenderMixin =
- _dereq_(42);
-var ReactCSSTransitionGroup = _dereq_(34);
-var ReactFragment = _dereq_(69);
-var ReactTransitionGroup = _dereq_(98);
-var ReactUpdates = _dereq_(100);
+var LinkedStateMixin = _dereq_(22);
+var React = _dereq_(26);
+var ReactComponentWithPureRenderMixin = _dereq_(37);
+var ReactCSSTransitionGroup = _dereq_(29);
+var ReactFragment = _dereq_(64);
+var ReactTransitionGroup = _dereq_(94);
+var ReactUpdates = _dereq_(96);
+
+var cloneWithProps = _dereq_(118);
+var shallowCompare = _dereq_(140);
+var update = _dereq_(143);
+var warning = _dereq_(173);
-var cx = _dereq_(127);
-var cloneWithProps = _dereq_(122);
-var update = _dereq_(170);
+var warnedAboutBatchedUpdates = false;
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
@@ -41,21 +43,26 @@ React.addons = {
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
- batchedUpdates: ReactUpdates.batchedUpdates,
- classSet: cx,
+ batchedUpdates: function () {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
+ warnedAboutBatchedUpdates = true;
+ }
+ return ReactUpdates.batchedUpdates.apply(this, arguments);
+ },
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
+ shallowCompare: shallowCompare,
update: update
};
-if ("production" !== "development") {
- React.addons.Perf = _dereq_(61);
- React.addons.TestUtils = _dereq_(95);
+if ("development" !== 'production') {
+ React.addons.Perf = _dereq_(55);
+ React.addons.TestUtils = _dereq_(91);
}
module.exports = React;
-
-},{"100":100,"122":122,"127":127,"170":170,"25":25,"31":31,"34":34,"42":42,"61":61,"69":69,"95":95,"98":98}],2:[function(_dereq_,module,exports){
+},{"118":118,"140":140,"143":143,"173":173,"22":22,"26":26,"29":29,"37":37,"55":55,"64":64,"91":91,"94":94,"96":96}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -64,25 +71,35 @@ module.exports = React;
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule AutoFocusMixin
+ * @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
-var focusNode = _dereq_(134);
+var ReactMount = _dereq_(72);
+
+var findDOMNode = _dereq_(122);
+var focusNode = _dereq_(155);
-var AutoFocusMixin = {
- componentDidMount: function() {
+var Mixin = {
+ componentDidMount: function () {
if (this.props.autoFocus) {
- focusNode(this.getDOMNode());
+ focusNode(findDOMNode(this));
}
}
};
-module.exports = AutoFocusMixin;
+var AutoFocusUtils = {
+ Mixin: Mixin,
+
+ focusDOMComponent: function () {
+ focusNode(ReactMount.getNode(this._rootNodeID));
+ }
+};
-},{"134":134}],3:[function(_dereq_,module,exports){
+module.exports = AutoFocusUtils;
+},{"122":122,"155":155,"72":72}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
@@ -97,22 +114,19 @@ module.exports = AutoFocusMixin;
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var FallbackCompositionState = _dereq_(23);
-var SyntheticCompositionEvent = _dereq_(106);
-var SyntheticInputEvent = _dereq_(110);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var FallbackCompositionState = _dereq_(20);
+var SyntheticCompositionEvent = _dereq_(103);
+var SyntheticInputEvent = _dereq_(107);
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'CompositionEvent' in window
-);
+var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
@@ -122,22 +136,12 @@ if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'TextEvent' in window &&
- !documentMode &&
- !isPresto()
-);
+var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = (
- ExecutionEnvironment.canUseDOM &&
- (
- (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
- )
-);
+var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
@@ -145,11 +149,7 @@ var useFallbackCompositionData = (
*/
function isPresto() {
var opera = window.opera;
- return (
- typeof opera === 'object' &&
- typeof opera.version === 'function' &&
- parseInt(opera.version(), 10) <= 12
- );
+ return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
@@ -161,57 +161,31 @@ var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
- bubbled: keyOf({onBeforeInput: null}),
- captured: keyOf({onBeforeInputCapture: null})
+ bubbled: keyOf({ onBeforeInput: null }),
+ captured: keyOf({ onBeforeInputCapture: null })
},
- dependencies: [
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyPress,
- topLevelTypes.topTextInput,
- topLevelTypes.topPaste
- ]
+ dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionEnd: null}),
- captured: keyOf({onCompositionEndCapture: null})
+ bubbled: keyOf({ onCompositionEnd: null }),
+ captured: keyOf({ onCompositionEndCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionStart: null}),
- captured: keyOf({onCompositionStartCapture: null})
+ bubbled: keyOf({ onCompositionStart: null }),
+ captured: keyOf({ onCompositionStartCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionStart,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionUpdate: null}),
- captured: keyOf({onCompositionUpdateCapture: null})
+ bubbled: keyOf({ onCompositionUpdate: null }),
+ captured: keyOf({ onCompositionUpdateCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionUpdate,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
@@ -224,14 +198,11 @@ var hasSpaceKeypress = false;
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
- return (
- (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
- // ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey)
- );
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ // ctrlKey && altKey is equivalent to AltGr, and is not a command.
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
}
-
/**
* Translate native top level events into event types.
*
@@ -258,10 +229,7 @@ function getCompositionEventType(topLevelType) {
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return (
- topLevelType === topLevelTypes.topKeyDown &&
- nativeEvent.keyCode === START_KEYCODE
- );
+ return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -275,11 +243,11 @@ function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
- return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
- return (nativeEvent.keyCode !== START_KEYCODE);
+ return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
@@ -317,12 +285,7 @@ var currentComposition = null;
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -352,11 +315,7 @@ function extractCompositionEvent(
}
}
- var event = SyntheticCompositionEvent.getPooled(
- eventType,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -436,10 +395,7 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
- if (
- topLevelType === topLevelTypes.topCompositionEnd ||
- isFallbackCompositionEnd(topLevelType, nativeEvent)
- ) {
+ if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
@@ -491,12 +447,7 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -511,11 +462,7 @@ function extractBeforeInputEvent(
return null;
}
- var event = SyntheticInputEvent.getPooled(
- eventTypes.beforeInput,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -552,142 +499,13 @@ var BeforeInputEventPlugin = {
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ) {
- return [
- extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ),
- extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- )
- ];
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
-
-},{"106":106,"110":110,"157":157,"16":16,"21":21,"22":22,"23":23}],4:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSCore
- * @typechecks
- */
-
-var invariant = _dereq_(150);
-
-/**
- * The CSSCore module specifies the API (and implements most of the methods)
- * that should be used when dealing with the display of elements (via their
- * CSS classes and visibility on screen. It is an API focused on mutating the
- * display and not reading it as no logical state should be encoded in the
- * display of elements.
- */
-
-var CSSCore = {
-
- /**
- * Adds the class passed in to the element if it doesn't already have it.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- addClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.addClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.add(className);
- } else if (!CSSCore.hasClass(element, className)) {
- element.className = element.className + ' ' + className;
- }
- }
- return element;
- },
-
- /**
- * Removes the class passed in from the element
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- removeClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.removeClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.remove(className);
- } else if (CSSCore.hasClass(element, className)) {
- element.className = element.className
- .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
- .replace(/\s+/g, ' ') // multiple spaces to one
- .replace(/^\s*|\s*$/g, ''); // trim the ends
- }
- }
- return element;
- },
-
- /**
- * Helper to add or remove a class from an element based on a condition.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @param {*} bool condition to whether to add or remove the class
- * @return {DOMElement} the element passed in
- */
- conditionClass: function(element, className, bool) {
- return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
- },
-
- /**
- * Tests whether the element has the class specified.
- *
- * @param {DOMNode|DOMWindow} element the element to set the class on
- * @param {string} className the CSS className
- * @return {boolean} true if the element has the class, false if not
- */
- hasClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSS.hasClass takes only a single class name.'
- ) : invariant(!/\s/.test(className)));
- if (element.classList) {
- return !!className && element.classList.contains(className);
- }
- return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
- }
-
-};
-
-module.exports = CSSCore;
-
-},{"150":150}],5:[function(_dereq_,module,exports){
+},{"103":103,"107":107,"147":147,"15":15,"166":166,"19":19,"20":20}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -705,26 +523,31 @@ module.exports = CSSCore;
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
+ animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
+ boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
+ flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
+ tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
+ stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
@@ -748,8 +571,8 @@ var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function(prop) {
- prefixes.forEach(function(prefix) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
@@ -765,10 +588,16 @@ Object.keys(isUnitlessNumber).forEach(function(prop) {
*/
var shorthandPropertyExpansions = {
background: {
+ backgroundAttachment: true,
+ backgroundColor: true,
backgroundImage: true,
- backgroundPosition: true,
- backgroundRepeat: true,
- backgroundColor: true
+ backgroundPositionX: true,
+ backgroundPositionY: true,
+ backgroundRepeat: true
+ },
+ backgroundPosition: {
+ backgroundPositionX: true,
+ backgroundPositionY: true
},
border: {
borderWidth: true,
@@ -802,6 +631,11 @@ var shorthandPropertyExpansions = {
fontSize: true,
lineHeight: true,
fontFamily: true
+ },
+ outline: {
+ outlineWidth: true,
+ outlineStyle: true,
+ outlineColor: true
}
};
@@ -811,8 +645,7 @@ var CSSProperty = {
};
module.exports = CSSProperty;
-
-},{}],6:[function(_dereq_,module,exports){
+},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -827,28 +660,37 @@ module.exports = CSSProperty;
'use strict';
-var CSSProperty = _dereq_(5);
-var ExecutionEnvironment = _dereq_(22);
+var CSSProperty = _dereq_(4);
+var ExecutionEnvironment = _dereq_(147);
+var ReactPerf = _dereq_(78);
-var camelizeStyleName = _dereq_(121);
-var dangerousStyleValue = _dereq_(128);
-var hyphenateStyleName = _dereq_(148);
-var memoizeStringOnly = _dereq_(159);
-var warning = _dereq_(171);
+var camelizeStyleName = _dereq_(149);
+var dangerousStyleValue = _dereq_(119);
+var hyphenateStyleName = _dereq_(160);
+var memoizeStringOnly = _dereq_(168);
+var warning = _dereq_(173);
-var processStyleName = memoizeStringOnly(function(styleName) {
+var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
+var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
+ var tempStyle = document.createElement('div').style;
+ try {
+ // IE8 throws "Invalid argument." if resetting shorthand style properties.
+ tempStyle.font = '';
+ } catch (e) {
+ hasShorthandPropertyBug = true;
+ }
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
@@ -858,54 +700,38 @@ if ("production" !== "development") {
var warnedStyleNames = {};
var warnedStyleValues = {};
- var warnHyphenatedStyleName = function(name) {
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported style property %s. Did you mean %s?',
- name,
- camelizeStyleName(name)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
- var warnBadVendoredStyleName = function(name) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
- name,
- name.charAt(0).toUpperCase() + name.slice(1)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
- var warnStyleValueWithSemicolon = function(name, value) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- ("production" !== "development" ? warning(
- false,
- 'Style property values shouldn\'t contain a semicolon. ' +
- 'Try "%s: %s" instead.',
- name,
- value.replace(badStyleValueWithSemicolonPattern, '')
- ) : null);
+ "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
- var warnValidStyle = function(name, value) {
+ var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
@@ -933,14 +759,14 @@ var CSSPropertyOperations = {
* @param {object} styles
* @return {?string}
*/
- createMarkupForStyles: function(styles) {
+ createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
@@ -958,13 +784,13 @@ var CSSPropertyOperations = {
* @param {DOMElement} node
* @param {object} styles
*/
- setValueForStyles: function(node, styles) {
+ setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
@@ -974,7 +800,7 @@ var CSSPropertyOperations = {
if (styleValue) {
style[styleName] = styleValue;
} else {
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
+ var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
@@ -990,9 +816,12 @@ var CSSPropertyOperations = {
};
-module.exports = CSSPropertyOperations;
+ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
+ setValueForStyles: 'setValueForStyles'
+});
-},{"121":121,"128":128,"148":148,"159":159,"171":171,"22":22,"5":5}],7:[function(_dereq_,module,exports){
+module.exports = CSSPropertyOperations;
+},{"119":119,"147":147,"149":149,"160":160,"168":168,"173":173,"4":4,"78":78}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1006,10 +835,10 @@ module.exports = CSSPropertyOperations;
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
/**
* A specialized pseudo-event module to help keep track of components waiting to
@@ -1036,7 +865,7 @@ assign(CallbackQueue.prototype, {
* @param {?object} context Context to call `callback` with.
* @internal
*/
- enqueue: function(callback, context) {
+ enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
@@ -1049,17 +878,14 @@ assign(CallbackQueue.prototype, {
*
* @internal
*/
- notifyAll: function() {
+ notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- ("production" !== "development" ? invariant(
- callbacks.length === contexts.length,
- 'Mismatched list of contexts in callback queue'
- ) : invariant(callbacks.length === contexts.length));
+ !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
+ for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
@@ -1072,7 +898,7 @@ assign(CallbackQueue.prototype, {
*
* @internal
*/
- reset: function() {
+ reset: function () {
this._callbacks = null;
this._contexts = null;
},
@@ -1080,7 +906,7 @@ assign(CallbackQueue.prototype, {
/**
* `PooledClass` looks for this.
*/
- destructor: function() {
+ destructor: function () {
this.reset();
}
@@ -1089,8 +915,7 @@ assign(CallbackQueue.prototype, {
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
-
-},{"150":150,"29":29,"30":30}],8:[function(_dereq_,module,exports){
+},{"161":161,"24":24,"25":25}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1104,35 +929,27 @@ module.exports = CallbackQueue;
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var ReactUpdates = _dereq_(100);
-var SyntheticEvent = _dereq_(108);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var ReactUpdates = _dereq_(96);
+var SyntheticEvent = _dereq_(105);
-var isEventSupported = _dereq_(151);
-var isTextInputElement = _dereq_(153);
-var keyOf = _dereq_(157);
+var getEventTarget = _dereq_(128);
+var isEventSupported = _dereq_(133);
+var isTextInputElement = _dereq_(134);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
- bubbled: keyOf({onChange: null}),
- captured: keyOf({onChangeCapture: null})
+ bubbled: keyOf({ onChange: null }),
+ captured: keyOf({ onChangeCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topChange,
- topLevelTypes.topClick,
- topLevelTypes.topFocus,
- topLevelTypes.topInput,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
@@ -1148,26 +965,18 @@ var activeElementValueProp = null;
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
- return (
- elem.nodeName === 'SELECT' ||
- (elem.nodeName === 'INPUT' && elem.type === 'file')
- );
+ var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (
- (!('documentMode' in document) || document.documentMode > 8)
- );
+ doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- activeElementID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -1186,7 +995,7 @@ function manualDispatchChangeEvent(nativeEvent) {
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
@@ -1204,18 +1013,12 @@ function stopWatchingForChangeEventIE8() {
activeElementID = null;
}
-function getTargetIDForChangeEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
-function handleEventsForChangeEventIE8(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
@@ -1226,7 +1029,6 @@ function handleEventsForChangeEventIE8(
}
}
-
/**
* SECTION: handle `input` event
*/
@@ -1234,20 +1036,18 @@ var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (
- (!('documentMode' in document) || document.documentMode > 9)
- );
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
-var newValueProp = {
- get: function() {
+var newValueProp = {
+ get: function () {
return activeElementValueProp.get.call(this);
},
- set: function(val) {
+ set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
@@ -1263,11 +1063,10 @@ function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(
- target.constructor.prototype,
- 'value'
- );
+ activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
+ // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
+ // on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
@@ -1311,10 +1110,7 @@ function handlePropertyChange(nativeEvent) {
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
@@ -1323,10 +1119,7 @@ function getTargetIDForInputEvent(
}
// For IE8 and IE9.
-function handleEventsForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
@@ -1349,13 +1142,8 @@ function handleEventsForInputEventIE(
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange ||
- topLevelType === topLevelTypes.topKeyUp ||
- topLevelType === topLevelTypes.topKeyDown) {
+function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+ if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -1373,7 +1161,6 @@ function getTargetIDForInputEventIE(
}
}
-
/**
* SECTION: handle `click` event
*/
@@ -1381,16 +1168,10 @@ function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
- return (
- elem.nodeName === 'INPUT' &&
- (elem.type === 'checkbox' || elem.type === 'radio')
- );
+ return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
@@ -1418,11 +1199,7 @@ var ChangeEventPlugin = {
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
@@ -1443,36 +1220,24 @@ var ChangeEventPlugin = {
}
if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- targetID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
- handleEventFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
-
-},{"100":100,"108":108,"151":151,"153":153,"157":157,"16":16,"18":18,"21":21,"22":22}],9:[function(_dereq_,module,exports){
+},{"105":105,"128":128,"133":133,"134":134,"147":147,"15":15,"16":16,"166":166,"19":19,"96":96}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1490,14 +1255,13 @@ module.exports = ChangeEventPlugin;
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
-
-},{}],10:[function(_dereq_,module,exports){
+},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1512,11 +1276,13 @@ module.exports = ClientReactRootIndex;
'use strict';
-var Danger = _dereq_(13);
-var ReactMultiChildUpdateTypes = _dereq_(79);
+var Danger = _dereq_(12);
+var ReactMultiChildUpdateTypes = _dereq_(74);
+var ReactPerf = _dereq_(78);
-var setTextContent = _dereq_(165);
-var invariant = _dereq_(150);
+var setInnerHTML = _dereq_(138);
+var setTextContent = _dereq_(139);
+var invariant = _dereq_(161);
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -1531,10 +1297,12 @@ function insertChildAt(parentNode, childNode, index) {
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
- parentNode.insertBefore(
- childNode,
- parentNode.childNodes[index] || null
- );
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
}
/**
@@ -1554,7 +1322,7 @@ var DOMChildrenOperations = {
* @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function(updates, markupList) {
+ processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
@@ -1563,23 +1331,12 @@ var DOMChildrenOperations = {
for (var i = 0; i < updates.length; i++) {
update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
- update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
- ("production" !== "development" ? invariant(
- updatedChild,
- '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(updatedChild));
+ !updatedChild ? "development" !== 'production' ? 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;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
@@ -1590,7 +1347,13 @@ var DOMChildrenOperations = {
}
}
- var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ var renderedMarkup;
+ // markupList is either a list of markup or just a list of elements
+ if (markupList.length && typeof markupList[0] === 'string') {
+ renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ } else {
+ renderedMarkup = markupList;
+ }
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
@@ -1603,24 +1366,16 @@ var DOMChildrenOperations = {
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(
- update.parentNode,
- renderedMarkup[update.markupIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(
- update.parentNode,
- initialChildren[update.parentID][update.fromIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ break;
+ case ReactMultiChildUpdateTypes.SET_MARKUP:
+ setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(
- update.parentNode,
- update.textContent
- );
+ setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
@@ -1631,9 +1386,12 @@ var DOMChildrenOperations = {
};
-module.exports = DOMChildrenOperations;
+ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
+ updateTextContent: 'updateTextContent'
+});
-},{"13":13,"150":150,"165":165,"79":79}],11:[function(_dereq_,module,exports){
+module.exports = DOMChildrenOperations;
+},{"12":12,"138":138,"139":139,"161":161,"74":74,"78":78}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1646,11 +1404,9 @@ module.exports = DOMChildrenOperations;
* @typechecks static-only
*/
-/*jslint bitwise: true */
-
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
@@ -1686,6 +1442,9 @@ var DOMPropertyInjection = {
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
@@ -1694,92 +1453,68 @@ var DOMPropertyInjection = {
*
* @param {object} domPropertyConfig the config as described above.
*/
- injectDOMPropertyConfig: function(domPropertyConfig) {
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
- DOMProperty._isCustomAttributeFunctions.push(
- domPropertyConfig.isCustomAttribute
- );
+ DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
- ("production" !== "development" ? invariant(
- !DOMProperty.isStandardName.hasOwnProperty(propName),
- '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(!DOMProperty.isStandardName.hasOwnProperty(propName)));
-
- DOMProperty.isStandardName[propName] = true;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? 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;
var lowerCased = propName.toLowerCase();
- DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
+ };
+
+ !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
+ DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ }
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
- DOMProperty.getPossibleStandardName[attributeName] = propName;
- DOMProperty.getAttributeName[propName] = attributeName;
- } else {
- DOMProperty.getAttributeName[propName] = lowerCased;
+ propertyInfo.attributeName = attributeName;
+ if ("development" !== 'production') {
+ DOMProperty.getPossibleStandardName[attributeName] = propName;
+ }
+ }
+
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
}
- DOMProperty.getPropertyName[propName] =
- DOMPropertyNames.hasOwnProperty(propName) ?
- DOMPropertyNames[propName] :
- propName;
+ if (DOMPropertyNames.hasOwnProperty(propName)) {
+ propertyInfo.propertyName = DOMPropertyNames[propName];
+ }
if (DOMMutationMethods.hasOwnProperty(propName)) {
- DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
- } else {
- DOMProperty.getMutationMethod[propName] = null;
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
- var propConfig = Properties[propName];
- DOMProperty.mustUseAttribute[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
- DOMProperty.mustUseProperty[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
- DOMProperty.hasSideEffects[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
- DOMProperty.hasBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
- DOMProperty.hasNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
- DOMProperty.hasPositiveNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
- DOMProperty.hasOverloadedBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
-
- ("production" !== "development" ? invariant(
- !DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName],
- 'DOMProperty: Cannot require using both attribute and property: %s',
- propName
- ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName]));
- ("production" !== "development" ? invariant(
- DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName],
- 'DOMProperty: Properties that have side effects must use property: %s',
- propName
- ) : invariant(DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName]));
- ("production" !== "development" ? invariant(
- !!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
- 'numeric value, but not a combination: %s',
- propName
- ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
+ DOMProperty.properties[propName] = propertyInfo;
}
}
};
@@ -1803,87 +1538,49 @@ var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
- * Checks whether a property name is a standard property.
- * @type {Object}
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseAttribute:
+ * Whether the property must be accessed and mutated using `*Attribute()`.
+ * (This includes anything that fails `<propName> in <element>`.)
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasSideEffects:
+ * Whether or not setting a value causes side effects such as triggering
+ * resources to be loaded or text selection changes. If true, we read from
+ * the DOM before updating to ensure that the value is only set if it has
+ * changed.
+ * hasBooleanValue:
+ * Whether the property should be removed when set to a falsey value.
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
+ * Whether the property must be positive numeric or parse as a positive
+ * numeric and should be removed when set to a falsey value.
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
*/
- isStandardName: {},
+ properties: {},
/**
* Mapping from lowercase property names to the properly cased version, used
- * to warn in the case of missing properties.
- * @type {Object}
- */
- getPossibleStandardName: {},
-
- /**
- * Mapping from normalized names to attribute names that differ. Attribute
- * names are used when rendering markup or with `*Attribute()`.
- * @type {Object}
- */
- getAttributeName: {},
-
- /**
- * Mapping from normalized names to properties on DOM node instances.
- * (This includes properties that mutate due to external factors.)
- * @type {Object}
- */
- getPropertyName: {},
-
- /**
- * Mapping from normalized names to mutation methods. This will only exist if
- * mutation cannot be set simply by the property or `setAttribute()`.
- * @type {Object}
- */
- getMutationMethod: {},
-
- /**
- * Whether the property must be accessed and mutated as an object property.
- * @type {Object}
- */
- mustUseAttribute: {},
-
- /**
- * Whether the property must be accessed and mutated using `*Attribute()`.
- * (This includes anything that fails `<propName> in <element>`.)
- * @type {Object}
- */
- mustUseProperty: {},
-
- /**
- * Whether or not setting a value causes side effects such as triggering
- * resources to be loaded or text selection changes. We must ensure that
- * the value is only set if it has changed.
- * @type {Object}
- */
- hasSideEffects: {},
-
- /**
- * Whether the property should be removed when set to a falsey value.
- * @type {Object}
- */
- hasBooleanValue: {},
-
- /**
- * Whether the property must be numeric or parse as a
- * numeric and should be removed when set to a falsey value.
- * @type {Object}
- */
- hasNumericValue: {},
-
- /**
- * Whether the property must be positive numeric or parse as a positive
- * numeric and should be removed when set to a falsey value.
+ * to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
- hasPositiveNumericValue: {},
-
- /**
- * Whether the property can be used as a flag as well as with a value. Removed
- * when strictly equal to false; present without a value when strictly equal
- * to true; present with a value otherwise.
- * @type {Object}
- */
- hasOverloadedBooleanValue: {},
+ getPossibleStandardName: "development" !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
@@ -1894,7 +1591,7 @@ var DOMProperty = {
* Checks whether a property name is a custom attribute.
* @method
*/
- isCustomAttribute: function(attributeName) {
+ isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
@@ -1912,7 +1609,7 @@ var DOMProperty = {
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
- getDefaultValueForProperty: function(nodeName, prop) {
+ getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
@@ -1929,8 +1626,7 @@ var DOMProperty = {
};
module.exports = DOMProperty;
-
-},{"150":150}],12:[function(_dereq_,module,exports){
+},{"161":161}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1945,20 +1641,38 @@ module.exports = DOMProperty;
'use strict';
-var DOMProperty = _dereq_(11);
+var DOMProperty = _dereq_(10);
+var ReactPerf = _dereq_(78);
+
+var quoteAttributeValueForBrowser = _dereq_(136);
+var warning = _dereq_(173);
-var quoteAttributeValueForBrowser = _dereq_(163);
-var warning = _dereq_(171);
+// Simplified subset
+var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
+ }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ return false;
+}
-function shouldIgnoreValue(name, value) {
- return value == null ||
- (DOMProperty.hasBooleanValue[name] && !value) ||
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
@@ -1967,9 +1681,8 @@ if ("production" !== "development") {
};
var warnedProperties = {};
- var warnUnknownProperty = function(name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ var warnUnknownProperty = function (name) {
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
@@ -1977,23 +1690,11 @@ if ("production" !== "development") {
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
- var standardName = (
- DOMProperty.isCustomAttribute(lowerCasedName) ?
- lowerCasedName :
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
- DOMProperty.getPossibleStandardName[lowerCasedName] :
- null
- );
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
- ("production" !== "development" ? warning(
- standardName == null,
- 'Unknown DOM property %s. Did you mean %s?',
- name,
- standardName
- ) : null);
-
+ "development" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
@@ -2008,9 +1709,12 @@ var DOMPropertyOperations = {
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
- createMarkupForID: function(id) {
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
- quoteAttributeValueForBrowser(id);
+ createMarkupForID: function (id) {
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
+ },
+
+ setAttributeForID: function (node, id) {
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
@@ -2020,16 +1724,15 @@ var DOMPropertyOperations = {
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
- createMarkupForProperty: function(name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- if (shouldIgnoreValue(name, value)) {
+ createMarkupForProperty: function (name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
- var attributeName = DOMProperty.getAttributeName[name];
- if (DOMProperty.hasBooleanValue[name] ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
- return attributeName;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
@@ -2037,90 +1740,119 @@ var DOMPropertyOperations = {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
+ * Creates markup for a custom property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
+ */
+ createMarkupForCustomAttribute: function (name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+ },
+
+ /**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
- setValueForProperty: function(node, name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ setValueForProperty: function (node, name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
- } else if (shouldIgnoreValue(name, value)) {
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (DOMProperty.mustUseAttribute[name]) {
+ } else if (propertyInfo.mustUseAttribute) {
+ var attributeName = propertyInfo.attributeName;
+ var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
+ if (namespace) {
+ node.setAttributeNS(namespace, attributeName, '' + value);
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ node.setAttribute(attributeName, '');
+ } else {
+ node.setAttribute(attributeName, '' + value);
+ }
} else {
- var propName = DOMProperty.getPropertyName[name];
+ var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== ('' + value)) {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
- if (value == null) {
- node.removeAttribute(name);
- } else {
- node.setAttribute(name, '' + value);
- }
- } else if ("production" !== "development") {
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
},
+ setValueForAttribute: function (node, name, value) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
+ if (value == null) {
+ node.removeAttribute(name);
+ } else {
+ node.setAttribute(name, '' + value);
+ }
+ },
+
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
- deleteValueForProperty: function(node, name) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ deleteValueForProperty: function (node, name) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (DOMProperty.mustUseAttribute[name]) {
- node.removeAttribute(DOMProperty.getAttributeName[name]);
+ } else if (propertyInfo.mustUseAttribute) {
+ node.removeAttribute(propertyInfo.attributeName);
} else {
- var propName = DOMProperty.getPropertyName[name];
- var defaultValue = DOMProperty.getDefaultValueForProperty(
- node.nodeName,
- propName
- );
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== defaultValue) {
+ var propName = propertyInfo.propertyName;
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
}
};
-module.exports = DOMPropertyOperations;
+ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
+ setValueForProperty: 'setValueForProperty',
+ setValueForAttribute: 'setValueForAttribute',
+ deleteValueForProperty: 'deleteValueForProperty'
+});
-},{"11":11,"163":163,"171":171}],13:[function(_dereq_,module,exports){
+module.exports = DOMPropertyOperations;
+},{"10":10,"136":136,"173":173,"78":78}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2133,16 +1865,14 @@ module.exports = DOMPropertyOperations;
* @typechecks static-only
*/
-/*jslint evil: true, sub: true */
-
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
-var createNodesFromMarkup = _dereq_(126);
-var emptyFunction = _dereq_(129);
-var getMarkupWrap = _dereq_(142);
-var invariant = _dereq_(150);
+var createNodesFromMarkup = _dereq_(152);
+var emptyFunction = _dereq_(153);
+var getMarkupWrap = _dereq_(157);
+var invariant = _dereq_(161);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -2173,22 +1903,13 @@ var Danger = {
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
- dangerouslyRenderMarkup: function(markupList) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
- 'thread. Make sure `window` and `document` are available globally ' +
- 'before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
+ dangerouslyRenderMarkup: function (markupList) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? 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;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- ("production" !== "development" ? invariant(
- markupList[i],
- 'dangerouslyRenderMarkup(...): Missing markup.'
- ) : invariant(markupList[i]));
+ !markupList[i] ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -2213,61 +1934,41 @@ var Danger = {
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
- markupListByNodeName[resultIndex] = markup.replace(
- OPEN_TAG_NAME_EXP,
- // This index will be parsed back out below.
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
- );
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
+ // This index will be parsed back out below.
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
- var renderNodes = createNodesFromMarkup(
- markupListByNodeName.join(''),
- emptyFunction // Do nothing special with <script> tags.
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
- if (renderNode.hasAttribute &&
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- ("production" !== "development" ? invariant(
- !resultList.hasOwnProperty(resultIndex),
- 'Danger: Assigning to an already-occupied result index.'
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
+ !!resultList.hasOwnProperty(resultIndex) ? "development" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
-
- } else if ("production" !== "development") {
- console.error(
- 'Danger: Discarding unexpected node:',
- renderNode
- );
+ } else if ("development" !== 'production') {
+ console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
- ("production" !== "development" ? invariant(
- resultListAssignmentCount === resultList.length,
- 'Danger: Did not assign to every index of resultList.'
- ) : invariant(resultListAssignmentCount === resultList.length));
-
- ("production" !== "development" ? invariant(
- resultList.length === markupList.length,
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
- markupList.length,
- resultList.length
- ) : invariant(resultList.length === markupList.length));
+ !(resultListAssignmentCount === resultList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+
+ !(resultList.length === markupList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
@@ -2280,32 +1981,24 @@ var Danger = {
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
- 'worker thread. Make sure `window` and `document` are available ' +
- 'globally before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
- ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
- ("production" !== "development" ? invariant(
- oldChild.tagName.toLowerCase() !== 'html',
- '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 React.renderToString().'
- ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
-
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? 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;
+ !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !(oldChild.tagName.toLowerCase() !== 'html') ? "development" !== 'production' ? 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;
+
+ var newChild;
+ if (typeof markup === 'string') {
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ } else {
+ newChild = markup;
+ }
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
-
-},{"126":126,"129":129,"142":142,"150":150,"22":22}],14:[function(_dereq_,module,exports){
+},{"147":147,"152":152,"153":153,"157":157,"161":161}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2319,7 +2012,7 @@ module.exports = Danger;
'use strict';
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
@@ -2330,21 +2023,10 @@ var keyOf = _dereq_(157);
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DefaultEventPluginOrder = [
- keyOf({ResponderEventPlugin: null}),
- keyOf({SimpleEventPlugin: null}),
- keyOf({TapEventPlugin: null}),
- keyOf({EnterLeaveEventPlugin: null}),
- keyOf({ChangeEventPlugin: null}),
- keyOf({SelectEventPlugin: null}),
- keyOf({BeforeInputEventPlugin: null}),
- keyOf({AnalyticsEventPlugin: null}),
- keyOf({MobileSafariClickEventPlugin: null})
-];
+var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
-
-},{"157":157}],15:[function(_dereq_,module,exports){
+},{"166":166}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2359,30 +2041,24 @@ module.exports = DefaultEventPluginOrder;
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var SyntheticMouseEvent = _dereq_(112);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var SyntheticMouseEvent = _dereq_(109);
-var ReactMount = _dereq_(77);
-var keyOf = _dereq_(157);
+var ReactMount = _dereq_(72);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
- registrationName: keyOf({onMouseEnter: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseEnter: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
- registrationName: keyOf({onMouseLeave: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseLeave: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
@@ -2406,17 +2082,11 @@ var EnterLeaveEventPlugin = {
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topMouseOver &&
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== topLevelTypes.topMouseOut &&
- topLevelType !== topLevelTypes.topMouseOver) {
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
@@ -2435,15 +2105,24 @@ var EnterLeaveEventPlugin = {
}
}
- var from, to;
+ var from;
+ var to;
+ var fromID = '';
+ var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
- to =
- getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
- win;
+ fromID = topLevelTargetID;
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
+ if (to) {
+ toID = ReactMount.getID(to);
+ } else {
+ to = win;
+ }
+ to = to || win;
} else {
from = win;
to = topLevelTarget;
+ toID = topLevelTargetID;
}
if (from === to) {
@@ -2451,23 +2130,12 @@ var EnterLeaveEventPlugin = {
return null;
}
- var fromID = from ? ReactMount.getID(from) : '';
- var toID = to ? ReactMount.getID(to) : '';
-
- var leave = SyntheticMouseEvent.getPooled(
- eventTypes.mouseLeave,
- fromID,
- nativeEvent
- );
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
- var enter = SyntheticMouseEvent.getPooled(
- eventTypes.mouseEnter,
- toID,
- nativeEvent
- );
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
@@ -2483,8 +2151,7 @@ var EnterLeaveEventPlugin = {
};
module.exports = EnterLeaveEventPlugin;
-
-},{"112":112,"157":157,"16":16,"21":21,"77":77}],16:[function(_dereq_,module,exports){
+},{"109":109,"15":15,"166":166,"19":19,"72":72}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2498,15 +2165,18 @@ module.exports = EnterLeaveEventPlugin;
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
-var PropagationPhases = keyMirror({bubbled: null, captured: null});
+var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
+ topAbort: null,
topBlur: null,
+ topCanPlay: null,
+ topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
@@ -2524,6 +2194,10 @@ var topLevelTypes = keyMirror({
topDragOver: null,
topDragStart: null,
topDrop: null,
+ topDurationChange: null,
+ topEmptied: null,
+ topEncrypted: null,
+ topEnded: null,
topError: null,
topFocus: null,
topInput: null,
@@ -2531,21 +2205,36 @@ var topLevelTypes = keyMirror({
topKeyPress: null,
topKeyUp: null,
topLoad: null,
+ topLoadedData: null,
+ topLoadedMetadata: null,
+ topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
+ topPause: null,
+ topPlay: null,
+ topPlaying: null,
+ topProgress: null,
+ topRateChange: null,
topReset: null,
topScroll: null,
+ topSeeked: null,
+ topSeeking: null,
topSelectionChange: null,
+ topStalled: null,
topSubmit: null,
+ topSuspend: null,
topTextInput: null,
+ topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topVolumeChange: null,
+ topWaiting: null,
topWheel: null
});
@@ -2555,115 +2244,28 @@ var EventConstants = {
};
module.exports = EventConstants;
-
-},{"156":156}],17:[function(_dereq_,module,exports){
+},{"165":165}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @providesModule EventListener
- * @typechecks
- */
-
-var emptyFunction = _dereq_(129);
-
-/**
- * Upstream version of event listener. Does not take into account specific
- * nature of platform.
- */
-var EventListener = {
- /**
- * Listen to DOM events during the bubble phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- listen: function(target, eventType, callback) {
- if (target.addEventListener) {
- target.addEventListener(eventType, callback, false);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, false);
- }
- };
- } else if (target.attachEvent) {
- target.attachEvent('on' + eventType, callback);
- return {
- remove: function() {
- target.detachEvent('on' + eventType, callback);
- }
- };
- }
- },
-
- /**
- * Listen to DOM events during the capture phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- capture: function(target, eventType, callback) {
- if (!target.addEventListener) {
- if ("production" !== "development") {
- 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.'
- );
- }
- return {
- remove: emptyFunction
- };
- } else {
- target.addEventListener(eventType, callback, true);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, true);
- }
- };
- }
- },
-
- registerDefault: function() {}
-};
-
-module.exports = EventListener;
-
-},{"129":129}],18:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
*
* @pro
<TRUNCATED>