[
  {
    "path": "LICENSE.txt",
    "content": "BSD License for Pointer Events Polyfill (http://github.com/kmewhort/pointer_events_polyfill)\n\nCopyright (c) 2013, Kent Mewhort\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the\nfollowing conditions are met:\n\n    Redistributions of source code must retain the above copyright notice, this list of conditions and the following\n    disclaimer.\n    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following\n    disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "# Pointer Events Polyfill\n\nPointer Events Polyfill is a short javascript library which adds support for the style attribute \"pointer-events: none\" to browsers without this feature (namely, MS IE).\n\n## Installation\n\nInclude any reasonable recent version of **jQuery** and **pointer\\_events\\_polyfill.js**.\n\n## Basic usage:\n\n```js\n$(document).ready(function(){\n  PointerEventsPolyfill.initialize({});\n});\n```\n\nThat's it! Any \"pointer-events: none\" attributes will now work seamlessly in IE.\n\n## Options\n\nYou can also pass any of the following options into the *initialize* call:\n\n* **selector**: CSS selector (default: \\*). You may wish to narrow this from '*' (all elements) in order to increase performance.\n* **mouseEvents**: Array of JS mouse events (default: ['click','dblclick','mousedown','mouseup']). Note that this default excludes a few mouse events for performance reasons, but you can add them back in.\n* **usePolyfillIf**: Function with boolean return value (default: simple check for IE<11). Return *true* to apply Pointer Events Polyfill. You can specify your own browser-support test function here (for example, you may wish to use feature detection with Modernizr instead of the default IE check).\n\n## License\n\n(c) 2013, Kent Mewhort, licensed under BSD. See LICENSE.txt for details.\n\n"
  },
  {
    "path": "pointer_events_polyfill.js",
    "content": "/*\n * Pointer Events Polyfill: Adds support for the style attribute\n * \"pointer-events: none\" to browsers without this feature (namely, IE).\n * (c) 2013, Kent Mewhort, licensed under BSD. See LICENSE.txt for details.\n */\n\n// constructor\nfunction PointerEventsPolyfill(options) {\n    // set defaults\n    this.options = {\n        selector: '*',\n        mouseEvents: ['click', 'dblclick', 'mousedown', 'mouseup'],\n        usePolyfillIf: function() {\n            if (navigator.appName == 'Microsoft Internet Explorer')\n            {\n                /* jshint ignore:start */\n                var agent = navigator.userAgent;\n                if (agent.match(/MSIE ([0-9]{1,}[\\.0-9]{0,})/) != null) {\n                    var version = parseFloat(RegExp.$1);\n                    if (version < 11)\n                      return true;\n                }\n                /* jshint ignore:end */\n            }\n            return false;\n        }\n    };\n    if (options) {\n        var obj = this;\n        $.each(options, function(k, v) {\n          obj.options[k] = v;\n        });\n    }\n\n    if (this.options.usePolyfillIf())\n      this.register_mouse_events();\n}\n\n\n/**\n * singleton initializer\n *\n * @param   {object}    options     Polyfill options.\n * @return  {object}    The polyfill object.\n */\n\nPointerEventsPolyfill.initialize = function(options) {\n/* jshint ignore:start */\n    if (PointerEventsPolyfill.singleton == null)\n      PointerEventsPolyfill.singleton = new PointerEventsPolyfill(options);\n/* jshint ignore:end */\n    return PointerEventsPolyfill.singleton;\n};\n\n\n/**\n * handle mouse events w/ support for pointer-events: none\n */\nPointerEventsPolyfill.prototype.register_mouse_events = function() {\n    // register on all elements (and all future elements) matching the selector\n    $(document).on(\n        this.options.mouseEvents.join(' '),\n        this.options.selector,\n        function(e) {\n        if ($(this).css('pointer-events') == 'none') {\n             // peak at the element below\n             var origDisplayAttribute = $(this).css('display');\n             $(this).css('display', 'none');\n\n             var underneathElem = document.elementFromPoint(\n                e.clientX,\n                e.clientY);\n\n            if (origDisplayAttribute)\n                $(this)\n                    .css('display', origDisplayAttribute);\n            else\n                $(this).css('display', '');\n\n             // fire the mouse event on the element below\n            e.target = underneathElem;\n            $(underneathElem).trigger(e);\n\n            return false;\n        }\n        return true;\n    });\n};\n"
  }
]