-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify+copy JS behaviour when script tags are fighting #12
Comments
I checked in firefox: both scripts are run. B cannot get it's own element via the DOM: it is available via document.currentScript, but does not show in document.getElementById. |
<script>
var da = document.createElement("script")
da.id="da"
da.textContent = `
console.log("da", document.getElementById("da"))
var b = document.getElementById("db");
b.parentNode.removeChild(b);
`
var db = document.createElement("script")
db.id="db"
db.textContent = `
console.log("db", document.getElementById("db"))
var a = document.getElementById("da");
a.parentNode.removeChild(a);
`
setTimeout(function() {
document.body.appendChild(da)
document.body.appendChild(db)
}, 5)
</script> In Chrome and Firefox: |
This is currently not the same as fengari where we run the scripts after they're in the document. <script>
var da = document.createElement("script")
da.id="da"
da.type = "application/lua"
da.textContent = `
local console = require "js".global.console
local document = require "js".global.document
console:log("da", document:getElementById("da"))
local b = document:getElementById("db");
b.parentNode:removeChild(b);
`
var db = document.createElement("script")
db.id="db"
db.type = "application/lua"
db.textContent = `
local console = require "js".global.console
local document = require "js".global.document
console:log("db", document:getElementById("db"))
local a = document:getElementById("da");
a.parentNode:removeChild(a);
`
setTimeout(function() {
document.body.appendChild(da)
document.body.appendChild(db)
}, 5)
</script> |
Whats the expected behaviour? Whats the problem/enchancement proposed here? |
I don't know: need to audit what all the browsers do.
To make sure that the way we load lua script tags matches exactly how JS tags are loaded. |
e.g. Two script tags are added to document, they both contain code to remove the other. Do both run?
Need to check on load and after document ready.
The text was updated successfully, but these errors were encountered: