|
|
10 |
__coverage__['build/widget-uievents/widget-uievents.js'] = {"path":"build/widget-uievents/widget-uievents.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":46}}},"2":{"name":"(anonymous_2)","line":30,"loc":{"start":{"line":30,"column":22},"end":{"line":30,"column":33}}},"3":{"name":"(anonymous_3)","line":34,"loc":{"start":{"line":34,"column":24},"end":{"line":34,"column":45}}},"4":{"name":"(anonymous_4)","line":71,"loc":{"start":{"line":71,"column":21},"end":{"line":71,"column":33}}},"5":{"name":"(anonymous_5)","line":85,"loc":{"start":{"line":85,"column":20},"end":{"line":85,"column":36}}},"6":{"name":"(anonymous_6)","line":97,"loc":{"start":{"line":97,"column":46},"end":{"line":97,"column":61}}},"7":{"name":"(anonymous_7)","line":139,"loc":{"start":{"line":139,"column":20},"end":{"line":139,"column":34}}},"8":{"name":"(anonymous_8)","line":155,"loc":{"start":{"line":155,"column":17},"end":{"line":155,"column":33}}},"9":{"name":"(anonymous_9)","line":187,"loc":{"start":{"line":187,"column":18},"end":{"line":187,"column":34}}},"10":{"name":"(anonymous_10)","line":195,"loc":{"start":{"line":195,"column":31},"end":{"line":195,"column":42}}},"11":{"name":"(anonymous_11)","line":206,"loc":{"start":{"line":206,"column":8},"end":{"line":206,"column":24}}},"12":{"name":"(anonymous_12)","line":215,"loc":{"start":{"line":215,"column":13},"end":{"line":215,"column":37}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":226,"column":67}},"2":{"start":{"line":10,"column":0},"end":{"line":18,"column":56}},"3":{"start":{"line":20,"column":0},"end":{"line":223,"column":9}},"4":{"start":{"line":32,"column":8},"end":{"line":32,"column":45}},"5":{"start":{"line":34,"column":8},"end":{"line":51,"column":11}},"6":{"start":{"line":35,"column":12},"end":{"line":50,"column":13}},"7":{"start":{"line":38,"column":16},"end":{"line":38,"column":50}},"8":{"start":{"line":43,"column":16},"end":{"line":49,"column":17}},"9":{"start":{"line":44,"column":20},"end":{"line":44,"column":41}},"10":{"start":{"line":46,"column":20},"end":{"line":48,"column":21}},"11":{"start":{"line":47,"column":24},"end":{"line":47,"column":44}},"12":{"start":{"line":72,"column":8},"end":{"line":72,"column":38}},"13":{"start":{"line":87,"column":8},"end":{"line":90,"column":19}},"14":{"start":{"line":95,"column":8},"end":{"line":113,"column":9}},"15":{"start":{"line":97,"column":12},"end":{"line":110,"column":46}},"16":{"start":{"line":99,"column":16},"end":{"line":99,"column":52}},"17":{"start":{"line":104,"column":16},"end":{"line":108,"column":17}},"18":{"start":{"line":105,"column":20},"end":{"line":107,"column":21}},"19":{"start":{"line":106,"column":24},"end":{"line":106,"column":65}},"20":{"start":{"line":112,"column":12},"end":{"line":112,"column":68}},"21":{"start":{"line":116,"column":8},"end":{"line":116,"column":42}},"22":{"start":{"line":142,"column":8},"end":{"line":142,"column":111}},"23":{"start":{"line":157,"column":8},"end":{"line":175,"column":9}},"24":{"start":{"line":158,"column":12},"end":{"line":160,"column":26}},"25":{"start":{"line":162,"column":12},"end":{"line":172,"column":13}},"26":{"start":{"line":164,"column":16},"end":{"line":164,"column":63}},"27":{"start":{"line":165,"column":16},"end":{"line":167,"column":17}},"28":{"start":{"line":166,"column":20},"end":{"line":166,"column":84}},"29":{"start":{"line":169,"column":16},"end":{"line":171,"column":17}},"30":{"start":{"line":170,"column":20},"end":{"line":170,"column":38}},"31":{"start":{"line":174,"column":12},"end":{"line":174,"column":29}},"32":{"start":{"line":188,"column":8},"end":{"line":189,"column":48}},"33":{"start":{"line":191,"column":8},"end":{"line":199,"column":9}},"34":{"start":{"line":193,"column":12},"end":{"line":193,"column":53}},"35":{"start":{"line":195,"column":12},"end":{"line":198,"column":15}},"36":{"start":{"line":196,"column":16},"end":{"line":196,"column":43}},"37":{"start":{"line":197,"column":16},"end":{"line":197,"column":52}},"38":{"start":{"line":207,"column":8},"end":{"line":207,"column":32}},"39":{"start":{"line":208,"column":8},"end":{"line":208,"column":59}},"40":{"start":{"line":216,"column":8},"end":{"line":216,"column":43}},"41":{"start":{"line":217,"column":8},"end":{"line":219,"column":9}},"42":{"start":{"line":218,"column":12},"end":{"line":218,"column":37}},"43":{"start":{"line":220,"column":8},"end":{"line":220,"column":64}}},"branchMap":{"1":{"line":18,"type":"binary-expr","locations":[{"start":{"line":18,"column":33},"end":{"line":18,"column":49}},{"start":{"line":18,"column":53},"end":{"line":18,"column":55}}]},"2":{"line":35,"type":"if","locations":[{"start":{"line":35,"column":12},"end":{"line":35,"column":12}},{"start":{"line":35,"column":12},"end":{"line":35,"column":12}}]},"3":{"line":43,"type":"if","locations":[{"start":{"line":43,"column":16},"end":{"line":43,"column":16}},{"start":{"line":43,"column":16},"end":{"line":43,"column":16}}]},"4":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":20},"end":{"line":46,"column":20}},{"start":{"line":46,"column":20},"end":{"line":46,"column":20}}]},"5":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":8},"end":{"line":95,"column":8}},{"start":{"line":95,"column":8},"end":{"line":95,"column":8}}]},"6":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":16},"end":{"line":104,"column":16}},{"start":{"line":104,"column":16},"end":{"line":104,"column":16}}]},"7":{"line":105,"type":"if","locations":[{"start":{"line":105,"column":20},"end":{"line":105,"column":20}},{"start":{"line":105,"column":20},"end":{"line":105,"column":20}}]},"8":{"line":142,"type":"binary-expr","locations":[{"start":{"line":142,"column":16},"end":{"line":142,"column":58}},{"start":{"line":142,"column":62},"end":{"line":142,"column":109}}]},"9":{"line":157,"type":"if","locations":[{"start":{"line":157,"column":8},"end":{"line":157,"column":8}},{"start":{"line":157,"column":8},"end":{"line":157,"column":8}}]},"10":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":12},"end":{"line":162,"column":12}},{"start":{"line":162,"column":12},"end":{"line":162,"column":12}}]},"11":{"line":165,"type":"if","locations":[{"start":{"line":165,"column":16},"end":{"line":165,"column":16}},{"start":{"line":165,"column":16},"end":{"line":165,"column":16}}]},"12":{"line":169,"type":"if","locations":[{"start":{"line":169,"column":16},"end":{"line":169,"column":16}},{"start":{"line":169,"column":16},"end":{"line":169,"column":16}}]},"13":{"line":189,"type":"binary-expr","locations":[{"start":{"line":189,"column":20},"end":{"line":189,"column":41}},{"start":{"line":189,"column":45},"end":{"line":189,"column":47}}]},"14":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":8},"end":{"line":191,"column":8}},{"start":{"line":191,"column":8},"end":{"line":191,"column":8}}]},"15":{"line":191,"type":"binary-expr","locations":[{"start":{"line":191,"column":12},"end":{"line":191,"column":17}},{"start":{"line":191,"column":21},"end":{"line":191,"column":34}}]},"16":{"line":217,"type":"if","locations":[{"start":{"line":217,"column":8},"end":{"line":217,"column":8}},{"start":{"line":217,"column":8},"end":{"line":217,"column":8}}]},"17":{"line":217,"type":"binary-expr","locations":[{"start":{"line":217,"column":12},"end":{"line":217,"column":17}},{"start":{"line":217,"column":21},"end":{"line":217,"column":27}},{"start":{"line":217,"column":31},"end":{"line":217,"column":47}}]}},"code":["(function () { YUI.add('widget-uievents', function (Y, NAME) {","","/**"," * Support for Widget UI Events (Custom Events fired by the widget, which wrap the underlying DOM events - e.g. widget:click, widget:mousedown)"," *"," * @module widget"," * @submodule widget-uievents"," */","","var BOUNDING_BOX = \"boundingBox\","," Widget = Y.Widget,"," RENDER = \"render\","," L = Y.Lang,"," EVENT_PREFIX_DELIMITER = \":\",",""," // Map of Node instances serving as a delegation containers for a specific"," // event type to Widget instances using that delegation container."," _uievts = Y.Widget._uievts = Y.Widget._uievts || {};","","Y.mix(Widget.prototype, {",""," /**"," * Destructor logic for UI event infrastructure,"," * invoked during Widget destruction."," *"," * @method _destroyUIEvents"," * @for Widget"," * @private"," */"," _destroyUIEvents: function() {",""," var widgetGuid = Y.stamp(this, true);",""," Y.each(_uievts, function (info, key) {"," if (info.instances[widgetGuid]) {"," // Unregister this Widget instance as needing this delegated"," // event listener."," delete info.instances[widgetGuid];",""," // There are no more Widget instances using this delegated"," // event listener, so detach it.",""," if (Y.Object.isEmpty(info.instances)) {"," info.handle.detach();",""," if (_uievts[key]) {"," delete _uievts[key];"," }"," }"," }"," });"," },",""," /**"," * Map of DOM events that should be fired as Custom Events by the"," * Widget instance."," *"," * @property UI_EVENTS"," * @for Widget"," * @type Object"," */"," UI_EVENTS: Y.Node.DOM_EVENTS,",""," /**"," * Returns the node on which to bind delegate listeners."," *"," * @method _getUIEventNode"," * @for Widget"," * @protected"," */"," _getUIEventNode: function () {"," return this.get(BOUNDING_BOX);"," },",""," /**"," * Binds a delegated DOM event listener of the specified type to the"," * Widget's outtermost DOM element to facilitate the firing of a Custom"," * Event of the same type for the Widget instance."," *"," * @method _createUIEvent"," * @for Widget"," * @param type {String} String representing the name of the event"," * @private"," */"," _createUIEvent: function (type) {",""," var uiEvtNode = this._getUIEventNode(),"," key = (Y.stamp(uiEvtNode) + type),"," info = _uievts[key],"," handle;",""," // For each Node instance: Ensure that there is only one delegated"," // event listener used to fire Widget UI events.",""," if (!info) {",""," handle = uiEvtNode.delegate(type, function (evt) {",""," var widget = Widget.getByNode(this);",""," // Widget could be null if node instance belongs to"," // another Y instance.",""," if (widget) {"," if (widget._filterUIEvent(evt)) {"," widget.fire(evt.type, { domEvent: evt });"," }"," }",""," }, \".\" + Y.Widget.getClassName());",""," _uievts[key] = info = { instances: {}, handle: handle };"," }",""," // Register this Widget as using this Node as a delegation container."," info.instances[Y.stamp(this)] = 1;"," },",""," /**"," * This method is used to determine if we should fire"," * the UI Event or not. The default implementation makes sure"," * that for nested delegates (nested unrelated widgets), we don't"," * fire the UI event listener more than once at each level."," *"," * <p>For example, without the additional filter, if you have nested"," * widgets, each widget will have a delegate listener. If you"," * click on the inner widget, the inner delegate listener's"," * filter will match once, but the outer will match twice"," * (based on delegate's design) - once for the inner widget,"," * and once for the outer.</p>"," *"," * @method _filterUIEvent"," * @for Widget"," * @param {DOMEventFacade} evt"," * @return {boolean} true if it's OK to fire the custom UI event, false if not."," * @private"," *"," */"," _filterUIEvent: function(evt) {"," // Either it's hitting this widget's delegate container (and not some other widget's),"," // or the container it's hitting is handling this widget's ui events."," return (evt.currentTarget.compareTo(evt.container) || evt.container.compareTo(this._getUIEventNode()));"," },",""," /**"," * Determines if the specified event is a UI event."," *"," * @private"," * @method _isUIEvent"," * @for Widget"," * @param type {String} String representing the name of the event"," * @return {String} Event Returns the name of the UI Event, otherwise"," * undefined."," */"," _getUIEvent: function (type) {",""," if (L.isString(type)) {"," var sType = this.parseType(type)[1],"," iDelim,"," returnVal;",""," if (sType) {"," // TODO: Get delimiter from ET, or have ET support this."," iDelim = sType.indexOf(EVENT_PREFIX_DELIMITER);"," if (iDelim > -1) {"," sType = sType.substring(iDelim + EVENT_PREFIX_DELIMITER.length);"," }",""," if (this.UI_EVENTS[sType]) {"," returnVal = sType;"," }"," }",""," return returnVal;"," }"," },",""," /**"," * Sets up infrastructure required to fire a UI event."," *"," * @private"," * @method _initUIEvent"," * @for Widget"," * @param type {String} String representing the name of the event"," * @return {String}"," */"," _initUIEvent: function (type) {"," var sType = this._getUIEvent(type),"," queue = this._uiEvtsInitQueue || {};",""," if (sType && !queue[sType]) {",""," this._uiEvtsInitQueue = queue[sType] = 1;",""," this.after(RENDER, function() {"," this._createUIEvent(sType);"," delete this._uiEvtsInitQueue[sType];"," });"," }"," },",""," // Override of \"on\" from Base to facilitate the firing of Widget events"," // based on DOM events of the same name/type (e.g. \"click\", \"mouseover\")."," // Temporary solution until we have the ability to listen to when"," // someone adds an event listener (bug 2528230)"," on: function (type) {"," this._initUIEvent(type);"," return Widget.superclass.on.apply(this, arguments);"," },",""," // Override of \"publish\" from Base to facilitate the firing of Widget events"," // based on DOM events of the same name/type (e.g. \"click\", \"mouseover\")."," // Temporary solution until we have the ability to listen to when"," // someone publishes an event (bug 2528230)"," publish: function (type, config) {"," var sType = this._getUIEvent(type);"," if (sType && config && config.defaultFn) {"," this._initUIEvent(sType);"," }"," return Widget.superclass.publish.apply(this, arguments);"," }","","}, true); // overwrite existing EventTarget methods","","","}, '3.10.3', {\"requires\": [\"node-event-delegate\", \"widget-base\"]});","","}());"]}; |