{"versions":{"0.1.3":{"name":"current-executing-script","title":"currentExecutingScript","version":"0.1.3","description":"Get the currently executing script, regardless of its source/trigger/synchronicity. Similar to HTML5's `document.currentScript` but arguably much more useful!","keywords":["browser","document","currentScript","currentExecutingScript","html","dom","html5","not-spec-compliant"],"main":"./dist/currentExecutingScript.js","homepage":"https://github.com/JamesMGreene/currentExecutingScript","licenses":[{"type":"MIT","url":"https://github.com/JamesMGreene/currentExecutingScript/blob/master/LICENSE"}],"author":{"name":"James M. Greene","email":"james.m.greene@gmail.com","url":"http://greene.io/"},"repository":{"type":"git","url":"git+https://github.com/JamesMGreene/currentExecutingScript.git"},"bugs":{"url":"https://github.com/JamesMGreene/currentExecutingScript/issues"},"scripts":{"test":"grunt travis --force --verbose"},"devDependencies":{"grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-jshint":"^0.11.3","grunt-contrib-uglify":"^0.11.0","grunt-karma":"0.11.x","karma":"0.12.x","karma-chrome-launcher":"^0.2.2","karma-firefox-launcher":"^0.1.7","karma-phantomjs-launcher":"^0.2.1","karma-qunit":"^0.1.8","karma-safari-launcher":"^0.1.1","karma-sauce-launcher":"^0.3.0","karma-spec-reporter":"0.0.23","local-version":"^0.2.2","phantomjs":"^1.9.19","qunitjs":"^1.20.0","semver":"^5.1.0"},"gitHead":"14c1d2da4c0a143a68becb50d7cdce34d82a8e7c","_id":"current-executing-script@0.1.3","_shasum":"b798dfc58b5cf8b00fb04c1df0ac2663967e2c70","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"anonymous","email":"james.m.greene@gmail.com"},"maintainers":[{"name":"anonymous","email":"james.m.greene@gmail.com"}],"dist":{"shasum":"b798dfc58b5cf8b00fb04c1df0ac2663967e2c70","size":18175,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/current-executing-script/-/current-executing-script-0.1.3.tgz","integrity":"sha512-j1nG9I8jaHWniUxJGYkjF3jS98a/mU8tC971XJdrLXKRKSnwNgztd7pHElwdcfJwbQHvJeC9HhUz9NFE8or92g=="},"directories":{},"publish_time":1451179924519,"_hasShrinkwrap":false,"_cnpm_publish_time":1451179924519,"_cnpmcore_publish_time":"2021-12-17T11:53:28.696Z","contributors":[]},"0.1.2":{"name":"current-executing-script","title":"currentExecutingScript","version":"0.1.2","description":"Get the currently executing script, regardless of its source/trigger/synchronicity. Similar to HTML5's `document.currentScript` but arguably much more useful!","keywords":["browser","document","currentScript","currentExecutingScript","html","dom","html5","not-spec-compliant"],"main":"./dist/currentExecutingScript.js","homepage":"https://github.com/JamesMGreene/currentExecutingScript","licenses":[{"type":"MIT","url":"https://github.com/JamesMGreene/currentExecutingScript/blob/master/LICENSE"}],"author":{"name":"James M. Greene","email":"james.m.greene@gmail.com","url":"http://greene.io/"},"repository":{"type":"git","url":"https://github.com/JamesMGreene/currentExecutingScript.git"},"bugs":{"url":"https://github.com/JamesMGreene/currentExecutingScript/issues"},"scripts":{"test":"grunt travis --force --verbose"},"devDependencies":{"grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-jshint":"^0.11.0","grunt-contrib-uglify":"^0.7.0","grunt-karma":"^0.10.1","karma":"^0.12.31","karma-chrome-launcher":"^0.1.7","karma-firefox-launcher":"^0.1.4","karma-phantomjs-launcher":"^0.1.4","karma-qunit":"^0.1.4","karma-safari-launcher":"^0.1.1","karma-sauce-launcher":"^0.2.10","karma-spec-reporter":"0.0.16","qunitjs":"^1.17.1"},"gitHead":"d64914baca8aa24a3bcf69543fea7c199c76fabe","_id":"current-executing-script@0.1.2","_shasum":"0884dc019c0394632cbe9cac6a2d0eee4fbead68","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"anonymous","email":"james.m.greene@gmail.com"},"maintainers":[{"name":"anonymous","email":"james.m.greene@gmail.com"}],"dist":{"shasum":"0884dc019c0394632cbe9cac6a2d0eee4fbead68","size":17230,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/current-executing-script/-/current-executing-script-0.1.2.tgz","integrity":"sha512-7OwTOBHb3q7VDtJfY+KJEwmL1e/JrtLvCGCYEuaQkmwF9qAvt1X+5+ro/5gU1JiEUSzAf5mMN6CmE37LbV51CA=="},"directories":{},"publish_time":1426771961145,"_hasShrinkwrap":false,"_cnpm_publish_time":1426771961145,"_cnpmcore_publish_time":"2021-12-17T11:53:28.929Z","contributors":[]},"0.1.1":{"name":"current-executing-script","title":"currentExecutingScript","version":"0.1.1","description":"Get the currently executing script, regardless of its source/trigger/synchronicity. Similar to HTML5's `document.currentScript` but arguably much more useful!","keywords":["browser","document","currentScript","currentExecutingScript","html","dom","html5","not-spec-compliant"],"main":"./dist/currentExecutingScript.js","homepage":"https://github.com/JamesMGreene/currentExecutingScript","licenses":[{"type":"MIT","url":"https://github.com/JamesMGreene/currentExecutingScript/blob/master/LICENSE"}],"author":{"name":"James M. Greene","email":"james.m.greene@gmail.com","url":"http://greene.io/"},"repository":{"type":"git","url":"https://github.com/JamesMGreene/currentExecutingScript.git"},"bugs":{"url":"https://github.com/JamesMGreene/currentExecutingScript/issues"},"scripts":{"test":"grunt travis --force --verbose"},"devDependencies":{"grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-jshint":"^0.11.0","grunt-contrib-uglify":"^0.7.0","grunt-karma":"^0.10.1","karma":"^0.12.31","karma-chrome-launcher":"^0.1.7","karma-firefox-launcher":"^0.1.4","karma-phantomjs-launcher":"^0.1.4","karma-qunit":"^0.1.4","karma-safari-launcher":"^0.1.1","karma-sauce-launcher":"^0.2.10","karma-spec-reporter":"0.0.16","qunitjs":"^1.17.1"},"gitHead":"7d599560b186073d39a1c17bdb9df728599467f8","_id":"current-executing-script@0.1.1","_shasum":"0abed5cde623d507076a2cf0bbbb4e46209e9288","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"anonymous","email":"james.m.greene@gmail.com"},"maintainers":[{"name":"anonymous","email":"james.m.greene@gmail.com"}],"dist":{"shasum":"0abed5cde623d507076a2cf0bbbb4e46209e9288","size":14987,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/current-executing-script/-/current-executing-script-0.1.1.tgz","integrity":"sha512-XdMxaCHFLC+dgMzq4596j+cs2jpKBQPpzyTj7waA+10ky+spJCFwKIjCUhE4YHpz6XBxmk6qL8663sZyJletIw=="},"directories":{},"publish_time":1426719849457,"_hasShrinkwrap":false,"_cnpm_publish_time":1426719849457,"_cnpmcore_publish_time":"2021-12-17T11:53:29.134Z","contributors":[]},"0.1.0":{"name":"current-executing-script","title":"currentExecutingScript","version":"0.1.0","description":"Get the currently executing script, regardless of its source/trigger/synchronicity. Similar to HTML5's `document.currentScript` but arguably much more useful!","keywords":["browser","document","currentScript","currentExecutingScript","html","dom","html5","not-spec-compliant"],"main":"./dist/currentExecutingScript.js","homepage":"https://github.com/JamesMGreene/currentExecutingScript","licenses":[{"type":"MIT","url":"https://github.com/JamesMGreene/currentExecutingScript/blob/master/LICENSE"}],"author":{"name":"James M. Greene","email":"james.m.greene@gmail.com","url":"http://greene.io/"},"repository":{"type":"git","url":"https://github.com/JamesMGreene/currentExecutingScript.git"},"bugs":{"url":"https://github.com/JamesMGreene/currentExecutingScript/issues"},"scripts":{"test":"grunt travis --force --verbose"},"devDependencies":{"grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-jshint":"^0.11.0","grunt-contrib-uglify":"^0.7.0","grunt-karma":"^0.10.1","karma":"^0.12.31","karma-chrome-launcher":"^0.1.7","karma-firefox-launcher":"^0.1.4","karma-phantomjs-launcher":"^0.1.4","karma-qunit":"^0.1.4","karma-safari-launcher":"^0.1.1","karma-sauce-launcher":"^0.2.10","karma-spec-reporter":"0.0.16","qunitjs":"^1.17.1"},"gitHead":"eefdfffc03b733f66c1b48d3988be94412cfd5e4","_id":"current-executing-script@0.1.0","_shasum":"e601e15e51a7e511d6c565b2113f1ca61bcdfd76","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"anonymous","email":"james.m.greene@gmail.com"},"maintainers":[{"name":"anonymous","email":"james.m.greene@gmail.com"}],"dist":{"shasum":"e601e15e51a7e511d6c565b2113f1ca61bcdfd76","size":14977,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/current-executing-script/-/current-executing-script-0.1.0.tgz","integrity":"sha512-j0XqirGva9ep0sSknVTWQohf5IBYuaTESYRijR05P1rrzhCobJgmWPHktz+etwPuR5frfIYfzTCapeArPji9qA=="},"directories":{},"publish_time":1426712175292,"_hasShrinkwrap":false,"_cnpm_publish_time":1426712175292,"_cnpmcore_publish_time":"2021-12-17T11:53:29.343Z","contributors":[]}},"dist-tags":{"latest":"0.1.3"},"name":"current-executing-script","time":{"created":"2022-01-26T21:11:04.810Z","modified":"2023-08-07T16:19:47.646Z","0.1.3":"2015-12-27T01:32:04.519Z","0.1.2":"2015-03-19T13:32:41.145Z","0.1.1":"2015-03-18T23:04:09.457Z","0.1.0":"2015-03-18T20:56:15.292Z"},"readme":"# currentExecutingScript\n[![GitHub Latest Release](https://badge.fury.io/gh/JamesMGreene%2FcurrentExecutingScript.png)](https://github.com/JamesMGreene/currentExecutingScript) [![Build Status](https://secure.travis-ci.org/JamesMGreene/currentExecutingScript.png?branch=master)](https://travis-ci.org/JamesMGreene/currentExecutingScript) [![Sauce Test Status](https://saucelabs.com/buildstatus/JamesMGreene_ces)](https://saucelabs.com/u/JamesMGreene_ces) [![Dependency Status](https://david-dm.org/JamesMGreene/currentExecutingScript.png?theme=shields.io)](https://david-dm.org/JamesMGreene/currentExecutingScript) [![Dev Dependency Status](https://david-dm.org/JamesMGreene/currentExecutingScript/dev-status.png?theme=shields.io)](https://david-dm.org/JamesMGreene/currentExecutingScript#info=devDependencies)\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/JamesMGreene_ces.svg)](https://saucelabs.com/u/JamesMGreene_ces)\n\nGet the currently executing script, regardless of its source/trigger/synchronicity. Similar to HTML5's [`document.currentScript`](http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript) but arguably much more useful!\n\n\n## Overview\n\n### Loose\n\nThis utility comprises a set of behaviors for detecting the currently **executing** script, which does _not_ comply with the HTML spec's concept of `document.currentScript`. However, personally, I find it much more useful!\n\nIt can get the `script` element that was the source of the nearest (deepest) frame in the call stack (so, the currently executing code), regardless of whether or not said source script is being evaluated synchronously for the first time by the browser.\n\nIt also has experimental support for getting the `script` element that was the source of the farthest (most shallow) frame in the call stack, regardless of whether or not said source script is being evaluated synchronously for the first time by the browser.\n\nFinally, it has experimental support for getting the `script` element _or attribute node_ (e.g. `onclick`) responsible for creating the current call stack.\n\n\n### Strict\n\nIf you are only interested in getting the currently **synchronously _evaluating_** script (i.e. like an HTML spec-compliant polyfill for `document.currentScript`), take a look at [JamesMGreene/document.currentScript](https://github.com/JamesMGreene/document.currentScript) instead.\n\n\n## Browser Compatibility\n\n_Forthcoming...._\n\n\n## Installation\n\n### NPM\n\n```shell\nnpm install current-executing-script\n```\n\n### GitHub\n\nAlternatively, you can download/clone its GitHub repo: [JamesMGreene/currentExecutingScript](https://github.com/JamesMGreene/currentExecutingScript)\n\n\n## Usage\n\n### Nearest\n\nTo get the nearest (deepest) script for the current call stack:\n\n```js\nvar scriptEl1 = currentExecutingScript();\nvar scriptEl2 = currentExecutingScript.near();\n```\n\n\n### Farthest\n\n_**EXPERIMENTAL!!!**_\n\nTo get the farthest (most shallow) script for the current call stack:\n\n```js\nvar scriptEl = currentExecutingScript.far();\n```\n\n**IMPORTANT:** Note that the accuracy of this may be limited by the allowed stack depth of each browser. For example, Chrome defaults to collecting a maximum of the 10 nearest frames but [can be configured to collect more](https://code.google.com/p/v8-wiki/wiki/JavaScriptStackTraceApi) (see `Error.stackTraceLimit` and `--stack-trace-limit`). This library will automatically configure it to `Infinity` on your behalf.\n\n\n### Origin\n\n_**EXPERIMENTAL!!!**_\n\nTo get the script _or attribute node_ (e.g. `onclick`) responsible for initiating the current call stack:\n\n```js\nvar scriptElOrAttrNode = currentExecutingScript.origin();\n```\n\nIn most situations, the result of `.origin()` will commonly match the result of `.far()` unless the current call stack was initiated by something other than a `script` element (e.g. an `onclick` attribute node).\n\n**IMPORTANT:** Note that the accuracy of this may be limited by the allowed stack depth of each browser. For example, Chrome defaults to collecting a maximum of the 10 nearest frames but [can be configured to collect more](https://code.google.com/p/v8-wiki/wiki/JavaScriptStackTraceApi) (see `Error.stackTraceLimit` and `--stack-trace-limit`). This library will automatically configure it to `Infinity` on your behalf.\n\n\n## Configuration\n\n### `skipStackDepth`\n\nThe stack depth to skip over when analyzing call stack frames (defaults to `1`, to ensure it skips over its own functions).\n\n\n\n## Errata\n\n - MDN docs for `document.currentScript`: https://developer.mozilla.org/en-US/docs/Web/API/document.currentScript\n - Demo using old Gist: http://jsfiddle.net/JamesMGreene/9DFc9/\n - Original location, old Gist: https://gist.github.com/JamesMGreene/fb4a71e060da6e26511d","users":{}}