PDA

View Full Version : Flex Level Drop Down Menu fails to pass XHTML validation



hanji
02-12-2010, 07:20 AM
1) Script Title: Flex Level Drop Down Menu (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/flexdropdown.htm

3) Describe problem: does not pass XHTML validation

I love this navigation. Works great, looks great.. and it’s simple. I have one problem.. and I’m hoping that you can help.. it doesn’t pass XHTML validation. It’s complaining about the attribute ‘data-flexmenu’. I tried to add that to the DTD, but that introduced additional problems, any plans to remove the attribute and just use ‘data-flexmenu’ as a class value instead?

When I try to validate this page, I see the following error returned:


Line 41, Column 63: Attribute "data-flexmenu" is not a valid attribute

…tion/page.main.htm" data-flexmenu="page">Page</a>&nbsp;&nbsp;|&nbsp;&nb

I tried defining the data-flexmenu in the dtd


<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
<!ATTLIST a data-flexmenu CDATA #IMPLIED>
]>

This passes validation, but I was receiving the dreaded ]> in my output, as well as additional problems with my stylesheet.

Any help is greatly appreciated.
hanji

hanji
02-12-2010, 03:26 PM
For now, my solution was to create my own DTD and include this attribute in the a element.


<!--================== The Anchor Element ================================-->

<!-- content is %Inline; except that anchors shouldn't be nested -->

<!ELEMENT a %a.content;>
<!ATTLIST a
%attrs;
%focus;
charset %Charset; #IMPLIED
type %ContentType; #IMPLIED
name NMTOKEN #IMPLIED
data-flexmenu CDATA #IMPLIED
href %URI; #IMPLIED
hreflang %LanguageCode; #IMPLIED
rel %LinkTypes; #IMPLIED
rev %LinkTypes; #IMPLIED
shape %Shape; "rect"
coords %Coords; #IMPLIED
target %FrameTarget; #IMPLIED
>


Not ideal, but gets past validation and doesn't affect my page/css, etc.

hanji

ddadmin
02-12-2010, 10:12 PM
The "data" attribute (http://www.javascriptkit.com/dhtmltutors/customattributes.shtml) is a new attribute supported/ standardized in HTML5. If you specify a HTML5 doctype at the top of your page, it should then pass:


<!DOCTYPE HTML>