[
  {
    "path": ".eslintrc",
    "content": "{\n  \"root\": true,\n  \n  \"extends\": \"jquery\",\n  \n  \"globals\": {\n    \"window\": true,\n    \"jQuery\": true,\n    \"define\": true,\n    \"module\": true,\n    \"noGlobal\": true,\n    \"document\": true,\n    \"navigator\": true,\n    \"console\": true\n  },\n  \n  \"rules\": {\n    \"space-in-parens\": \"off\",\n    \"quotes\": [\n      \"warn\",\n      \"double\",\n      {\n        \"avoidEscape\": true\n      }\n    ],\n    \"computed-property-spacing\": [\"error\", \"never\"],\n    \"max-len\": [\n      \"warn\",\n      {\n        \"code\": 100,\n        \"ignoreComments\": true,\n        \"ignoreUrls\": true,\n        \"ignoreRegExpLiterals\": true,\n        \"ignoreStrings\": true\n      }\n    ],\n    \"lines-around-comment\": [\n      \"error\",\n      {\n        \"beforeLineComment\": true,\n        \"allowBlockStart\": true,\n        \"allowObjectStart\": true\n      }\n    ],\n    \"no-unused-vars\": [\n      \"error\",\n      {\n        \"args\": \"none\"\n      }\n    ],\n    \"array-bracket-spacing\": [\n      \"error\",\n      \"never\"\n    ],\n    \"strict\": \"off\"\n  }\n}\n"
  },
  {
    "path": ".gitignore",
    "content": "*.diff\n*.patch\n.DS_Store\n/node_modules\n/dist\n"
  },
  {
    "path": ".npmignore",
    "content": "/demo\n/bower.json\n/Gruntfile.js\n/.eslintrc\n/.travis.yml\n/test\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nsudo: false\nnode_js:\n  - \"node\"\ncache:\n  directories:\n    - node_modules\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to iframeTracker\n\n## Bug report\n* Please provide a live example (use tools like [jsbin](https://jsbin.com), [jsfiddle](https://jsfiddle.net) or [codepen](https://codepen.io/))\n* Indicate which browsers the issue can be reproduced in\n\n## Build setup\n1. Fork and clone the repository\n1. Run `npm install` to install all dependencies\n1. Run `npm test` to check your build environment\n\n## Coding guidelines\n* Enforce existing coding style (*eslint* will help you : `npx grunt eslint`)\n* Use UTF-8 charset\n* Beware to not decrease code coverage (write new tests for new code)\n\n## Pull request\n1. Create a new branch from `develop` (please don't work on your `develop` branch directly)\n1. Run `npm test`\n1. Open `test/unit/*.html` unit test files in actual browser to ensure tests pass everywhere\n1. Update the documentation to reflect any changes\n1. Push to your fork and submit a pull request\n"
  },
  {
    "path": "Gruntfile.js",
    "content": "\"use strict\";\n\nmodule.exports = function(grunt) {\n\tgrunt.util.linefeed = \"\\n\";\n\n\tgrunt.initConfig({\n\t\tpkg: grunt.file.readJSON(\"package.json\"),\n\n\t\tbanner: \"/*! <%= pkg.name %> v<%= pkg.version %>\" +\n\t\t\t\"<%= pkg.homepage ? ' | ' + pkg.homepage : '' %>\" +\n\t\t\t\" | Copyright (c) 2013-<%= grunt.template.today('yyyy') %> <%= pkg.author %>\" +\n\t\t\t\" | Licensed <%= pkg.license %> */\",\n\n\t\tcopy: {\n\t\t\toptions: {\n\t\t\t\tprocess: function(content, srcpath) {\n\t\t\t\t\treturn grunt.template.process(content);\n\t\t\t\t}\n\t\t\t},\n\t\t\tmain: {\n\t\t\t\tsrc: \"src/jquery.iframetracker.js\",\n\t\t\t\tdest: \"dist/jquery.iframetracker.js\"\n\t\t\t}\n\t\t},\n\n\t\tumd: {\n\t\t\tall: {\n\t\t\t\tsrc: \"dist/jquery.iframetracker.js\",\n\t\t\t\ttemplate: \"./src/umd.hbs\",\n\t\t\t\tdeps: {\n\t\t\t\t\t\"default\": [\"jQuery\"],\n\t\t\t\t\tamd: [\"jquery\"],\n\t\t\t\t\tcjs: [\"jquery\"]\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tuglify: {\n\t\t\toptions: {\n\t\t\t\tbanner: \"<%= banner %>\"\n\t\t\t},\n\t\t\tmain: {\n\t\t\t\tsrc: [\"dist/jquery.iframetracker.js\"],\n\t\t\t\tdest: \"dist/jquery.iframetracker.min.js\"\n\t\t\t}\n\t\t},\n\n\t\teslint: {\n\t\t\ttarget: [\"src/**/*.js\", \"test/**/*.js\", \"Gruntfile.js\"]\n\t\t},\n\n\t\tqunit: {\n\t\t\tfiles: [\"test/**/*.html\"]\n\t\t}\n\t});\n\n\tgrunt.loadNpmTasks(\"grunt-contrib-copy\");\n\tgrunt.loadNpmTasks(\"grunt-contrib-uglify\");\n\tgrunt.loadNpmTasks(\"grunt-eslint\");\n\tgrunt.loadNpmTasks(\"grunt-contrib-qunit\");\n\tgrunt.loadNpmTasks(\"grunt-umd\");\n\n\tgrunt.registerTask(\"compile\", [\"copy\", \"umd\", \"uglify\"]);\n\tgrunt.registerTask(\"default\", [\"eslint\", \"qunit\", \"compile\"]);\n};\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   Copyright 2013 Vincent Paré\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "iframeTracker jQuery Plugin\n===========================\niframeTracker is a jQuery plugin that allow to track clicks on iframes.\n\nThis is very useful to :\n\n - track clicks on Google Adsense (google uses iframes to display ads)\n - track clicks on Facebook Like buttons\n - track clicks on Youtube embed video player\n - ... and any other iframe !\n\nTry it now : [demo](https://cdn.rawgit.com/vincepare/iframeTracker-jquery/master/demo/index.html).\n\nHow does it work ?\n------------------\nSince it's impossible to read iframe content (DOM) from the parent page due to the [same origin policy](http://en.wikipedia.org/wiki/Same-origin_policy), tracking is based on the blur event associated to a **page/iframe boundary monitoring system** telling over which iframe is the mouse cursor at any time.\n\nHow to use ?\n------------\nMatch the iframe elements you want to track with a jQuery selector and call `iframeTracker` with a callback function that will be called when a click on the iframe is detected :\n\n```javascript\njQuery(document).ready(function($){\n\t$('.iframe_wrap iframe').iframeTracker({\n\t\tblurCallback: function(event) {\n\t\t\t// Do something when the iframe is clicked (like firing an XHR request)\n\t\t}\n\t});\n});\n```\n\nYou can also just pass a function, that will be then registered as the `blurCallback` :\n\n```javascript\njQuery(document).ready(function($){\n\t$('.iframe_wrap iframe').iframeTracker(function(event) {\n\t\t// Do something when the iframe is clicked (like firing an XHR request)\n\t});\n});\n```\n\n### Advanced tracking\n\n```javascript\njQuery(document).ready(function($){\n\t$('.iframe_wrap iframe').iframeTracker({\n\t\tblurCallback: function(event) {\n\t\t\t// Do something when iframe is clicked (like firing an XHR request)\n\t\t\t// You can know which iframe element is clicked via this._overId\n\t\t},\n\t\toverCallback: function(element, event) {\n\t\t\tthis._overId = $(element).parents('.iframe_wrap').attr('id'); // Saving the iframe wrapper id\n\t\t},\n\t\toutCallback: function(element, event) {\n\t\t\tthis._overId = null; // Reset hover iframe wrapper id\n\t\t},\n\t\t_overId: null\n\t});\n});\n```\n\n#### Cancel tracking\nYou can remove a tracker attached to an iframe by calling `.iframeTracker()` with either `false` or `null` :\n```javascript\n$('#iframe_red_1 iframe').iframeTracker(false);\n$('#iframe_red_2 iframe').iframeTracker(null);\n```\n\nFull tutorial available [here](http://www.finalclap.com/tuto/track-iframe-click-jquery-87/) (it's in French).\n\nTested on jQuery `1.4.4` to `1.11.0`, `2.1.4`  & `3.2.1`.\n\n----------\n\n### Install\nWith npm :\n```bash\nnpm install jquery.iframetracker\n```\n\nWith bower :\n```bash\nbower install jquery.iframetracker\n```\n\n### About mobile devices\nThis plugin doesn't work on mobile devices such as smartphones and tablets, because this hardware uses a touchscreen instead of a mouse as click input. This design makes the boundary monitoring trick ineffective.\n\n### Donate\nDonations are welcome :) via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YXDJFGF8GCGLA&item_name=Vincent%20Par%e9%20-%20www.finalclap.com&item_number=iframeTracker%2dgithub&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted), [Flattr](https://flattr.com/submit/auto?user_id=finalclap&url=https://github.com/vincepare/iframeTracker-jquery&title=iframeTracker%20jQuery%20Plugin&language=&tags=github&category=software) or Bitcoin at this address : `3G5uTti2JPAT738uDeQXjrN7tUj2NZjt6M` or by flashing this lovely QR code :\n\n![qrcode for bitcoin address 3G5uTti2JPAT738uDeQXjrN7tUj2NZjt6M](https://vincepare.github.io/img/qrcode-bitcoin-3G5uTti2JPAT738uDeQXjrN7tUj2NZjt6M.png)\n"
  },
  {
    "path": "bower.json",
    "content": "{\n  \"name\": \"jquery.iframetracker\",\n  \"version\": \"2.1.0\",\n  \"homepage\": \"https://github.com/vincepare/iframeTracker-jquery\",\n  \"authors\": [\n    \"Vincent Paré\"\n  ],\n  \"description\": \"jQuery Plugin to track click on iframes (like Google Adsense or Facebook Like button).\",\n  \"main\": \"dist/jquery.iframetracker.js\",\n  \"moduleType\": [\n    \"globals\"\n  ],\n  \"keywords\": [\n    \"iframe\",\n    \"youtube\",\n    \"adsense\",\n    \"advertising\",\n    \"click\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"test\",\n    \"tests\",\n    \"demo\",\n    \"src\",\n    \"Gruntfile.js\",\n    \"README.md\",\n    \"package-lock.json\",\n    \"package.json\"\n  ],\n  \"dependencies\": {\n    \"jquery\": \">=1.4.4\"\n  }\n}\n"
  },
  {
    "path": "demo/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>jQuery iframe click tracking plugin</title>\n<link href=\"https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css\" rel=\"stylesheet\">\n<style>\nbody{background:#efefef; height:100%; padding-top:40px;}\n.navbar{position:absolute;}\n#wrap{margin:20px 20px 50px;}\n#credit{margin:20px 0 0;}\n#consoleDebug{position:fixed; top:60px; right:30px; z-index:9999; background:rgba(0,0,0,0.3);}\n#consoleDebug .alert{margin:20px;}\n</style>\n\n<!-- <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js\"></script> -->\n<!-- <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script> -->\n<!-- <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script> -->\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js\"></script>\n<!-- <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script> -->\n<script src=\"../dist/jquery.iframetracker.js\"></script>\n<script>\njQuery(document).ready(function($){\n\t// Facebook iframe\n\t$('.socialiframetrack_facebook iframe').iframeTracker({\n\t\tblurCallback: function(event){\n\t\t\t$('<div class=\"alert alert-info\">').html('Click on Facebook iframe').appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t}\n\t});\n\t\n\t// Google +1 iframe (must wait a few second until google renderer create the iframe)\n\tsetTimeout(function(){\n\t\t$('.socialiframetrack_google iframe').iframeTracker({\n\t\t\tblurCallback: function(event){\n\t\t\t\t$('<div class=\"alert alert-info\">').html('Click on Google+1 iframe').appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t\t}\n\t\t});\n\t}, 2000);\n\t\n\t// Other iframes (wrapped with .iframetrack)\n\t$('.iframetrack iframe').iframeTracker({\n\t\tblurCallback: function(event){\n\t\t\t$('<div class=\"alert alert-info\">').html('Click on iframe : #' + this._overId).appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t},\n\t\toverCallback: function(element, event){\n\t\t\tthis._overId = $(element).parents('.iframetrack').attr('id'); // Saving the iframe wrapper id\n\t\t},\n\t\toutCallback: function(element, event){\n\t\t\tthis._overId = null; // Reset hover iframe wrapper id\n\t\t},\n\t\t_overId: null\n\t});\n\t\n\t// Untrack\n\t$('#untrack_iframe_red_1').click(function(e){\n\t\t$('<div class=\"alert alert-danger\">').html('untrack #iframe_red_1').appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t$('#iframe_red_1 iframe').iframeTracker(false);\n\t});\n\t$('#untrack_iframe_red_2').click(function(e){\n\t\t$('<div class=\"alert alert-danger\">').html('untrack #iframe_red_2').appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t$('#iframe_red_2 iframe').iframeTracker(null);\n\t});\n\t$('#untrack_iframe_blue').click(function(e){\n\t\t$('<div class=\"alert alert-danger\">').html('untrack #iframe_blue').appendTo('#consoleDebug').delay(3000).fadeOut();\n\t\t$('#iframe_blue iframe').iframeTracker(false);\n\t});\n});\n</script>\n</head>\n\n<body>\n<div class=\"navbar navbar-inverse navbar-fixed-top\">\n\t<div class=\"navbar-inner\">\n\t\t<div class=\"container-fluid\">\n\t\t\t<span class=\"brand white\">jQuery iframe click tracking plugin demo</span>\n\t\t</div>\n\t</div>\n</div>\n\n<div id=\"wrap\">\n\t<p class=\"well\">Read the tutorial on how the tracking works at <a href=\"http://www.finalclap.com/tuto/track-iframe-click-jquery-87/\" target=\"_blank\">http://www.finalclap.com/tuto/track-iframe-click-jquery-87/</a> (it's in French).</p>\n\t\n\t<h1>HTML Ipsum Presents</h1>\t       \n\t<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>\n\t<div class=\"iframetrack\" id=\"iframe_red_1\">\n\t\t<iframe width=\"728\" height=\"90\" src=\"./sample-iframe/red.html\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t<h2>Header Level 2</h2>\n\t<ol>\n\t\t<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>\n\t\t<li>Aliquam tincidunt mauris eu risus.</li>\n\t\t<li>\n\t\t\t<strong>Facebook like &amp; Google+1 iframes</strong>\n\t\t\t<div class=\"well\">\n\t\t\t\t<div class=\"socialiframetrack_facebook\" style=\"float:left; margin-right:12px;\" id=\"iframe_facebook_like\">\n\t\t\t\t\t<iframe src=\"//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.finalclap.com%2F&amp;send=false&amp;layout=box_count&amp;width=70&amp;show_faces=false&amp;font=arial&amp;colorscheme=light&amp;action=like&amp;height=80\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:70px; height:80px;\" allowTransparency=\"true\"></iframe>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"socialiframetrack_google\" style=\"float:left;\" id=\"iframe_google_plusone\">\n\t\t\t\t\t<div class=\"g-plusone\" data-size=\"tall\"></div>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"clear:left;\"></div>\n\t\t\t</div>\n\t\t</li>\n\t</ol>\n\t<blockquote>\n\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p>\n\t</blockquote>\n\t<div class=\"iframetrack\" id=\"iframe_blue\">\n\t\t<iframe width=\"336\" height=\"280\" src=\"./sample-iframe/blue.html\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t<h3>Header Level 3</h3>\n\t<ul>\n\t\t<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>\n\t\t<li>Aliquam tincidunt mauris eu risus.</li>\n\t</ul>\n\t<pre>#header h1 a { \n\tdisplay: block; \n\twidth: 300px; \n\theight: 80px; \n}</pre>\n\t<div class=\"iframetrack\" id=\"iframe_red_2\">\n\t\t<iframe width=\"250\" height=\"250\" src=\"./sample-iframe/red.html\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t\n\t<h3>Untrack</h3>\n\t<p>Remove tracking</p>\n\t<div class=\"well\">\n\t\t<a class=\"btn btn-inverse\" id=\"untrack_iframe_red_1\">Untrack #iframe_red_1</a>\n\t\t<a class=\"btn btn-inverse\" id=\"untrack_iframe_red_2\">Untrack #iframe_red_2</a>\n\t\t<a class=\"btn btn-inverse\" id=\"untrack_iframe_blue\">Untrack #iframe_blue</a>\n\t</div>\n\t\n\t<p id=\"credit\">&copy; <a href=\"https://github.com/vincepare\" target=\"_blank\">Vincent Paré</a>, using jQuery &amp; Bootstrap from twitter</p>\n</div><!-- #wrap -->\n\n<div id=\"consoleDebug\"></div>\n\n<script>\n  (function() {\n    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;\n    po.src = 'https://apis.google.com/js/plusone.js';\n    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);\n  })();\n</script>\n</body>\n</html>"
  },
  {
    "path": "demo/sample-iframe/blue.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Blue iframe</title>\n<style>\nbody{padding:5px 10px 0; background:#2984E7; color:white; font:16px Arial, Helvetica, sans-serif;}\nh1{margin:0 0 10px; font:normal 20pt Arial, Helvetica, sans-serif;}\np{margin:0;}\n</style>\n</head>\n\n<body>\n<h1>Blue iframe</h1>\n<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.</p>\n<ol>\n   <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>\n   <li>Aliquam tincidunt mauris eu risus.</li>\n   <li>Vestibulum auctor dapibus neque.</li>\n</ol>\n</body>\n</html>"
  },
  {
    "path": "demo/sample-iframe/red.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Red iframe</title>\n<style>\nbody{padding:5px 10px 0; background:#E72947; color:white; font:16px Arial, Helvetica, sans-serif;}\nh1{margin:0 0 10px; font:normal 20pt Arial, Helvetica, sans-serif;}\np{margin:0;}\n</style>\n</head>\n\n<body>\n<h1>Red iframe</h1>\n<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n</body>\n</html>"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"jquery.iframetracker\",\n  \"version\": \"2.1.0\",\n  \"description\": \"jQuery Plugin to track click on iframes (like Google Adsense or Facebook Like button).\",\n  \"main\": \"dist/jquery.iframetracker.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/vincepare/iframeTracker-jquery.git\"\n  },\n  \"keywords\": [\n    \"jquery-plugin\",\n    \"iframe\",\n    \"youtube\",\n    \"adsense\",\n    \"advertising\",\n    \"click\"\n  ],\n  \"author\": \"Vincent Paré\",\n  \"license\": \"Apache-2.0\",\n  \"bugs\": {\n    \"url\": \"https://github.com/vincepare/iframeTracker-jquery/issues\"\n  },\n  \"homepage\": \"https://github.com/vincepare/iframeTracker-jquery\",\n  \"scripts\": {\n    \"test\": \"grunt eslint qunit\",\n    \"build\": \"grunt\",\n    \"prepare\": \"grunt\"\n  },\n  \"peerDependencies\": {\n    \"jquery\": \">=1.4.4\"\n  },\n  \"devDependencies\": {\n    \"eslint-config-jquery\": \"^1.0.1\",\n    \"grunt\": \"^1.0.1\",\n    \"grunt-contrib-copy\": \"^1.0.0\",\n    \"grunt-contrib-qunit\": \"^2.0.0\",\n    \"grunt-contrib-uglify\": \"^3.0.1\",\n    \"grunt-eslint\": \"^19.0.0\",\n    \"grunt-umd\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "src/jquery.iframetracker.js",
    "content": "/*!\n * jQuery iframe click tracking plugin\n *\n * @author Vincent Paré\n * @copyright © 2013-<%= grunt.template.today(\"yyyy\") %> Vincent Paré\n * @license http://opensource.org/licenses/Apache-2.0\n * @version <%= pkg.version %>\n */\n(function($) {\n\t// Tracking handler manager\n\t$.fn.iframeTracker = function(handler) {\n\t\t// Building handler object from handler function\n\t\tif (typeof handler == \"function\") {\n\t\t\thandler = {\n\t\t\t\tblurCallback: handler\n\t\t\t};\n\t\t}\n\n\t\tvar target = this.get();\n\t\tif (handler === null || handler === false) {\n\t\t\t$.iframeTracker.untrack(target);\n\t\t} else if (typeof handler == \"object\") {\n\t\t\t$.iframeTracker.track(target, handler);\n\t\t} else {\n\t\t\tthrow new Error(\"Wrong handler type (must be an object, or null|false to untrack)\");\n\t\t}\n\t\treturn this;\n\t};\n\n\t// Iframe tracker common object\n\t$.iframeTracker = {\n\t\t// State\n\t\tfocusRetriever: null,  // Element used for restoring focus on window (element)\n\t\tfocusRetrieved: false, // Says if the focus was retrieved on the current page (bool)\n\t\thandlersList: [],      // Store a list of every trakers (created by calling $(selector).iframeTracker...)\n\t\tisIE8AndOlder: false,  // true for Internet Explorer 8 and older\n\n\t\t// Init (called once on document ready)\n\t\tinit: function() {\n\t\t\t// Determine browser version (IE8-) ($.browser.msie is deprecated since jQuery 1.9)\n\t\t\ttry {\n\t\t\t\tif ($.browser.msie === true && $.browser.version < 9) {\n\t\t\t\t\tthis.isIE8AndOlder = true;\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\ttry {\n\t\t\t\t\tvar matches = navigator.userAgent.match(/(msie) ([\\w.]+)/i);\n\t\t\t\t\tif (matches[2] < 9) {\n\t\t\t\t\t\tthis.isIE8AndOlder = true;\n\t\t\t\t\t}\n\t\t\t\t} catch (ex2) {}\n\t\t\t}\n\n\t\t\t// Listening window blur\n\t\t\t$(window).focus();\n\t\t\t$(window).blur(function(e) {\n\t\t\t\t$.iframeTracker.windowLoseFocus(e);\n\t\t\t});\n\n\t\t\t// Focus retriever (get the focus back to the page, on mouse move)\n\t\t\t$(\"body\").append('<div style=\"position:fixed; top:0; left:0; overflow:hidden;\"><input style=\"position:absolute; left:-300px;\" type=\"text\" value=\"\" id=\"focus_retriever\" readonly=\"true\" /></div>');\n\t\t\tthis.focusRetriever = $(\"#focus_retriever\");\n\t\t\tthis.focusRetrieved = false;\n\n\t\t\t// Special processing to make it work with my old friend IE8 (and older) ;)\n\t\t\tif (this.isIE8AndOlder) {\n\t\t\t\t// Blur doesn't works correctly on IE8-, so we need to trigger it manually\n\t\t\t\tthis.focusRetriever.blur(function(e) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\t$.iframeTracker.windowLoseFocus(e);\n\t\t\t\t});\n\n\t\t\t\t// Keep focus on window (fix bug IE8-, focusable elements)\n\t\t\t\t$(\"body\").click(function(e) {\n\t\t\t\t\t$(window).focus();\n\t\t\t\t});\n\t\t\t\t$(\"form\").click(function(e) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t});\n\n\t\t\t\t// Same thing for \"post-DOMready\" created forms (issue #6)\n\t\t\t\ttry {\n\t\t\t\t\t$(\"body\").on(\"click\", \"form\", function(e) {\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t});\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tconsole.log(\"[iframeTracker] Please update jQuery to 1.7 or newer. (exception: \" + ex.message + \")\");\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t// Add tracker to target using handler (bind boundary listener + register handler)\n\t\t// target: Array of target elements (native DOM elements)\n\t\t// handler: User handler object\n\t\ttrack: function(target, handler) {\n\t\t\t// Adding target elements references into handler\n\t\t\thandler.target = target;\n\n\t\t\t// Storing the new handler into handler list\n\t\t\t$.iframeTracker.handlersList.push(handler);\n\n\t\t\t// Binding boundary listener\n\t\t\t$(target)\n\t\t\t\t.bind(\"mouseover\", { handler: handler }, $.iframeTracker.mouseoverListener)\n\t\t\t\t.bind(\"mouseout\",  { handler: handler }, $.iframeTracker.mouseoutListener);\n\t\t},\n\n\t\t// Remove tracking on target elements\n\t\t// target: Array of target elements (native DOM elements)\n\t\tuntrack: function(target) {\n\t\t\tif (typeof Array.prototype.filter != \"function\") {\n\t\t\t\tconsole.log(\"Your browser doesn't support Array filter, untrack disabled\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Unbinding boundary listener\n\t\t\t$(target).each(function(index) {\n\t\t\t\t$(this)\n\t\t\t\t\t.unbind(\"mouseover\", $.iframeTracker.mouseoverListener)\n\t\t\t\t\t.unbind(\"mouseout\", $.iframeTracker.mouseoutListener);\n\t\t\t});\n\n\t\t\t// Handler garbage collector\n\t\t\tvar nullFilter = function(value) {\n\t\t\t\treturn value === null ? false : true;\n\t\t\t};\n\t\t\tfor (var i in this.handlersList) {\n\t\t\t\t// Prune target\n\t\t\t\tfor (var j in this.handlersList[i].target) {\n\t\t\t\t\tif ($.inArray(this.handlersList[i].target[j], target) !== -1) {\n\t\t\t\t\t\tthis.handlersList[i].target[j] = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.handlersList[i].target = this.handlersList[i].target.filter(nullFilter);\n\n\t\t\t\t// Delete handler if unused\n\t\t\t\tif (this.handlersList[i].target.length === 0) {\n\t\t\t\t\tthis.handlersList[i] = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.handlersList = this.handlersList.filter(nullFilter);\n\t\t},\n\n\t\t// Target mouseover event listener\n\t\tmouseoverListener: function(e) {\n\t\t\te.data.handler.over = true;\n\t\t\t$.iframeTracker.retrieveFocus();\n\t\t\ttry {\n\t\t\t\te.data.handler.overCallback(this, e);\n\t\t\t} catch (ex) {}\n\t\t},\n\n\t\t// Target mouseout event listener\n\t\tmouseoutListener: function(e) {\n\t\t\te.data.handler.over = false;\n\t\t\t$.iframeTracker.retrieveFocus();\n\t\t\ttry {\n\t\t\t\te.data.handler.outCallback(this, e);\n\t\t\t} catch (ex) {}\n\t\t},\n\n\t\t// Give back focus from an iframe to parent page\n\t\tretrieveFocus: function() {\n\t\t\tif (document.activeElement && document.activeElement.tagName === \"IFRAME\") {\n\t\t\t\t$.iframeTracker.focusRetriever.focus();\n\t\t\t\t$.iframeTracker.focusRetrieved = true;\n\t\t\t}\n\t\t},\n\n\t\t// Calls blurCallback for every handler with over=true on window blur\n\t\twindowLoseFocus: function(e) {\n\t\t\tfor (var i in this.handlersList) {\n\t\t\t\tif (this.handlersList[i].over === true) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.handlersList[i].blurCallback(e);\n\t\t\t\t\t} catch (ex) {}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\t// Init the iframeTracker on document ready\n\t$(document).ready(function() {\n\t\t$.iframeTracker.init();\n\t});\n})(jQuery);\n"
  },
  {
    "path": "src/umd.hbs",
    "content": "(function (root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine({{#if amdModuleId}}'{{amdModuleId}}', {{/if}}[{{{amdDependencies.wrapped}}}], function ({{{amdDependencies.params}}}) {\n\t\t\treturn ({{#if objectToExport}}root['{{{objectToExport}}}'] = {{/if}}factory({{{amdDependencies.params}}}));\n\t\t});\n\t} else if (typeof module === 'object' && module.exports) {\n\t\tmodule.exports = factory({{{cjsDependencies.wrapped}}});\n\t} else {\n\t\t{{#if globalAlias}}root['{{{globalAlias}}}'] = {{else}}{{#if objectToExport}}root['{{{objectToExport}}}'] = {{/if}}{{/if}}factory({{{globalDependencies.normal}}});\n\t}\n}(this, function ({{dependencies}}) {\n\n{{{code}}}\n{{#if objectToExport}}\nreturn {{{objectToExport}}};\n{{/if}}\n}));\n"
  },
  {
    "path": "test/unit/.eslintrc",
    "content": "{\n  \"globals\": {\n    \"QUnit\": true\n  }\n}\n"
  },
  {
    "path": "test/unit/iframeTracker-jQuery1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>iframeTracker Test Suite - jQuery 1</title>\n\t<link rel=\"stylesheet\" href=\"https://code.jquery.com/qunit/qunit-2.3.3.css\">\n</head>\n<body>\n\t<div id=\"qunit\"></div>\n\t<div id=\"qunit-fixture\">\n\t\t<iframe width=\"728\" height=\"90\" src=\"../../demo/sample-iframe/red.html\" id=\"red_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t\t<iframe width=\"336\" height=\"280\" src=\"../../demo/sample-iframe/blue.html\" id=\"blue_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t<script src=\"https://code.jquery.com/qunit/qunit-2.3.3.js\"></script>\n\t<script src=\"https://code.jquery.com/jquery-1.11.0.min.js\"></script>\n\t<script src=\"../../src/jquery.iframetracker.js\"></script>\n\t<script src=\"iframeTracker_test.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "test/unit/iframeTracker-jQuery2.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>iframeTracker Test Suite - jQuery 2</title>\n\t<link rel=\"stylesheet\" href=\"https://code.jquery.com/qunit/qunit-2.3.3.css\">\n</head>\n<body>\n\t<div id=\"qunit\"></div>\n\t<div id=\"qunit-fixture\">\n\t\t<iframe width=\"728\" height=\"90\" src=\"../../demo/sample-iframe/red.html\" id=\"red_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t\t<iframe width=\"336\" height=\"280\" src=\"../../demo/sample-iframe/blue.html\" id=\"blue_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t<script src=\"https://code.jquery.com/qunit/qunit-2.3.3.js\"></script>\n\t<script src=\"https://code.jquery.com/jquery-2.1.4.min.js\"></script>\n\t<script src=\"../../src/jquery.iframetracker.js\"></script>\n\t<script src=\"iframeTracker_test.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "test/unit/iframeTracker-jQuery3.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>iframeTracker Test Suite - jQuery 3</title>\n\t<link rel=\"stylesheet\" href=\"https://code.jquery.com/qunit/qunit-2.3.3.css\">\n</head>\n<body>\n\t<div id=\"qunit\"></div>\n\t<div id=\"qunit-fixture\">\n\t\t<iframe width=\"728\" height=\"90\" src=\"../../demo/sample-iframe/red.html\" id=\"red_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t\t<iframe width=\"336\" height=\"280\" src=\"../../demo/sample-iframe/blue.html\" id=\"blue_iframe\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\"></iframe>\n\t</div>\n\t<script src=\"https://code.jquery.com/qunit/qunit-2.3.3.js\"></script>\n\t<script src=\"https://code.jquery.com/jquery-3.2.1.min.js\"></script>\n\t<script src=\"../../src/jquery.iframetracker.js\"></script>\n\t<script src=\"iframeTracker_test.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "test/unit/iframeTracker_test.js",
    "content": "(function($) {\n\t/**\n\t * Returns a dummy spy iframeTracker handler\n\t */\n\tvar stepHandlerFactory = function(assert) {\n\t\treturn {\n\t\t\tblurCallback: function(event) {\n\t\t\t\tassert.step(\"blur \" + this.iframeId);\n\t\t\t\tassert.ok(event instanceof $.Event, \"event is an Event\");\n\t\t\t},\n\t\t\toverCallback: function(element, event) {\n\t\t\t\tthis.iframeId = $(element).attr(\"id\");\n\t\t\t\tassert.step(\"over \" + this.iframeId);\n\t\t\t\tassert.ok(event instanceof $.Event, \"event is an Event\");\n\t\t\t},\n\t\t\toutCallback: function(element, event) {\n\t\t\t\tthis.iframeId = null;\n\t\t\t\tassert.step(\"out \" + $(element).attr(\"id\"));\n\t\t\t\tassert.ok(event instanceof $.Event, \"event is an Event\");\n\t\t\t}\n\t\t};\n\t};\n\n\tQUnit.testDone(function(details) {\n\t\t$.iframeTracker.handlersList = [];\n\t\t$.iframeTracker.focusRetrieved = false;\n\t\tdocument.activeElement.blur();\n\t\t$(window).focus();\n\t});\n\n\tQUnit.test(\"init\", function(assert) {\n\t\tassert.ok($.iframeTracker.focusRetriever.is(\"input\"), \"Focus retriever element looks good\");\n\t\tassert.ok($.iframeTracker.focusRetrieved === false, \"Focus was not yet retrieved\");\n\t\tassert.ok($.iframeTracker.handlersList instanceof Array, \"handlersList is an array\");\n\t\tassert.ok($.iframeTracker.handlersList.length === 0, \"handlersList is empty\");\n\t\tassert.ok(document.activeElement === document.querySelector(\"body\"), \"<body> has focus\");\n\t});\n\n\tQUnit.test(\"Focus retriever\", function(assert) {\n\t\t$(\"#qunit-fixture iframe\").iframeTracker({});\n\t\tassert.ok(document.activeElement === document.querySelector(\"body\"), \"<body> has focus\");\n\t\t$(document).trigger(\"mousemove\");\n\t\tassert.ok(document.activeElement === document.querySelector(\"body\"), \"<body> still has focus\");\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseover\");\n\t\t$(\"#qunit-fixture #red_iframe\").focus();\n\t\tassert.ok(document.activeElement === document.querySelector(\"#qunit-fixture #red_iframe\"), \"Focus on an iframe\");\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseout\");\n\t\t$(document).trigger(\"mousemove\");\n\t\tassert.ok(document.activeElement === $.iframeTracker.focusRetriever[0], \"Focus retrieved (element)\");\n\t\tassert.ok($.iframeTracker.focusRetrieved === true, \"Focus retrieved (flag)\");\n\t});\n\n\tQUnit.test(\"track\", function(assert) {\n\t\tassert.ok($.iframeTracker.handlersList.length === 0, \"handlersList is empty\");\n\t\tvar iframe = document.querySelector(\"#qunit-fixture #red_iframe\");\n\t\tvar handler = function() {};\n\t\t$.iframeTracker.track(iframe, handler);\n\t\tassert.ok($.iframeTracker.handlersList.length === 1, \"handlersList length OK\");\n\t\tassert.ok($.iframeTracker.handlersList[0] === handler, \"handler registred\");\n\t\tvar eventBindCheck = function(element, event, handler) {\n\t\t\tvar bound = false;\n\t\t\t$.each($._data(element, \"events\")[event], function(key, val) {\n\t\t\t\tif (val.handler === handler) {\n\t\t\t\t\tbound = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn bound;\n\t\t};\n\t\tassert.ok(eventBindCheck(iframe, \"mouseover\", $.iframeTracker.mouseoverListener), \"mouseover handler is bound\");\n\t\tassert.ok(eventBindCheck(iframe, \"mouseout\", $.iframeTracker.mouseoutListener), \"mouseout handler is bound\");\n\t});\n\n\tQUnit.test(\"untrack\", function(assert) {\n\t\tvar iframe = [document.querySelector(\"#qunit-fixture #red_iframe\")];\n\t\t$.iframeTracker.track(iframe, {});\n\t\tassert.ok($.iframeTracker.handlersList.length === 1, \"ready\");\n\t\t$.iframeTracker.untrack(iframe);\n\t\tassert.ok($.iframeTracker.handlersList.length === 0, \"handlersList is empty\");\n\t});\n\n\tQUnit.test(\"Chaining\", function(assert) {\n\t\tvar tracker = $(\"#qunit-fixture #red_iframe\").iframeTracker(false);\n\t\tassert.ok(tracker instanceof $, \"fn is chainable\");\n\t});\n\n\tQUnit.test(\"fn invalid argument\", function(assert) {\n\t\tassert.throws(\n\t\t\tfunction() {\n\t\t\t\t$(\"#qunit-fixture #red_iframe\").iframeTracker(\"Bad motherfucker\");\n\t\t\t},\n\t\t\t/Wrong handler type/,\n\t\t\t\"Argument check success\"\n\t\t);\n\t});\n\n\tQUnit.test(\"Handler building\", function(assert) {\n\t\tvar blurCallback = function(event) {};\n\t\t$(\"#qunit-fixture #red_iframe\").iframeTracker(blurCallback);\n\t\tassert.ok(typeof $.iframeTracker.handlersList[0] == \"object\", \"Handler build success\");\n\t\tassert.ok($.iframeTracker.handlersList[0].blurCallback ===  blurCallback, \"Blur callback bound\");\n\t});\n\n\tQUnit.test(\"Workflow : over, blur\", function(assert) {\n\t\t$(\"#qunit-fixture iframe\").iframeTracker(stepHandlerFactory(assert));\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseover\");\n\t\t$(window).trigger(\"blur\");\n\t\tassert.verifySteps([\"over red_iframe\", \"blur red_iframe\"]);\n\t});\n\n\tQUnit.test(\"Workflow : over, out, blur\", function(assert) {\n\t\t$(\"#qunit-fixture iframe\").iframeTracker(stepHandlerFactory(assert));\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseover\");\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseout\");\n\t\t$(window).trigger(\"blur\");\n\t\tassert.verifySteps([\"over red_iframe\", \"out red_iframe\"]);\n\t});\n\n\tQUnit.test(\"Workflow : over, blur, untrack & again\", function(assert) {\n\t\t$(\"#qunit-fixture iframe\").iframeTracker(stepHandlerFactory(assert));\n\n\t\t$(\"#qunit-fixture #blue_iframe\").trigger(\"mouseover\");\n\t\t$(window).trigger(\"blur\");\n\t\t$(\"#qunit-fixture #blue_iframe\").trigger(\"mouseout\");\n\t\t$(document).trigger(\"mousemove\");\n\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseover\");\n\t\t$(window).trigger(\"blur\");\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseout\");\n\t\t$(document).trigger(\"mousemove\");\n\n\t\t$(\"#qunit-fixture #red_iframe\").iframeTracker(false);\n\t\t$(window).trigger(\"blur\");\n\n\t\tassert.verifySteps([\n\t\t\t\"over blue_iframe\",\n\t\t\t\"blur blue_iframe\",\n\t\t\t\"out blue_iframe\",\n\t\t\t\"over red_iframe\",\n\t\t\t\"blur red_iframe\",\n\t\t\t\"out red_iframe\"\n\t\t]);\n\t});\n\n\tQUnit.test(\"Workflow : from untracked iframe to tracked iframe\", function(assert) {\n\t\tvar clicked = false;\n\t\t$(\"#qunit-fixture #red_iframe\").iframeTracker(function(event) {\n\t\t\tclicked = true;\n\t\t});\n\t\t$(\"#qunit-fixture #blue_iframe\").focus();\n\t\tassert.ok(document.activeElement === document.querySelector(\"#qunit-fixture #blue_iframe\"), \"Focus on untracked iframe\");\n\t\t$(\"#qunit-fixture #blue_iframe\").trigger(\"mouseout\");\n\t\t$(document).trigger(\"mousemove\");\n\t\t$(\"#qunit-fixture #red_iframe\").trigger(\"mouseover\");\n\t\tassert.ok(document.activeElement === $.iframeTracker.focusRetriever[0], \"Focus retrieved (element)\");\n\t\tassert.ok($.iframeTracker.focusRetrieved === true, \"Focus retrieved (flag)\");\n\t\tassert.ok(clicked === false, \"Not yet clicked\");\n\t\t$(\"#qunit-fixture #red_iframe\").focus();\n\t\tassert.ok(clicked === true, \"Clicked\");\n\t\tassert.ok(document.activeElement === document.querySelector(\"#qunit-fixture #red_iframe\"), \"Focus on tracked iframe\");\n\t});\n})(jQuery);\n"
  }
]