GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ROSE::HTML::SCRIPT (3)

.ds Aq ’

NAME

Rose::HTML::Script - Object representation of the "script" HTML tag.

CONTENTS

SYNOPSIS



    $script = Rose::HTML::Script->new(src => /main.js);

    print $script->html;

    $script =
      Rose::HTML::Script->new(
        script => function addThese(a, b) { return a + b });

    print $script->html;

    ...



DESCRIPTION

Rose::HTML::Script is an object representation of a script HTML tag used to reference or wrap scripts (e.g., JavaScript).

This class inherits from, and follows the conventions of, Rose::HTML::Object. Inherited methods that are not overridden will not be documented a second time here. See the Rose::HTML::Object documentation for more information.

HTML ATTRIBUTES

Valid attributes:



    charset
    class
    defer
    dir
    id
    lang
    onclick
    ondblclick
    onkeydown
    onkeypress
    onkeyup
    onmousedown
    onmousemove
    onmouseout
    onmouseover
    onmouseup
    src
    style
    title
    type
    xml:lang



Required attributes (default values in parentheses):



    type (text/javascript)



Boolean attributes:



    defer



CONSTRUCTOR

<B>new PARAMSB> Constructs a new Rose::HTML::Script object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name.

CLASS METHODS

<B>default_support_older_browsers [BOOL]B> Get or set a boolean value that indicates whether or not the XHTML produced by objects of this class will, by default, attempt to support older web browsers that have trouble parsing the comments used to wrap script contents. The default value is true. See the support_older_browsers object method for some examples.

OBJECT METHODS

<B>contents [TEXT]B> Get or set the contents of the script tag.
<B>script [TEXT]B> This is an alias for the contents method.
<B>src [URI]B> Get or set the URI of the script file. If this attribute is set, then the contents of of the script tag are ignored when it comes time to produce the HTML.
<B>support_older_browsers [BOOL]B> Get or set a boolean value that indicates whether or not the XHTML produced by this object will attempt to support older web browsers that have trouble parsing the comments used to wrap script contents. If undefined, the value of this attribute is set to the return value of the default_support_older_browsers class method.

Examples:



    $script =
      Rose::HTML::Script->new(script => function foo() { return 123; });

    print $script->xhtml;



This prints the following big mess which helps older browsers while also remaining valid XHTML.



    <script type="text/javascript"><!--//--><![CDATA[//><!--
    function foo() { return 123; }
    //--><!]]></script>



Now the other mode:



    $script->support_older_browsers(0);
    print $script->xhtml;



which prints:



    <script type="text/javascript">
    //<![CDATA[
    function foo() { return 123; }
    //]]>
    </script>



See <http://hixie.ch/advocacy/xhtml> for more information on this topic.

AUTHOR

John C. Siracusa (siracusa@gmail.com)

LICENSE

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ROSE::HTML::SCRIPT (3) 2015-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.