mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags.
This commit is contained in:
parent
d8e2333528
commit
e703b93a65
24 changed files with 137 additions and 141 deletions
|
@ -72,8 +72,8 @@ can be retrieved through this property::
|
|||
>>> w = CalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
|
||||
Here's a list of all possible ``Media`` options. There are no required options.
|
||||
|
||||
|
@ -147,9 +147,9 @@ example above::
|
|||
>>> print(w.media)
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<link href="http://static.example.com/fancy.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/whizbang.js"></script>
|
||||
|
||||
The FancyCalendar widget inherits all the assets from its parent
|
||||
widget. If you don't want ``Media`` to be inherited in this way, add
|
||||
|
@ -166,7 +166,7 @@ an ``extend=False`` declaration to the ``Media`` declaration::
|
|||
>>> w = FancyCalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="http://static.example.com/fancy.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
|
||||
<script src="http://static.example.com/whizbang.js"></script>
|
||||
|
||||
If you require even more control over inheritance, define your assets using a
|
||||
:ref:`dynamic property <dynamic-property>`. Dynamic properties give you
|
||||
|
@ -229,16 +229,16 @@ was ``None``::
|
|||
>>> w = CalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="/css/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://uploads.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://othersite.com/actions.js"></script>
|
||||
<script src="http://uploads.example.com/animations.js"></script>
|
||||
<script src="http://othersite.com/actions.js"></script>
|
||||
|
||||
But if :setting:`STATIC_URL` is ``'http://static.example.com/'``::
|
||||
|
||||
>>> w = CalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="/css/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://othersite.com/actions.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://othersite.com/actions.js"></script>
|
||||
|
||||
Or if :mod:`~django.contrib.staticfiles` is configured using the
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage`::
|
||||
|
@ -246,8 +246,8 @@ Or if :mod:`~django.contrib.staticfiles` is configured using the
|
|||
>>> w = CalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="/css/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://static.example.com/animations.27e20196a850.js"></script>
|
||||
<script type="text/javascript" src="http://othersite.com/actions.js"></script>
|
||||
<script src="https://static.example.com/animations.27e20196a850.js"></script>
|
||||
<script src="http://othersite.com/actions.js"></script>
|
||||
|
||||
``Media`` objects
|
||||
=================
|
||||
|
@ -269,8 +269,8 @@ operator to filter out a medium of interest. For example::
|
|||
>>> w = CalendarWidget()
|
||||
>>> print(w.media)
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
|
||||
>>> print(w.media['css'])
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
|
@ -301,9 +301,9 @@ specified by both::
|
|||
>>> w2 = OtherWidget()
|
||||
>>> print(w1.media + w2.media)
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/whizbang.js"></script>
|
||||
|
||||
.. _form-media-asset-order:
|
||||
|
||||
|
@ -327,10 +327,10 @@ For example::
|
|||
>>> w1 = CalendarWidget()
|
||||
>>> w2 = TimeWidget()
|
||||
>>> print(w1.media + w2.media)
|
||||
<script type="text/javascript" src="http://static.example.com/jQuery.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/calendar.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/time.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/noConflict.js"></script>
|
||||
<script src="http://static.example.com/jQuery.js"></script>
|
||||
<script src="http://static.example.com/calendar.js"></script>
|
||||
<script src="http://static.example.com/time.js"></script>
|
||||
<script src="http://static.example.com/noConflict.js"></script>
|
||||
|
||||
Combining ``Media`` objects with assets in a conflicting order results in a
|
||||
``MediaOrderConflictWarning``.
|
||||
|
@ -357,9 +357,9 @@ are part of the form::
|
|||
>>> f = ContactForm()
|
||||
>>> f.media
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/whizbang.js"></script>
|
||||
|
||||
If you want to associate additional assets with a form -- for example,
|
||||
CSS for form layout -- add a ``Media`` declaration to the form::
|
||||
|
@ -377,6 +377,6 @@ CSS for form layout -- add a ``Media`` declaration to the form::
|
|||
>>> f.media
|
||||
<link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet">
|
||||
<link href="http://static.example.com/layout.css" type="text/css" media="all" rel="stylesheet">
|
||||
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/actions.js"></script>
|
||||
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
|
||||
<script src="http://static.example.com/animations.js"></script>
|
||||
<script src="http://static.example.com/actions.js"></script>
|
||||
<script src="http://static.example.com/whizbang.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue