@TagLib class JavascriptTagLib extends java.lang.Object implements ApplicationContextAware, TagLibrary
Javascript tags.
Type | Name and description |
---|---|
ApplicationContext |
applicationContext |
static java.lang.Object |
encodeAsForTags |
groovy.lang.Closure |
escapeJavascript Escapes a javascript string replacing single/double quotes and new lines. |
boolean |
hasResourceProcessor |
groovy.lang.Closure |
javascript Includes a javascript src file, library or inline script if the tag has no 'src' or 'library' attributes its assumed to be an inline script: |
GrailsPluginManager |
pluginManager |
Constructor and description |
---|
JavascriptTagLib
() |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Escapes a javascript string replacing single/double quotes and new lines.
<g:escapeJavascript>This is some "text" to be escaped</g:escapeJavascript>
Includes a javascript src file, library or inline script
if the tag has no 'src' or 'library' attributes its assumed to be an inline script:
<g:javascript>alert('hello')</g:javascript>
The 'library' attribute will attempt to use the library mappings defined above to import the
right js files and not duplicate imports eg.
<g:javascript library="scriptaculous" /> // imports all the necessary js for the scriptaculous library
The 'src' attribute will merely import the js file but within the right context (ie inside the /js/ directory of
the Grails application:
<g:javascript src="myscript.js" /> // actually imports '/app/js/myscript.js'
Groovy Documentation