Re: <link> and <script> tags are removed. Why?

Bjoern Hoehrmann <[email protected]>
Newsgroups gmane.comp.web.html-tidy.user
Message-ID <[email protected]>
* Robin Smidsrød wrote:
>At the moment I have this content:
>
><script type="text/javascript" 
>src="http://xxx/js/tabpane/tabpane.js"></script>
><link type="text/css" rel="stylesheet" 
>href="http://xxx/js/tabpane/tab.winclassic.css" />

This is in <head>

><div class="tab-pane" id="tab-pane-022e4daf-9f2c-4904-afbf-96ee097e7689">
><div class="tab-page">
><span class="tab">Test</span>Dette er artig
></div>
></div>

<div> is not allowed as <head> child, so <body> is implied by the <div>.
Which means this is not in <head> but in <body>.

>show-body-only: y

Since link and script are not in <body>, showing only what is in body
does not show them.

>I want to output XHTML 1.1, but apparently Tidy only support XHTML 1.0. 

The input document must have a XHTML 1.1 document type and the document
must not use non-XHTML 1.1 features, then it'll work. Otherwise use a
XHTML 1.1-only feature which will have similar effects. Note that with
show-body-only you'll not get XHTML 1.1, but some sort of XHTML fragment
without version information.

>And just in case, I'll be using this in an AJAX application, that's why 
>I don't need the entire header, only the body content.

You still need a single root element for it to be well-formed XML; what
you could do is to ensure that Tidy notices that you don't pass a header
like putting a <body> in front of the string you parse.
-- 
Björn Höhrmann · mailto:[email protected] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.