Skip to content

Commit ed30394

Browse files
committed
Simplify script and style tags for modern times
1 parent 83f2f07 commit ed30394

File tree

10 files changed

+14
-23
lines changed

10 files changed

+14
-23
lines changed

webware/Examples/AjaxPage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class AjaxPage(BaseClass):
8989

9090
def writeJavaScript(self):
9191
BaseClass.writeJavaScript(self)
92-
s = '<script type="text/javascript" src="ajax{}.js"></script>'
92+
s = '<script src="ajax{}.js"></script>'
9393
self.writeln(s.format('call'))
9494
if self._clientPolling:
9595
self.writeln(s.format('poll'))

webware/Examples/AjaxSuggest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class AjaxSuggest(AjaxPage):
2626
def writeJavaScript(self):
2727
AjaxPage.writeJavaScript(self)
2828
self.writeln(
29-
'<script type="text/javascript" src="ajaxsuggest.js"></script>')
29+
'<script src="ajaxsuggest.js"></script>')
3030

3131
def writeStyleSheet(self):
3232
AjaxPage.writeStyleSheet(self)
3333
self.writeln(
34-
'<link rel="stylesheet" href="ajaxsuggest.css" type="text/css">')
34+
'<link rel="stylesheet" href="ajaxsuggest.css">')
3535

3636
def htBodyArgs(self):
3737
return AjaxPage.htBodyArgs(self) + ' onload="initPage();"'

webware/Examples/JSONRPCClient.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class JSONRPCClient(ExamplePage):
99
def writeJavaScript(self):
1010
ExamplePage.writeJavaScript(self)
1111
self.write('''\
12-
<script type="text/javascript" src="jsonrpc.js"></script>
13-
<script type="text/javascript">
12+
<script src="jsonrpc.js"></script>
13+
<script>
1414
jsonrpc = new JSONRpcClient("JSONRPCExample");
1515
methods = jsonrpc.system.listMethods();
1616
function dojsonrpc() {
@@ -47,7 +47,7 @@ def writeContent(self):
4747
<input id="parameter" type="text" size="20" value="Hello, World!">
4848
</td><td>
4949
<select id="method" size="1">
50-
<script type="text/javascript">
50+
<script>
5151
for (m in methods)
5252
document.writeln('<option>' + methods[m] + '</option>');
5353
</script>

webware/Examples/YattagDemo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def writeStyleSheet(self):
108108
}
109109
"""
110110
doc, tag, text = Doc().tagtext()
111-
with tag('style', klass='text/css'):
111+
with tag('style'):
112112
text(style)
113113

114114
self.writeln(doc.getvalue())

webware/ExceptionHandler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,7 @@ def docType():
657657

658658
def htStyle():
659659
"""Return the page style."""
660-
return '''<style type="text/css">
661-
<!--
660+
return '''<style>
662661
body {
663662
background-color: white;
664663
color: #080810;
@@ -699,7 +698,6 @@ def htStyle():
699698
color: black;
700699
font-weight: normal;
701700
}
702-
-->
703701
</style>'''
704702

705703

webware/Page.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ def writeStyleSheet(self):
159159
160160
A typical implementation is::
161161
162-
self.writeln('<link rel="stylesheet"'
163-
' href="StyleSheet.css" type="text/css">')
162+
self.writeln('<link rel="stylesheet" href="StyleSheet.css">')
164163
"""
165164
# base method does nothing
166165

@@ -172,8 +171,7 @@ def writeJavaScript(self):
172171
173172
A typical implementation is::
174173
175-
self.writeln('<script type="text/javascript"'
176-
' src="ajax.js"></script>')
174+
self.writeln('<script src="ajax.js"></script>')
177175
"""
178176
# base method does nothing
179177

webware/SidebarPage.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class SidebarPage(Page):
2424
# region StyleSheet
2525

2626
_styleSheet = '''
27-
<!--
2827
html {
2928
height: 100%;
3029
}
@@ -121,7 +120,6 @@ class SidebarPage(Page):
121120
table.NiceTable th a:link, table.NiceTable th a:visited {
122121
color: #101040;
123122
}
124-
-->
125123
'''
126124

127125
def writeStyleSheet(self):
@@ -130,7 +128,7 @@ def writeStyleSheet(self):
130128
This way we avoid having to care about where an external style
131129
sheet should be located when this class is used in another context.
132130
"""
133-
self.writeln(f'<style type="text/css">{self._styleSheet}</style>')
131+
self.writeln(f'<style>{self._styleSheet}</style>')
134132

135133
# endregion StyleSheet
136134

webware/Tests/TestEndToEnd/TestExamples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def testStartPage(self):
2828
r.mustcontain(
2929
'<html lang="en">', '<head>', '</head>',
3030
'<title>Welcome</title>', '<meta charset="utf-8">',
31-
'<style type="text/css">', 'table.NiceTable {', '</style>',
31+
'<style>', 'table.NiceTable {', '</style>',
3232
'<body style="color:black;background-color:white">', '</body>',
3333
'<div id="Page">', '<div id="CornerTitle">Webware Examples</div>',
3434
'<div id="Banner">Welcome</div>', '<div id="Sidebar">',

webware/Tests/TestEndToEnd/TestServer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,13 @@
5151
<head>
5252
\s*<title>Welcome</title>
5353
\s*<meta charset="utf-8">
54-
<style type="text/css">
55-
<!--
54+
<style>
5655
html {
5756
}
5857
h1 { .+; }
5958
#Page {
6059
\s*display: table;
6160
}
62-
-->
6361
</style>
6462
</head>
6563
<body style="color:black;background-color:white">

webware/WebUtils/CGITraceback.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def html(context=5, options=None):
4848
inspect_trace = inspect.trace(context)
4949

5050
javascript = """
51-
<script type="text/javascript" language="JavaScript"><!--
51+
<script>
5252
function tag(s) { return '<'+s+'>'; }
5353
function popup_repr(title, value) {
5454
w = window.open('', '_blank',
@@ -66,7 +66,6 @@ def html(context=5, options=None):
6666
w.document.close();
6767
return false;
6868
}
69-
// -->
7069
</script>
7170
"""
7271

0 commit comments

Comments
 (0)