/**1* Copyright 2013-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule MobileSafariClickEventPlugin9* @typechecks static-only10*/1112'use strict';1314var EventConstants = require("./EventConstants");1516var emptyFunction = require("./emptyFunction");1718var topLevelTypes = EventConstants.topLevelTypes;1920/**21* Mobile Safari does not fire properly bubble click events on non-interactive22* elements, which means delegated click listeners do not fire. The workaround23* for this bug involves attaching an empty click listener on the target node.24*25* This particular plugin works around the bug by attaching an empty click26* listener on `touchstart` (which does fire on every element).27*/28var MobileSafariClickEventPlugin = {2930eventTypes: null,3132/**33* @param {string} topLevelType Record from `EventConstants`.34* @param {DOMEventTarget} topLevelTarget The listening component root node.35* @param {string} topLevelTargetID ID of `topLevelTarget`.36* @param {object} nativeEvent Native browser event.37* @return {*} An accumulation of synthetic events.38* @see {EventPluginHub.extractEvents}39*/40extractEvents: function(41topLevelType,42topLevelTarget,43topLevelTargetID,44nativeEvent) {45if (topLevelType === topLevelTypes.topTouchStart) {46var target = nativeEvent.target;47if (target && !target.onclick) {48target.onclick = emptyFunction;49}50}51}5253};5455module.exports = MobileSafariClickEventPlugin;565758