Re: Valid use of <embed> in HTML4

Shane McCarron wrote:
> 
> 
> David Dorward wrote:
>> Good luck with testing in every version of every browser out there.
>>
>> Write code to the standard. Test common browsers to make sure that 
>> their bugs don't break the site. Don't give browsers you aren't 
>> testing something that *shouldn't* work.
>>   
> 
> Amen brother!
> 

I looked at that solution and it looked to me like it exploited a bug in 
browsers, the embed tag should not have been rendered because it is in a 
cdata block.

If you are going to use a non standard tag and still want validating 
content, better options exist. In order of my preference:

1) In this case, declare an html 5 doctype. It's not official yet, but 
I'm moving to it already, currently using <div> wrappers for the html5 
layout tags (IE:
<div class="section"><section><p>content</p></section></div>

That way, it renders how I want, doesn't depend upon html 5 
capabilities, html 5 validates, and provides html 5 semantic hints for 
clients that make use of them (are there any ??)

2) Write a custom DTD that supports your tag

3) Use JavaScript to insert your tag upon on pageload (not ideal but 
better than an ugly hackish looking thing that involves script node and 
cdata block)

Note that using a script node like that may invoke some of the various 
client side XSS filters. To get legitimate stuff past those filters, it 
is best to be as straight forward as you can and not write something 
that looks like it is trying to do something funny.

Received on Friday, 5 February 2010 19:45:23 UTC