First Page    Prev. Page    Next Page    Last PagePage: 1/1

Saturday, May 12 2007

Sat eve

Nadal made it to the finals in Rome after a tough game. Went out to run some errands, really nice weather, great temperature. I realized next week it's the series finale of Gilmore Girls, too bad, I was such a fan . Fresh Direct delivered. Just picked up the mail. Gotta update my DVD database with the latest backups (link to my movie collection on the right hand side)

Rafael Nadal in Rome

beep beep

I guess the smoke detector battery is almost dead, keeps beeping. Will have to replace it tomorrow.

DOM title

Took me a bit to figure this one out. I was trying to upgrade my image download bot so it could handle pages that link to images without extensions. It is unusual, but when it happens, it is very hard to tell the difference between a regular href link to another page and link to an image, they both look the same to the bot, obviously. I quickly realized I could use other link attributes to tell them appart, and so I started checking for the href title and processing it. Most surprisingly, it was returned blank every time. That seemed impossible, as I was looking at the page source and I could see each image title right there, and there were certainly not blank. After banging my head for a while, I started examining all the .js scripts the test webpage I had picked was using. It seemed bizarre that the scripts would be modifying a default attribute like title, but sure enough, they were. One of them was deleting the title attribute and replacing it with a custom one called "tiptitle" - that was the issue! See below the code responsible for this:

..
for (var i = 0; i < anchors.length; i ++)
{
a = anchors[i];
sTitle = a.getAttribute("title");
if(sTitle) {
a.setAttribute("tiptitle", sTitle);
a.removeAttribute("title");
...
...

Aha! And so, my bot handles this scenario just fine now.

First Page    Prev. Page    Next Page    Last PagePage: 1/1