@@ -77,15 +77,17 @@ var CLASS_NAMES = {
7777 overlay : {
7878 base : 'ReactModal__Overlay' ,
7979 afterOpen : 'ReactModal__Overlay--after-open' ,
80- beforeClose : 'ReactModal__Overlay--before-close' ,
80+ beforeClose : 'ReactModal__Overlay--before-close'
8181 } ,
8282 content : {
8383 base : 'ReactModal__Content' ,
8484 afterOpen : 'ReactModal__Content--after-open' ,
85- beforeClose : 'ReactModal__Content--before-close' ,
85+ beforeClose : 'ReactModal__Content--before-close'
8686 }
8787} ;
8888
89+ var OVERLAY_STYLES = { position : 'fixed' , left : 0 , right : 0 , top : 0 , bottom : 0 } ;
90+
8991function stopPropagation ( event ) {
9092 event . stopPropagation ( ) ;
9193}
@@ -170,7 +172,7 @@ var ModalPortal = module.exports = React.createClass({
170172 } ,
171173
172174 handleKeyDown : function ( event ) {
173- if ( event . keyCode == 9 /*tab*/ ) scopeTab ( this . getDOMNode ( ) , event ) ;
175+ if ( event . keyCode == 9 /*tab*/ ) scopeTab ( this . refs . content . getDOMNode ( ) , event ) ;
174176 if ( event . keyCode == 27 /*esc*/ ) this . requestClose ( ) ;
175177 } ,
176178
@@ -194,8 +196,6 @@ var ModalPortal = module.exports = React.createClass({
194196 return ! this . props . isOpen && ! this . state . beforeClose ;
195197 } ,
196198
197- overlayStyles : { position : 'fixed' , left : 0 , right : 0 , top : 0 , bottom : 0 } ,
198-
199199 buildClassName : function ( which ) {
200200 var className = CLASS_NAMES [ which ] . base ;
201201 if ( this . state . afterOpen )
@@ -210,7 +210,7 @@ var ModalPortal = module.exports = React.createClass({
210210 div ( {
211211 ref : "overlay" ,
212212 className : cx ( this . buildClassName ( 'overlay' ) , this . props . overlayClassName ) ,
213- style : this . overlayStyles ,
213+ style : OVERLAY_STYLES ,
214214 onClick : this . handleOverlayClick
215215 } ,
216216 div ( {
@@ -310,17 +310,30 @@ exports.returnFocus = function() {
310310
311311exports . setupScopedFocus = function ( element ) {
312312 modalElement = element ;
313- window . addEventListener ( 'blur' , handleBlur , false ) ;
314- document . addEventListener ( 'focus' , handleFocus , true ) ;
313+
314+ if ( window . addEventListener ) {
315+ window . addEventListener ( 'blur' , handleBlur , false ) ;
316+ document . addEventListener ( 'focus' , handleFocus , true ) ;
317+ } else {
318+ window . attachEvent ( 'onBlur' , handleBlur ) ;
319+ document . attachEvent ( 'onFocus' , handleFocus ) ;
320+ }
315321} ;
316322
317323exports . teardownScopedFocus = function ( ) {
318324 modalElement = null ;
319- window . removeEventListener ( 'blur' , handleBlur ) ;
320- document . removeEventListener ( 'focus' , handleFocus ) ;
325+
326+ if ( window . addEventListener ) {
327+ window . removeEventListener ( 'blur' , handleBlur ) ;
328+ document . removeEventListener ( 'focus' , handleFocus ) ;
329+ } else {
330+ window . detachEvent ( 'onBlur' , handleBlur ) ;
331+ document . detachEvent ( 'onFocus' , handleFocus ) ;
332+ }
321333} ;
322334
323335
336+
324337} , { "../helpers/tabbable" :7 } ] , 5 :[ function ( _dereq_ , module , exports ) {
325338module . exports = function ( ) {
326339 injectStyle ( [
@@ -440,7 +453,7 @@ module.exports = _dereq_('./components/Modal');
440453
441454} , { "./components/Modal" :1 } ] , 9 :[ function ( _dereq_ , module , exports ) {
442455/**
443- * Copyright 2013-2014 , Facebook, Inc.
456+ * Copyright 2013-2015 , Facebook, Inc.
444457 * All rights reserved.
445458 *
446459 * This source code is licensed under the BSD-style license found in the
@@ -465,7 +478,22 @@ module.exports = _dereq_('./components/Modal');
465478 * @param [string ...] Variable list of classNames in the string case.
466479 * @return string Renderable space-separated CSS className.
467480 */
481+
482+ 'use strict' ;
483+ var warning = _dereq_ ( "./warning" ) ;
484+
485+ var warned = false ;
486+
468487function cx ( classNames ) {
488+ if ( "production" !== "production" ) {
489+ ( "production" !== "production" ? warning (
490+ warned ,
491+ 'React.addons.classSet will be deprecated in a future version. See ' +
492+ 'http://fb.me/react-addons-classset'
493+ ) : null ) ;
494+ warned = true ;
495+ }
496+
469497 if ( typeof classNames == 'object' ) {
470498 return Object . keys ( classNames ) . filter ( function ( className ) {
471499 return classNames [ className ] ;
@@ -477,6 +505,101 @@ function cx(classNames) {
477505
478506module . exports = cx ;
479507
480- } , { } ] } , { } , [ 8 ] )
508+ } , { "./warning" :11 } ] , 10 :[ function ( _dereq_ , module , exports ) {
509+ /**
510+ * Copyright 2013-2015, Facebook, Inc.
511+ * All rights reserved.
512+ *
513+ * This source code is licensed under the BSD-style license found in the
514+ * LICENSE file in the root directory of this source tree. An additional grant
515+ * of patent rights can be found in the PATENTS file in the same directory.
516+ *
517+ * @providesModule emptyFunction
518+ */
519+
520+ function makeEmptyFunction ( arg ) {
521+ return function ( ) {
522+ return arg ;
523+ } ;
524+ }
525+
526+ /**
527+ * This function accepts and discards inputs; it has no side effects. This is
528+ * primarily useful idiomatically for overridable function endpoints which
529+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
530+ */
531+ function emptyFunction ( ) { }
532+
533+ emptyFunction . thatReturns = makeEmptyFunction ;
534+ emptyFunction . thatReturnsFalse = makeEmptyFunction ( false ) ;
535+ emptyFunction . thatReturnsTrue = makeEmptyFunction ( true ) ;
536+ emptyFunction . thatReturnsNull = makeEmptyFunction ( null ) ;
537+ emptyFunction . thatReturnsThis = function ( ) { return this ; } ;
538+ emptyFunction . thatReturnsArgument = function ( arg ) { return arg ; } ;
539+
540+ module . exports = emptyFunction ;
541+
542+ } , { } ] , 11 :[ function ( _dereq_ , module , exports ) {
543+ /**
544+ * Copyright 2014-2015, Facebook, Inc.
545+ * All rights reserved.
546+ *
547+ * This source code is licensed under the BSD-style license found in the
548+ * LICENSE file in the root directory of this source tree. An additional grant
549+ * of patent rights can be found in the PATENTS file in the same directory.
550+ *
551+ * @providesModule warning
552+ */
553+
554+ "use strict" ;
555+
556+ var emptyFunction = _dereq_ ( "./emptyFunction" ) ;
557+
558+ /**
559+ * Similar to invariant but only logs a warning if the condition is not met.
560+ * This can be used to log issues in development environments in critical
561+ * paths. Removing the logging code for production environments will keep the
562+ * same logic and follow the same code paths.
563+ */
564+
565+ var warning = emptyFunction ;
566+
567+ if ( "production" !== "production" ) {
568+ warning = function ( condition , format ) { for ( var args = [ ] , $__0 = 2 , $__1 = arguments . length ; $__0 < $__1 ; $__0 ++ ) args . push ( arguments [ $__0 ] ) ;
569+ if ( format === undefined ) {
570+ throw new Error (
571+ '`warning(condition, format, ...args)` requires a warning ' +
572+ 'message argument'
573+ ) ;
574+ }
575+
576+ if ( format . length < 10 || / ^ [ s \W ] * $ / . test ( format ) ) {
577+ throw new Error (
578+ 'The warning format should be able to uniquely identify this ' +
579+ 'warning. Please, use a more descriptive format than: ' + format
580+ ) ;
581+ }
582+
583+ if ( format . indexOf ( 'Failed Composite propType: ' ) === 0 ) {
584+ return ; // Ignore CompositeComponent proptype check.
585+ }
586+
587+ if ( ! condition ) {
588+ var argIndex = 0 ;
589+ var message = 'Warning: ' + format . replace ( / % s / g, function ( ) { return args [ argIndex ++ ] ; } ) ;
590+ console . warn ( message ) ;
591+ try {
592+ // --- Welcome to debugging React ---
593+ // This error was thrown as a convenience so that you can use this stack
594+ // to find the callsite that caused this warning to fire.
595+ throw new Error ( message ) ;
596+ } catch ( x ) { }
597+ }
598+ } ;
599+ }
600+
601+ module . exports = warning ;
602+
603+ } , { "./emptyFunction" :10 } ] } , { } , [ 8 ] )
481604( 8 )
482605} ) ;
0 commit comments