-
-
Save tagawa/1702902 to your computer and use it in GitHub Desktop.
UsurpTCO
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
(function() { | |
if (window.location.hostname === "twitter.com") { | |
var tcoToLinkTitleURL = function(ev) { | |
var target = ev.target, dataURI = target.getAttribute("data-expanded-url"); | |
if (/^https?:\/\/t.co\//.test(target.href) && dataURI) target.href = dataURI; | |
}; | |
document.addEventListener("mousedown", tcoToLinkTitleURL, true); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A classic example of using
FunctionExpression
in programming is Google and GMail source, in particular. GMail guys wrote their code, then had a bunch of errors, so decided to wrap everything -- includingFunctionDeclaration
intry
/catch
-- a classic beginner folly.And so when they did that, they created invalid syntax that worked in the browsers that they thought they were sniffing (browser sniffing is another folly that google has been employing for years). And the funny thing is that when Google wanted to make Closure Compiler (unreliable), is that they got in the predicament of trying to accommodate the invalid syntax that they'd been advised not to use, namely, they had to address the invalid use of
FunctionDeclaration
where onlyStatement
may appear. And the problem with trying to accommodate that invalid syntax is that the behavior of such syntax depends on the implementation. So then they had to try and figure out what was wanted in the code, which of course was impossible to do globally because the desired interpretation was based on purely coincidence of "we did this and then it passed QA". And Google history shows a lot of bugs making it through QA (leading Richard Cornford to question the fact of even if Google does QA. Here's one of Richard's quotes:What this really boils down to is that programming by is unreliable and not forwards compatible.