Replace Text On Webpages

By JoeSimmons Last update Apr 13, 2010 — Installed 6,658 times.

Bug in isOkTag()?

in
Subscribe to Bug in isOkTag()? 1 post, 1 voice

almitydave User
ChromeWindows

Hi, good script.

I noticed that text in p tags wasn't getting replaced, and discovered that the function isOkTag() will find p in the list of prohibited tags at index 0, since ",pre" starts with ",p". This can be fixed by changing the line:
return (",pre,blockquote,code,input,button,textarea".indexOf(","+tag) == -1);
to:
return (",pre,blockquote,code,input,button,textarea,".indexOf(","+tag+",") == -1);
which will only match whole tag names.

Now Wikipedia and other sites that I've checked so far work as expected.
Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel