Last post Nov 17, 2007 12:35 PM by G_McPherran
Nov 14, 2007 02:52 AM|G_McPherran|LINK
The "CSS Friendly" code generates links with class=AspNet-Menu-Link. I cannot find this CSS class defined anywhere in the source files. (Some classes such as hover are apparently generated dynamically but it didn't appear that the AspNet-Menu-Link class
is one of the dynamically-generated ones.)
Where is the class AspNet-Menu-Link defined?
CSS Friendly Control Adapters Menu
menu css friendly adapters
Nov 14, 2007 05:06 AM|bpw|LINK
It isn’t defined in my stylesheets. It is applied to links in MenuAdapter.vb (or cs) along with other classes that might not be defined:
AspNet-Menu-NonLink (I’m a span – no <a>)
AspNet-Menu-Selected (I was clicked last - current location)
AspNet-Menu-ChildSelected (one of my children, grandchildren, etc, has been selected)
AspNet-Menu-ParentSelected (my parent, grandparent, etc, has been selected)
AspNet-Menu-WithChildren (I have children, grandchildren, etc)
AspNet-Menu-Leaf (I don’t have any children)
I guess these classes are there to give us more flexibility.
Nov 14, 2007 11:56 PM|G_McPherran|LINK
So I infer that it is not an error if a class attribute is specified but the class is not defined. Is this part of the CSS/browser spec or just one of those de-facto features?
Nov 15, 2007 04:49 AM|bpw|LINK
No, it isn’t an error. One or more of these classes is applied to the node regardless of whether the class is defined in the stylesheet.
In fact, I’ve modified my ‘MenuAdapter.vb’ to exclude some of these classes, as I found it impossible to use the ‘ChildSelected’ and ‘Selected’ classes without having inheritance problems (there’s probably a way of doing this, but I couldn’t find it). I
now only use the ‘ChildSelected’ and ‘Selected’ classes (which I apply to the link or span rather then the list item) and the ‘Leaf’ class. This suits my specific requirements.
Nov 15, 2007 09:31 PM|G_McPherran|LINK
My main question is: does CSS allow using class="StyleXYZ" even if StyleXYZ is not defined? (I'm just not sure if regarding "error" you were addressing the Control Adapters' use of these styles or were addressing whether using an undefined class is allowed
Nov 16, 2007 01:34 PM|bpw|LINK
If you add class=”StyleXYZ” to a control and StyleXYZ has not been defined anywhere, nothing will happen – no errors will occur.
Nov 17, 2007 12:35 PM|G_McPherran|LINK
Thanks for responding to my questions.