diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 12:18:21 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 12:18:21 +0100 |
commit | 19b45fb494358838be8b3175fde9e3ab55ef5bfa (patch) | |
tree | d872d6c39ffc3d629a9a58610e4730f27184b751 /test | |
parent | 90cabaf8c88782a07cd8bdc448bd21e471eeb072 (diff) | |
download | netsurf-19b45fb494358838be8b3175fde9e3ab55ef5bfa.tar.gz netsurf-19b45fb494358838be8b3175fde9e3ab55ef5bfa.tar.bz2 |
Support script insertion after conversion has begun
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/js/inserted-script-async.js | 1 | ||||
-rw-r--r-- | test/js/inserted-script-defer.js | 1 | ||||
-rw-r--r-- | test/js/inserted-script.html | 39 | ||||
-rw-r--r-- | test/js/inserted-script.js | 1 |
4 files changed, 42 insertions, 0 deletions
diff --git a/test/js/inserted-script-async.js b/test/js/inserted-script-async.js new file mode 100644 index 000000000..5552e2773 --- /dev/null +++ b/test/js/inserted-script-async.js @@ -0,0 +1 @@ +console.log("External asynchronous dynamism!"); diff --git a/test/js/inserted-script-defer.js b/test/js/inserted-script-defer.js new file mode 100644 index 000000000..2d89edd34 --- /dev/null +++ b/test/js/inserted-script-defer.js @@ -0,0 +1 @@ +console.log("External deferred dynamism!"); diff --git a/test/js/inserted-script.html b/test/js/inserted-script.html new file mode 100644 index 000000000..b1c381aaa --- /dev/null +++ b/test/js/inserted-script.html @@ -0,0 +1,39 @@ +<html> + <head> + <title>Inserted script test</title> + <script> + /* After one second, insert an inline script element */ + setTimeout(function() { + var div = document.createElement("DIV"); + var script = document.createElement("SCRIPT"); + var textnode = document.createTextNode("console.log(\"Dynamism\");"); + script.appendChild(textnode); + div.appendChild(script); + document.body.appendChild(div); + }, 1000); + /* After two seconds, insert a script element for immediate fetch */ + setTimeout(function() { + var script = document.createElement("SCRIPT"); + script.setAttribute("src", "inserted-script.js"); + document.body.appendChild(script); + }, 2000); + /* After three seconds, insert a script element for async fetch */ + setTimeout(function() { + var script = document.createElement("SCRIPT"); + script.setAttribute("src", "inserted-script-async.js"); + script.setAttribute("async", ""); + document.body.appendChild(script); + }, 3000); + /* After four seconds, insert a script element for deferred fetch */ + setTimeout(function() { + var script = document.createElement("SCRIPT"); + script.setAttribute("src", "inserted-script-defer.js"); + script.setAttribute("defer", ""); + document.body.appendChild(script); + }, 4000); + </script> + </head> + <body> + Check the log + </body> +</html> diff --git a/test/js/inserted-script.js b/test/js/inserted-script.js new file mode 100644 index 000000000..f3a954827 --- /dev/null +++ b/test/js/inserted-script.js @@ -0,0 +1 @@ +console.log("External dynamism!"); |