Skip to content
Myr

remove javascript fetch polyfill

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent c7f2ab8 · Browse files · 8 files+48 added−50 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+48 added−50 removed

  • tests:+2 added−2 removed
  • other:+46 added−48 removed

8 files+48 added−50 removed

modified:examples/javascript/js_example/templates/base.html+4 added-4 removed
modified:examples/javascript/js_example/templates/fetch.html+2 added-5 removed
deleted:examples/javascript/js_example/templates/plain.html-28 removed
added:examples/javascript/js_example/templates/xhr.html+29 added
modified:examples/javascript/js_example/views.py+2 added-2 removed
3 unmodified lines
45from js_example import app678@app.route("/", defaults={"js": "plain"})9@app.route("/<any(plain, jquery, fetch):js>")8@app.route("/", defaults={"js": "fetch"})9@app.route("/<any(xhr, jquery, fetch):js>")10def index(js):11 return render_template(f"{js}.html", js=js)1213
5 unmodified lines
modified:examples/javascript/tests/test_js_example.py+2 added-2 removed
3 unmodified lines
45@pytest.mark.parametrize(6 ("path", "template_name"),7 (8 ("/", "plain.html"),9 ("/plain", "plain.html"),8 ("/", "xhr.html"),9 ("/plain", "xhr.html"),10 ("/fetch", "fetch.html"),11 ("/jquery", "jquery.html"),12 ),13)
14 unmodified lines
modified:examples/javascript/README.rst+8 added-8 removed
1 unmodified line
2=======================34Demonstrates how to post form data and process a JSON response using5JavaScript. This allows making requests without navigating away from the6page. Demonstrates using |XMLHttpRequest|_, |fetch|_, and7|jQuery.ajax|_. See the `Flask docs`_ about jQuery and Ajax.6page. Demonstrates using |fetch|_, |XMLHttpRequest|_, and7|jQuery.ajax|_. See the `Flask docs`_ about JavaScript and Ajax.89.. |XMLHttpRequest| replace:: ``XMLHttpRequest``10.. _XMLHttpRequest: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest119.. |fetch| replace:: ``fetch``10.. _fetch: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch1112.. |XMLHttpRequest| replace:: ``XMLHttpRequest``13.. _XMLHttpRequest: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest1415.. |jQuery.ajax| replace:: ``jQuery.ajax``16.. _jQuery.ajax: https://api.jquery.com/jQuery.ajax/1718.. _Flask docs: https://flask.palletsprojects.com/patterns/jquery/
1 unmodified line
2021Install22-------2324::24.. code-block:: text2526 $ python3 -m venv venv27 $ . venv/bin/activate28 $ pip install -e .
1 unmodified line
3031Run32---3334::34.. code-block:: text3536 $ export FLASK_APP=js_example37 $ flask run38
2 unmodified lines
4142Test43----4445::45.. code-block:: text4647 $ pip install -e '.[test]'48 $ coverage run -m pytest49 $ coverage report
modified:examples/javascript/setup.cfg+1 added-1 removed
1[metadata]2name = js_example3version = 1.0.03version = 1.1.04url = https://flask.palletsprojects.com/patterns/jquery/5license = BSD-3-Clause6maintainer = Pallets7maintainer_email = contact@palletsprojects.com
22 unmodified lines