tags:

views:

21

answers:

1

I have an ASP.NET MVC 2 web site, the site.master declares

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;

but in the code I have

<td class='count-col' data-object-id='<%= Model.ObjectId %>'>
  1. Am I correct that attribute data-object-id is not valid in the declared doctype (XHTML)?
  2. What are the downshots of having that violation?
  3. What is a good solution for this situation? Should I change DOCTYPE (what would be drawbacks)? Or should I come up with a different way to specify object-id on the element?

Note: object-id is used by a javascript function that shows a popup on <td> hover.

+1  A: 

It could give "unexpected" behaviour in older browsers, yet most browsers render it anyways. That, and your code won't validate, though that should in the real world not really stop you.

m1ke