WOAssociation *scriptString;
WOAssociation *scriptSource;
WOAssociation *hideInComment;
+
+ WOAssociation *type;
}
@end /* WOJavaScript */
self->scriptString = OWGetProperty(_config, @"scriptString");
self->scriptSource = OWGetProperty(_config, @"scriptSource");
self->hideInComment = OWGetProperty(_config, @"hideInComment");
+ self->type = OWGetProperty(_config, @"type");
}
return self;
}
- (void)dealloc {
+ [self->type release];
[self->scriptFile release];
[self->scriptString release];
[self->scriptSource release];
- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
WOComponent *sComponent;
+ NSString *st;
BOOL hide;
if ([[_ctx request] isFromClientComponent])
sComponent = [_ctx component];
hide = [self->hideInComment boolValueInComponent:sComponent];
- WOResponse_AddCString(_response, "<script language=\"JavaScript\" ");
-
+ WOResponse_AddCString(_response, "<script");
+
+ if ((st = [self->type stringValueInComponent:sComponent]) != nil) {
+ WOResponse_AddCString(_response, " type=\"");
+ [_response appendContentHTMLAttributeValue:st];
+ WOResponse_AddCString(_response, "\"");
+ }
+ else {
+ WOResponse_AddCString(_response, " type=\"text/javascript\"");
+ }
+
/* add URL to script */
if (self->scriptSource) {
+ st = [self->scriptSource stringValueInComponent:sComponent];
WOResponse_AddCString(_response, " src=\"");
- [_response appendContentHTMLAttributeValue:
- [self->scriptSource stringValueInComponent:sComponent]];
+ [_response appendContentHTMLAttributeValue:st];
WOResponse_AddCString(_response, "\"");
}
-
- if (self->otherTagString) {
+
+ [self appendExtraAttributesToResponse:_response inContext:_ctx];
+ if (self->otherTagString != nil) {
WOResponse_AddChar(_response, ' ');
WOResponse_AddString(_response,
[self->otherTagString stringValueInComponent: