Skip to content

Instantly share code, notes, and snippets.

@kyanny
Forked from mala/jquery_patch.pl
Created June 24, 2011 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/1044158 to your computer and use it in GitHub Desktop.
Save kyanny/1044158 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