felipeNascimento.org(true);

Making the web a better place to live

Browsing Posts in Learned Stuff / Tips

PHPSCConf

No comments

O evento, ocorrido em Joinvile (http://phpsc.com.br/), nos dias 27 e 28 deste mês foi ótimo. Os organizadores mostram cada ano mais maturidade, as palestras conseguiram ser tanto focadas na parte mais técnica quanto focadas no mercado, metodologias, etc. A platéia também parecia bem interessada, apesar de terem ficado bastante distribuídos entre demais cursos que aconteciam durante o evento.
É a comunidade PHP mostrando o poder que tem no Brasil e na reagião Sul.

A palestra sobre o theWebMind foi bem divertida e positiva, vários demonstraram interesse e acredito que conseguiremos atingir mais pessoal capacitado e interessado em colaborar, o que é sempre muito importante para o projeto.

Parabéns aos envolvidos e palestrantes. Obrigado a todos e até o ano que vem!

Slides da palestra: http://tinyurl.com/259zbre

Hi, yesterday I had to fight against this problem, which is not very touched out there.
In the beginning, people from jQuery thought it was a jQuery bug, but searching a bit more I could find out the root of this problem.

What is it?
When running your javascript in Internet Explorer 6, or 7 or 8 in compatible mode, if you create dynamically an iframe, for example, and set it a name attribute, Internet Explorer will reaplace it by an submitName attribute. This attribute cannot be found with .getAttribute(’submitName’), but that is the problem, neither can be with .getAttribute(’name’)!

How to see it happening? Try this:

var ifr= document.createElement('iframe');
ifr.setAttribute('name', 'iFrameOne');
document.body.appendChild(ifr);
alert(ifr.getAttribute('name'));
// you can also see it through the "developer tool" in the IE tools menu

The main problem is that … when you have something like a link or a form targeting this iframe, you loose it! The same happens with inputs with name, which are dynamically created.

How to fix it without ask your users to migrate to a real browser? I did this and it worked:

var ifrDiv= document.createElement('div');
ifrDiv.innerHTML= "<iframe name='iFrameOne' ></iframe>";
document.body.appendChild(ifrDiv);

Now, why does it happen?!
I had the chance to search for this and found in the Microsoft’s webpage something about this old, known bug in Internet Explorer, with names on dynamic elements. Due to “fix” this, instead of fixing, then “provided” this workarounded attribute. When you try to deal with the name attribute, it applies like an alias, redirecting it to the Microsoft’s Internet Explorer imaginary submitName attribute. But with this, you cant access a form that has a name, like this:

document.forms['dynamicFormName'];

because the DOM hasn’t rendered that form with the name you asked for.

I hope it can help you, if you get stuck with this some day.

Hi there.
Well, this is a question I see a lot of people doing! Then, I decided to post about it.
We have got, in Javascript, when dealing with the DOM API, the history element, with which we can move forward or backward trough the navigation historic, plus specify with the method go page or step we want to go, by informing the < 0 value to past, or > 0 to the possible forward pages. So, we can do this, too:


history.go(0);

This will simply reload the page. Of course you can use it with iframes, using the parent, top, self or name to work with their relation.
Other alternative is using the reload method provided by the location, just like this:


self.location.reload();

Now, a different alternative, and also a way to move from one page to another, is using the href property, also from location.


self.location.href= self.location.href;

This code will reload the same page, but could be any other address to be loaded.

Add an animated bird to announce your tweets, in your webpage or blog.
With Tweety (maybe a temporary name), you can specify your twitter account and then get back a small script to put this animation into your website. Only have to copy and paste it wherever you want. It will random one of your 4 last posts on twitter and show it for 1 minute, randomising it again, then.
In my home page there is an example of it working. Though, you can see here, it working again:

If you have ideas to have it better, or found any bug, or if you can draw a better bird, talk to me ;)

Testing Firefox 4 Beta 1

No comments

Well, Firefox 4b1 has just been lauched and we had the chance to test it and use it for quite a while.
The first thing I did was to test it running some crazy heacy scripts, like http://bit.ly/DvVL and http://bit.ly/ppahL. I gotta say, it was impressive. Those scripts simply couldn’t run at Firefox in the previous version, now, they run just as chrome does. It made me happy about this release.
Then, testing it with acid3, it reached the 97 points. I think it could be better, specially because either chrome, safari and opera reached 100. Though, those 3 missing points are related to the SVG Fonts, which were deliberately not implemented, using WOFF instead, as you can see in the Mozilla’s developers blog.
At html5test.com, firefox 4 had 189 points. Chrome was the only better, with 197. IE had 27, as I thought.
When testing selectors and CSS3 here, I notice there are only a few properties/methods that only chrome offers more than Firefox.
The problem I have to point by now is that no one single add-on worked on this version. Even mine didn’t work ok and I’ll have to change some details at them.

About the layout, I’m personaly happy they didn’t take off the status bar, as many people had asked for(if I wanted a browser without a status bar, I’d rather use Chrome). Still, if you use windows vista or Seven, you may have some new advances, like the special button at the top of the window, removing the usual menubar, adding it to the title bar.

I do think there are many things to get better or to be increased in Firefox 4 before its release candidate. It promises a lot and I’m really glad to see the browsers walking toward the same point. The future developers will be happier and faster :)