Permalink
Browse files

more careful handling of script and link tag attributes

  • Loading branch information...
1 parent 89bff3a commit 37f19a02851b3875c6ee69d1b065ea48b8a26518 @peterbe committed Jul 4, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 tornado_utils/tornado_static.py
@@ -8,7 +8,7 @@
(c) mail@peterbe.com
"""
-__version__ = '1.7'
+__version__ = '1.8'
import os
import cPickle
@@ -264,10 +264,10 @@ def render(self, *static_urls, **options):
if extension == 'css':
template = '<link rel="stylesheet" type="text/css" href="%(url)s">'
elif extension == 'js':
- template = '<script '
- if 'defer' in options:
+ template = '<script type="text/javascript" '
+ if options.get('defer'):
template += 'defer '
- elif 'async' in options:
+ elif options.get('async'):
template += 'async '
template += 'src="%(url)s"></script>'
else:
@@ -373,10 +373,10 @@ def render(self, *static_urls, **options):
if extension == 'css':
template = '<link rel="stylesheet" type="text/css" href="%(url)s">'
elif extension == 'js':
- template = '<script '
- if 'defer' in options:
+ template = '<script type="text/javascript" '
+ if options.get('defer'):
template += 'defer '
- elif 'async' in options:
+ elif options.get('async'):
template += 'async '
template += 'src="%(url)s"></script>'
else:

0 comments on commit 37f19a0

Please sign in to comment.