- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
<first="frist"/>
Admin
"Slugify"? What sort of a word is "slugify"? The word is "slugificationalise". Or "-ize" if you prefer American English, of course.
Admin
I do prefer American English.
'Merica!
Admin
"slugify" is the way Django has always used it.
I do think that using javascript to do a link is stupid, but the data-* stuff is used commonly in frameworks like KnockoutJS to work its behind the scene binding. That I feel is fine, but this is stupid and won't work on browsers with javascript disabled.
Admin
"slugify" is the way Django has always used it.
I do think that using javascript to do a link is stupid, but the data-* stuff is used commonly in frameworks like KnockoutJS to work its behind the scene binding. That I feel is fine, but this is stupid and won't work on browsers with javascript disabled.
Admin
Often this is done so that Google doesn't see these as real links.
In this case, it sucks anyway, but it's totally legit. Fracking SEO.
Admin
Did someone say S-expressions?
Admin
This is garden variety "you're doing it wrong." I don't think it warrants a WTF. Perhaps once upon a time, there was some logic here that got removed?
Admin
Ha, my coworker did one better. He did something like this:
<a id="downloadLink>Download
<a id="dashboardLink>Administrative Dashboard
...
$("a").click(function() { if (this.id == "downloadLink") { location.href = locale.get("downloadPage"); } else if (this.id == "dashboardLink") { location.href = locale.get("dashboardPage"); } });
So not only does he make the WTF in this article, he adds extra layers on top of it, such as using the same function to handle both links, and using language-specific string files to store urls. It's a string, so it can go in there, right?
Addendum 2016-10-26 08:25: Edit: Wow, is that a WTF on this comment form I see? Sanitizing user input by looking for and removing specific user input (closing anchor tags)? For shame!
Admin
Hm... If you hijack a link to do what a link does, and better, it is really a WTF.
Admin
Well duh! On slopes, it doesn't roll away like the old ones!
Admin
It's a Boris word you slughead.
Admin
No, this whole site is the WTF.
Admin
Why is it "legit"? Smells like bullshit. Design your site properly, don't rely on hacks.
Admin
You can design your site however you like, but you can't design PageRank without being Google.
Admin
I'm not into SEO, so could you explain, if they want Google to ignore the link, why not just use rel="nofollow"?
Admin
+1
Or use a robots.txt
Admin
I'm sorry, but this really isn't a WTF. I've done this a few times to change a specific subsection portion of the page without having to go and do a full page repaint (i.e. AJAX refreshing). It may not be 100% elegant, and I would bet that at some point they had the Main menu items be relatively static on the page with the portlet to the active section changing, but they redesigned the entire site and didn't understand the change.
Admin
There are also the other idiot bots that don't listen to robots.txt or to any other flags and just spam the heck out of your product search filters.
Admin
And you do that by setting document.location? Now I'm not a web dev, but I don't think that's the right way to do an AJAX request.
Admin
In response to @Tof:
Somewhere I've read the Google bots do execute ECMAScript, so this seems to be an extra clever way to get downranked for obscuring links.
AND, it is a clever way to tell potential customers, "we don't care for your choice to save your nerves by turning off JavaScript, nya nya nyaaaa!"
In response to @Andrew:
There surely once was a good reason to do something like this, but it went totally bullshit during the process of cargo-culting. (Or do you say, cargo-cultification?)
In response to @Dan Bugglin -> Addendum:
Insanitation of user input seems suitable for an insane site.
(I hope the @ character doesn't have some special meaning for the forum software)
Admin
This is why we can't have nice things (like a navigable site without JavaScript turned on). If your link doesn't have a href, I hate you.
Admin
It may not be 100% elegant, and I would bet that at some point they had the Main menu items be relatively static on the page with the portlet to the active section changing, but they redesigned the entire site and didn't understand the change.
Admin
"change a specific subsection portion of the page without having to go and do a full page repaint" I suppose if you had one or two links on a very large and complex page, downloading a small updated Javascript rather than refreshing the entire page could save on bandwidth. My first thought would be that the complexity of that is not worth saving the trip to the server -- any future programmer trying to maintain the page would have to figure it out -- but it would depend on the details.
Admin
I've seen plenty of programmers do things in an unusual and overly complex way to prove that they're smart enough to understand this overly complex code. Oh yeah, anybody can write a line of code to add two numbers together, but I managed to do it by creating a SOAP interface, sending the numbers in XML, creating a new database on the fly, and building a query that adds the numbers. You say that takes longer than just writing one line to add the numbers? Well that's why I cache the results of previous additions, and before executing the SOAP call check if we already have the result of this addition in cache ...
Admin
I've had the opposite problem a lot with exactly this approach.
If you make a load the main page once web application then things like links and form elements don't make as much sense. Instead buttons are created using a combination of javascript and CSS. In this case, nearly everything is a div. HTML pre-provides some nice things but when using a very custom interface they can get in the way. Even if you can use them, it comes back to bite you later especially as it creates a lot of inconsistency. You end up blacklisting behaviour and appearance in places instead of building it up which tends to be more bug prone. Yet people still will use things like an a tag with href="#" for buttons that are entirely virtual.
Using data- in a templating system is fine for anchors. The WTF here is that there was already a templating system on the backend and that using the data attribute here serves no purpose. If it instead pointed to something else where that would make more sense.
Admin
This is actually a user tracking technique. Usually the javascript handler logs user clicks and time spent on page to some server. Also would force people to turn on javascript and to disable add-blockers, since the site would be non-functional otherwise. We can expect this to become a standard.