Created
June 13, 2011 15:13
-
-
Save matijs/1022955 to your computer and use it in GitHub Desktop.
Remove the title attribute when it's the same as the innerText of an anchor
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
// ==UserScript== | |
// @name Title stripper | |
// @author Matijs Brinkhuis | |
// @namespace http://github.com/matijs | |
// @version 0.1 | |
// @description Remove the title attribute when it's the same as the innerText of an anchor | |
// @include http://frontpage.fok.nl/* | |
// ==/UserScript== | |
[].forEach.call(document.querySelectorAll("a[title]"), function(el) { el.innerText === el.title && el.removeAttribute("title"); }); |
I can think of numerous other reasons why you wouldn't want to remove a title
attribute when it's the same as the innerText
:) In fact, I only want this to run on specific sites, and I'm trying to figure out the syntax for that now.
:*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When image replacement is used you probably don’t want to remove the
title
even if it’s the same as theinnerText
.