Skip to content

Instantly share code, notes, and snippets.

@mala
Created June 21, 2011 14:57
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mala/1038024 to your computer and use it in GitHub Desktop.
Save mala/1038024 to your computer and use it in GitHub Desktop.
quick patch script for jQuery http://bugs.jquery.com/ticket/9521
#!perl
# perl jquery_patch.pl jquery-n.nn.min.js > jquery-n.nn.min.patched.js
$old = join "|", map quotemeta, (
q{/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/},
q{/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/},
q{/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/}
);
$new = q{/^(?:\s*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/};
while(<>){ print "/* patched */\n" if (s/$old/$new/); print $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment