A small breaking change in IE8 causing big pain in the ass: the default type of button element

The default type of button element is 'button' before IE8 (default means when you do not explicitly specify a value for the type property). However, in IE8, Microsoft decided to comply the w3c standard, thus the default type of button is changed to 'submit'. This costed me so much time that I started to hate w3 in a certain way.

So you may ask, why?

If the default button type is 'button',  the old Microsoft way of doing things, which is also what everybody will naturally think it should be, then clicking a button will only raise a click event, but if it is 'submit', it will cause the form in which the button resides to submit the form to server. This is big difference.

If this breaking change only occurred in a different situation, it would not have costed me so much time. But, it emerged on a very complex page. The page lists the pictures the user has uploaded so far, but the pictures are all hosted from a different domain than the page's own domain. The page also lets user to upload new pictures and edit existing pictures' properties, but all to that resource server. So it is a very complex cross frame, cross domain page. When the breaking change was causing bug in the page,  the page's complexity lead me to the wrong dirrection when I was trying to resolve this bug. Thus it costed me a lot of time.

So your guys watch out this breaking change of the default type of button element in IE8. Note chrome and firefox all have similar behavior as IE8.


The discrepancy in browsers is a big pain for every web developers. So people like standard, but in the case of web developement world, there are two standards, the de facto standard, which is Microsoft's internet explorer, and the official standard, the w3c standard. So you have two standards to deal with. Now that for each web page, I have 5 browsers to have it tested with, the IE6,I E7, IE8, and chrome, firefox 4. I set up virtual machine for this.

Btw there is a new virtual machine of IE9/Win7 from Microsoft to download.

原文地址:https://www.cnblogs.com/kakrat/p/2071921.html