HOME | DD

Hormesis — Browser Wars: Fieldsets

Published: 2011-05-17 07:01:20 +0000 UTC; Views: 409; Favourites: 2; Downloads: 6
Redirect to original
Description BrowserWars #2. This was retarded.

For those wondering: when you call up a form.elements[] array in Javascript, IE, Opera, FF and most others will give you an array with fieldset and all inputs. Chrome/Safari/Epiphany (webkit) will not include the fieldset. So before you start counting your way through your inputs, first you have to weed out fieldsets just to get everyone on the same page. Only thing that always works is:

var submit = inputs[inputs.length-1];
(after var inputs = document.forms['theForm'].elements; of course)

Blargle.
I'm starting to think most people don't know of this because they just use jQueeeery for everything. Maybe would save me some hair.
Related content
Comments: 4

timohuovinen [2012-09-09 20:30:13 +0000 UTC]

I use jQuery for everything DOM related, it is a decorator for the messy and broken DOM interpretation
but for high performance things I switch back to basic javascript, if there is any need for it, saves me a lot of hair.

👍: 0 ⏩: 0

Hormesis [2011-05-17 07:07:57 +0000 UTC]

Fixed decription

👍: 0 ⏩: 0

PeterK [2011-05-17 07:06:29 +0000 UTC]

Haha ROFL!

👍: 0 ⏩: 0

MrZepto [2011-05-17 07:02:44 +0000 UTC]

I totally understand..most of it XD Nice work!! Love that last facial expression

👍: 0 ⏩: 0