Created
June 10, 2015 17:43
-
-
Save codequistador/c66c263da21f6fe4aee2 to your computer and use it in GitHub Desktop.
R and TM get Sup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Ensure all registered marks and trademarks have sup tags! | |
| $('body *').contents().filter(function () { | |
| if (((this.nodeType == 3) && this.nodeValue.match(/(®|™)/))) { | |
| if (!$(this).parent().is('sup')) { | |
| var newText = []; | |
| $.each(this.nodeValue.split(" "), function (k, text) { | |
| newText.push(text.replace(/(®|™)/, "<sup>$1</sup>")); | |
| }); | |
| if (newText.length > 0) { | |
| var html = $(this).parent().html().replace(this.nodeValue, newText.join(" ")); | |
| $(this).parent().html(html); | |
| } | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment