Forum Moderators: open

Message Too Old, No Replies

xhtml1-strict.dtd and firefox. i cant stand.

         

sugar2

8:38 pm on Mar 5, 2007 (gmt 0)

10+ Year Member



Hi folks, my publisher manager just decided to implement the xhtml1-strict.dtd and now many features of my page dont work in firefox....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

instead of the old wich introduced this line


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

okay, the thing is that some of my javascript tweaks doesn't work such as a div posicioner, so I have a div with html inside and this script below should posicione it at a desired position depending on the page screen width.
check this out, it is jut not working now...


var w = (window.innerWidth/2)-240;
document.write('\n<sty' + 'le>\n');
document.write('#adv-srch {' + 'left:' + w + 'px; top: 168px; visibility:visible; width: 120px; padding: 0px; position: absolute;' + '}');
document.write('</sty' + 'le>\n');

how can I handle the firefox issues with xhtml1-strict.dtd?

thanks in advance

Hi, I just repair the javascript encapsulatting it inside a CDATA tag when displaying in firefox.
Another weirdo and fatal thing is that the new xhtml1-strict.dtd is displaying very different my tables, check this out, and please give me a starting point if you can,
this is how my site looks in xhtml1-strict.dtd page: <url removed> (note is highlighted for better explaining the problem, it is adding top and bottom margins in the images/tables)
and if I save the page to my hard disk, it looks as it should: <url removed>)

thanks in advance

[edited by: encyclo at 2:14 am (utc) on Mar. 6, 2007]
[edit reason] no links to personal sites please, see forum charter [/edit]

JAB Creations

7:25 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Sugar,

XHTML 1.1 is supposed to be served as application/xhtml+xml as XHTML 1.1 is supposed to be served as pure XML. The XHTML 1.1 DTD translates the "HTML" in to XML for you. However when you start adding scripts it can get slightly complicated.

The document.write method doesn't work with pages served as application/xhtml+xml and I commend you for going further then most people would bother with. While the downside is obvious some stuff won't work the upside is you can create your own elements as needed plus a few other things I suppose.

Anyway I hit this problem when I test ran a precompiled JavaScript library.

Replace this...

document.write('<script type="text/javascript" src="file.js"></script>');

With this...

var l=document.createElementNS("http:www.w3.org/1999/xhtml","script");
l.setAttribute("type", "text/javascript1");
l.setAttribute("src", "file.js");
document.getElementsByTagName("head")[0].appendChild(l);

I know it's not exactly your script but yours is a bit complex for me to swallow at this moment in time though I would hope if you've written that script you'd be able to figure it out from here potentially?

Feel free to ask me about any other application/xhtml+xml issues as I'm one of the few (if not only one) enthusiast running around here using it all the time (except in unsupported browsers) though I don't claim to know everything (I forgot most of it, gah!)

- John

tedster

7:55 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Youve not only gone from html to xhtml, and from transitional mark-up to strict, but also from quirks mode to standards mode. I think this thread will at least get you started on this third issue, which can have quite an impact on how your page renders on screen.

Quirks Mode vs. Standards Mode - overview [webmasterworld.com]