SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 46 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"


Although there are considerable benefits of XHTML, there are also some serious downsides.
XHTML should be sent to the browser and identified as such by using the MIME type
application/xhtml+xml. Unfortunately, Internet Explorer (IE) does not support this MIME
type and will try to download the file or pass it off to another application to handle.
XHTML 1.0 can be sent using the MIME type text/html, but browsers will render the page as
ordinary HTML.
When serving as XML, some older DOM objects and methods??”such as innerHTML,
document.images, and document.forms??”might no longer be available in some browsers.
Because of the complexities introduced by trying to develop in XHTML, I recommend
developing with HTML 4.01 Strict (see www.w3.org/TR/REC-html40); in fact, all the examples
in this book use it.
Best of Both Worlds
Just because you??™re using HTML doesn??™t mean that you can??™t stick to some of the better principles
of XHTML. Most notably, make sure that attributes are quoted, keep your tag names
lowercase, and make sure that tags are closed properly. Elements that normally close in
XHTML with a closing slash don??™t do so when written with HTML. For example, elements
such as the image () or the line break (
) are written without the closing slash, but
elements such as list items (
  • ) and paragraphs (

    ) retain the closing tag.
    Maintaining XHTML-style principles keeps your code easier to read, easier to troubleshoot,
    and easier to transition to XHTML if and when browser support progresses to the point
    where it??™s reasonable.


    Pages:
    34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
    Free English grammar and study guid Russian bride druga wojna światowa counter strike 1.6 hotel jelenia góra