Last active
October 21, 2020 17:57
-
-
Save JMayfield/0c77650392cc09aa3b5d6f0ecf5783d8 to your computer and use it in GitHub Desktop.
Wrap Registered Trademark Symbols in Superscript
This file contains 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
var regexp = /[\xAE]/; | |
$('body :not(script,sup)').contents().filter(function() { | |
return this.nodeType === 3 && (regexp.test(this.nodeValue)); | |
}).replaceWith(function() { | |
return this.nodeValue.replace(regexp, '<sup>$&</sup>'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment