Skip to content
Browse files

HTML5 doesn't bother specifying the type of <SCRIPT>s

  • Loading branch information...
1 parent 52730f0 commit 4af9cd948d85135870e5db198c39e85bfac58677 @mikeabdullah mikeabdullah committed Mar 25, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 KSHTMLWriter.m
View
8 KSHTMLWriter.m
@@ -267,7 +267,13 @@ - (void)writeJavascript:(NSString *)script useCDATA:(BOOL)useCDATA;
- (void)startJavascriptElementWithSrc:(NSString *)src; // src may be nil
{
- [self pushAttribute:@"type" value:@"text/javascript"]; // in theory, HTML5 pages could omit this
+ // HTML5 doesn't need the script type specified, but older doc types do for standards-compliance
+ if (![[self docType] isEqualToString:KSHTMLWriterDocTypeHTML_5])
+ {
+ [self pushAttribute:@"type" value:@"text/javascript"];
+ }
+
+ // Script
if (src) [self pushAttribute:@"src" value:src];
[self pushAttribute:@"charset" value:@"UTF-8"];

0 comments on commit 4af9cd9

Please sign in to comment.
Something went wrong with that request. Please try again.