@@ -56,7 +56,7 @@ this.createjs = this.createjs || {};
5656 * @type {String }
5757 * @static
5858 **/
59- s . buildDate = /*=date*/ "Thu, 22 Oct 2015 16:01:29 GMT" ; // injected by build process
59+ s . buildDate = /*=date*/ "Wed, 25 Nov 2015 19:29:13 GMT" ; // injected by build process
6060
6161} ) ( ) ;
6262
@@ -77,7 +77,7 @@ this.createjs = this.createjs||{};
7777 *
7878 * function MySubClass() {}
7979 * createjs.extend(MySubClass, MySuperClass);
80- * ClassB .prototype.doSomething = function() { }
80+ * MySubClass .prototype.doSomething = function() { }
8181 *
8282 * var foo = new MySubClass();
8383 * console.log(foo instanceof MySuperClass); // true
@@ -388,12 +388,12 @@ this.createjs = this.createjs||{};
388388 * @deprecated
389389 */
390390 // p.initialize = function() {}; // searchable for devs wondering where it is.
391-
392391
393392// public methods:
394393 /**
395- * Sets {{#crossLink "Event/defaultPrevented"}}{{/crossLink}} to true.
396- * Mirrors the DOM event standard.
394+ * Sets {{#crossLink "Event/defaultPrevented"}}{{/crossLink}} to true if the event is cancelable.
395+ * Mirrors the DOM level 2 event standard. In general, cancelable events that have `preventDefault()` called will
396+ * cancel the default behaviour associated with the event.
397397 * @method preventDefault
398398 **/
399399 p . preventDefault = function ( ) {
@@ -573,7 +573,12 @@ this.createjs = this.createjs||{};
573573 * console.log(instance == this); // true, "on" uses dispatcher scope by default.
574574 * });
575575 *
576- * If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage scope.
576+ * If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage
577+ * scope.
578+ *
579+ * <b>Browser support</b>
580+ * The event model in CreateJS can be used separately from the suite in any project, however the inheritance model
581+ * requires modern browsers (IE9+).
577582 *
578583 *
579584 * @class EventDispatcher
@@ -676,7 +681,11 @@ this.createjs = this.createjs||{};
676681 * only run once, associate arbitrary data with the listener, and remove the listener.
677682 *
678683 * This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
679- * The created anonymous function is returned for use with .removeEventListener (or .off).
684+ * The wrapper function is returned for use with `removeEventListener` (or `off`).
685+ *
686+ * <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use
687+ * {{#crossLink "Event/remove"}}{{/crossLink}}. Likewise, each time you call `on` a NEW wrapper function is subscribed, so multiple calls
688+ * to `on` with the same params will create multiple listeners.
680689 *
681690 * <h4>Example</h4>
682691 *
@@ -746,6 +755,9 @@ this.createjs = this.createjs||{};
746755 /**
747756 * A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
748757 * .on method.
758+ *
759+ * <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See
760+ * {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example.
749761 *
750762 * @method off
751763 * @param {String } type The string type of the event.
@@ -791,19 +803,24 @@ this.createjs = this.createjs||{};
791803 * @method dispatchEvent
792804 * @param {Object | String | Event } eventObj An object with a "type" property, or a string type.
793805 * While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used,
794- * dispatchEvent will construct an Event instance with the specified type.
795- * @return {Boolean } Returns the value of eventObj.defaultPrevented.
806+ * dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can
807+ * be used to avoid event object instantiation for non-bubbling events that may not have any listeners.
808+ * @param {Boolean } [bubbles] Specifies the `bubbles` value when a string was passed to eventObj.
809+ * @param {Boolean } [cancelable] Specifies the `cancelable` value when a string was passed to eventObj.
810+ * @return {Boolean } Returns false if `preventDefault()` was called on a cancelable event, true otherwise.
796811 **/
797- p . dispatchEvent = function ( eventObj ) {
812+ p . dispatchEvent = function ( eventObj , bubbles , cancelable ) {
798813 if ( typeof eventObj == "string" ) {
799- // won't bubble, so skip everything if there's no listeners:
814+ // skip everything if there's no listeners and it doesn't bubble :
800815 var listeners = this . _listeners ;
801- if ( ! listeners || ! listeners [ eventObj ] ) { return false ; }
802- eventObj = new createjs . Event ( eventObj ) ;
816+ if ( ! bubbles && ( ! listeners || ! listeners [ eventObj ] ) ) { return true ; }
817+ eventObj = new createjs . Event ( eventObj , bubbles , cancelable ) ;
803818 } else if ( eventObj . target && eventObj . clone ) {
804819 // redispatching an active event object, so clone it:
805820 eventObj = eventObj . clone ( ) ;
806821 }
822+
823+ // TODO: it would be nice to eliminate this. Maybe in favour of evtObj instanceof Event? Or !!evtObj.createEvent
807824 try { eventObj . target = this ; } catch ( e ) { } // try/catch allows redispatching of native events
808825
809826 if ( ! eventObj . bubbles || ! this . parent ) {
@@ -822,7 +839,7 @@ this.createjs = this.createjs||{};
822839 list [ i ] . _dispatchEvent ( eventObj , 3 ) ;
823840 }
824841 }
825- return eventObj . defaultPrevented ;
842+ return ! eventObj . defaultPrevented ;
826843 } ;
827844
828845 /**
@@ -3393,12 +3410,12 @@ this.createjs = this.createjs || {};
33933410 this . _addedToDOM = false ;
33943411
33953412 /**
3396- * Determines what the tags initial style.visibility was, so we can set it correctly after a load.
3397- *
3413+ * Determines what the tags initial style.display was, so we can set it correctly after a load.
3414+ * @property _startTagDisplay
33983415 * @type {null }
33993416 * @private
34003417 */
3401- this . _startTagVisibility = null ;
3418+ this . _startTagDisplay = null ;
34023419 } ;
34033420
34043421 var p = createjs . extend ( TagRequest , createjs . AbstractRequest ) ;
@@ -3504,12 +3521,12 @@ this.createjs = this.createjs || {};
35043521 } ;
35053522
35063523 p . _hideTag = function ( ) {
3507- this . _startTagVisibility = this . _tag . style . visibility ;
3508- this . _tag . style . visibility = "hidden" ;
3524+ this . _startTagDisplay = this . _tag . style . display ;
3525+ this . _tag . style . display = 'none' ;
35093526 } ;
35103527
35113528 p . _showTag = function ( ) {
3512- this . _tag . style . visibility = this . _startTagVisibility ;
3529+ this . _tag . style . display = this . _startTagDisplay ;
35133530 } ;
35143531
35153532 /**
0 commit comments