FA View Unchanger

By Mr-E Fox Last update Apr 4, 2009 — Installed 168 times. Daily Installs: 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 2, 1, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1

Add your review

1 review


3 stars
An alternate approach, perhaps? , Dec 25, 2008
Review written by yak - see all my reviews (2)

Why create a new DOM node, copy over attributes and replace the original when you can simply unregister the `onclick` handler and remove the alt/title text?

Granted, if the user has caching enabled the second DOM image would not load it's contents entirely anew from the server but would take it from that cache.
But not everyone has caching enabled, plus, or when you're viewing a submission for the first time (which is 98% of all cases) it would effectively load the image twice.

var img=document.getElementById("submissionImg");
if(img)
{
img.onclick = null;
img.setAttribute('title', '');
}

You also wouldn't need to trap exceptions if you checked whether `submissionImg` node existed or not.

0 comments |