views:

52

answers:

3

Hi,

The web application im working on has a few custom attributes on HTML elements to store data that is output.

Only happens here and there and so far I haven't noticed anything wrong in how the page is rendered on IE7, IE8, FF 3.5 and Chrome 3.

I'd like to assume everything will be ok but just wanted to check if anyone else has had problems with custom attributes in other browsers.

I understand its not part of standards to add custom attributes but all that matters to me is how the page is output to customers.

A: 

Browsers silently ignore tags or tag attributes they do not understand, so you're good. That said, your HTML won't validate (I know you said you don't care, but still) plus there are other possible ramifications.

See this question for more details.

ChssPly76
A: 

Just be sure to use the same case when referencing the attribute in code. I've had issues in the past with Internet Explorer returning null with getAttribute because my case didn't match what was defined in markup or previously in code.

David Andres
+1  A: 

html5 supports custom attributes with names starting with "data-". Using those yields the smallest chance that anything breaks in the future.

Jeroen