Re: Re: Using DOM object, how?
| From: | Jasper Bryant-Greene | Date: | Mon, 19 Sep 2005 11:10:40 +0000 |
| Subject: | Re: Re: Using DOM object, how? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222644@lists.php.net to get a copy of this message | ||
Stephen Leaf wrote:
On Monday 19 September 2005 05:27 am, Jasper Bryant-Greene wrote:You can probably add an empty text node to the script tag, or a text node consisting of a single space, or something like that, to make it use the long form. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/Ken Tozier wrote:I would be extremely careful with this.. because sadly PHP's XML generator uses the short form whenever possible. <script /> will *NOT* work in most browsers such as FireFox. <script></script> Will work.I don't see any obvious DOM method for including scripts or css links like "<script language='text/javascript' src='bobo.js'>". Do you have to put them in some other type of node like a processing instruction or a comment?<?php $dom = new DOMDocument('1.0', 'UTF-8'); $script = $dom->createElement('script'); $script->setAttribute('type', 'text/javascript'); $script->setAttribute('src', 'bobo.js'); $dom->appendChild($script); ?>