Skip to content

Instantly share code, notes, and snippets.

@jed
Forked from 140bytes/LICENSE.txt
Created May 16, 2011 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jed/974036 to your computer and use it in GitHub Desktop.
Save jed/974036 to your computer and use it in GitHub Desktop.
iterate over all script tags on the page that aren't scripts
function(
a, // callback
b, // placeholder for nodeList
c, // placeholder for "script"
d, // placeholder for cursor
e // placeholder for current element
){
for( // for every
b = document // document
.getElementsByTagName( // element that is a
c = "script" // script,
),
d = 0; // starting with the first
e = b[d++]; // and working forward,
) e.src || // if the script has no source
/ipt$/.test(e.type || c) // and doesn't have a type ending in "ipt"
|| a.call( // call the callback
e, // scoped to the current element
e.innerHTML, // with its contents and
e.id // its id.
)
}
function(a,b,c,d,e){for(b=document.getElementsByTagName(c="script"),d=0;e=b[d++];)e.src||/ipt$/.test(e.type||c)||a.call(e,e.innerHTML,e.id)}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "nonscripts",
"keywords": [ "script", "template", "asset", "include" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment