XHTML 1.0 Strict SPAN element

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
So I'm building a site for someone and one page needs to have a very basic image gallery. Rather than worry about server-side scripting or AJAX or anything like that, I've just decided to do a simple javascript to flop the images.

I go to validate the page after it's finished and works in both IE7 and FireFox, and the validator comes back and says there's no "onMouseOver" attribute for the SPAN element. Yet, everywhere I look lists it as a valid attribute.

What gives? How would one accomplish what I'm trying to do while maintaining XHTML 1.0 Strict guidelines? Do I need to write the event hook entirely in javascript? That seems like a pain in the ass to me.

I'm inclined to not bother with validation on this one page if it's going to be this much hassle.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Make your onMouseOver all lowercase, IIRC XHTML Strict is quirky about the case of the tags.
 

Woosta

Platinum Member
Mar 23, 2008
2,978
0
71
Originally posted by: Crusty
Make your onMouseOver all lowercase, IIRC XHTML Strict is quirky about the case of the tags.

You shouldn't be advocating inline event handlers in the first place, but instead the seperation of markup, presentation and behavior ( js/mouseover event is the latter ). OP - I suggest you go google up unobtrusive dom scripting and learn to live without inline event handlers.

And also, if you're not sending your document as an xml content-type/mime-type then don't even bother using xhtml, because if its sent as text/html as in 99.9% of cases on the web, its really just treated as piss poor broken tag soup by the user agent, and not handled as real xhtml ( which is not supported by IE at this time ). HTML 4.01 Strict ftw.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Woosta
Originally posted by: Crusty
Make your onMouseOver all lowercase, IIRC XHTML Strict is quirky about the case of the tags.

You shouldn't be advocating inline event handlers in the first place, but instead the seperation of markup, presentation and behavior ( js/mouseover event is the latter ). OP - I suggest you go google up unobtrusive dom scripting and learn to live without inline event handlers.

And also, if you're not sending your document as an xml content-type/mime-type then don't even bother using xhtml, because if its sent as text/html as in 99.9% of cases on the web, its really just treated as piss poor broken tag soup by the user agent, and not handled as real xhtml ( which is not supported by IE at this time ). HTML 4.01 Strict ftw.

Where did I advocate the use of inline event handlers?
 

Woosta

Platinum Member
Mar 23, 2008
2,978
0
71
Originally posted by: Crusty
Originally posted by: Woosta
Originally posted by: Crusty
Make your onMouseOver all lowercase, IIRC XHTML Strict is quirky about the case of the tags.

You shouldn't be advocating inline event handlers in the first place, but instead the seperation of markup, presentation and behavior ( js/mouseover event is the latter ). OP - I suggest you go google up unobtrusive dom scripting and learn to live without inline event handlers.

And also, if you're not sending your document as an xml content-type/mime-type then don't even bother using xhtml, because if its sent as text/html as in 99.9% of cases on the web, its really just treated as piss poor broken tag soup by the user agent, and not handled as real xhtml ( which is not supported by IE at this time ). HTML 4.01 Strict ftw.

Where did I advocate the use of inline event handlers?

Well you shouldn't tell him to lowercase it, because firstly it's wrong to even use such an attribute and by not telling him otherwise you're just supporting deprecated markup by not advocating the right way.
 

Woosta

Platinum Member
Mar 23, 2008
2,978
0
71
Bloated and overkill for a simple mouseover event handler, though it's nice if you have lots of functionality on your site.
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
First off, get off your high horse and go prostelatize somewhere else.

My goals with this page are cross-browser functionality and search-engine friendliness. If my code validates against the spec and works in both major browsers, what does it matter how I got it there?

Second, I'm not a moron. I understand the logic behind separating display elements and functional elements. This is why the only thing the onmouseover attribute does is call a function. Effectively, the exact same thing that would happen if I created the event handler in javascript...only much, much simpler AND supported in ALL browsers, without having to include different implementations for different browsers.

So please, tell me again that scripting the same thing two different ways is better than scripting it once in a way that conforms with spec and is supported in all browsers.

I work in the real world. I don't have time to reinvent the wheel just because some self-righteous prick somewhere decided they wanted to classify something that works perfectly well in all cases as "unconventional".
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Woosta
Originally posted by: Crusty
Originally posted by: Woosta
Originally posted by: Crusty
Make your onMouseOver all lowercase, IIRC XHTML Strict is quirky about the case of the tags.

You shouldn't be advocating inline event handlers in the first place, but instead the seperation of markup, presentation and behavior ( js/mouseover event is the latter ). OP - I suggest you go google up unobtrusive dom scripting and learn to live without inline event handlers.

And also, if you're not sending your document as an xml content-type/mime-type then don't even bother using xhtml, because if its sent as text/html as in 99.9% of cases on the web, its really just treated as piss poor broken tag soup by the user agent, and not handled as real xhtml ( which is not supported by IE at this time ). HTML 4.01 Strict ftw.

Where did I advocate the use of inline event handlers?

Well you shouldn't tell him to lowercase it, because firstly it's wrong to even use such an attribute and by not telling him otherwise you're just supporting deprecated markup by not advocating the right way.

Oh get over yourself, he asked a simple question about why his code doesn't validate. I provided an answer, if you want to preach about 'bad practices' go write a blog.