seanmorris / php-wasm

PHP in Browser, powered by WebAssembly.
https://seanmorris.github.io/php-wasm/
Apache License 2.0
606 stars 32 forks source link

Code confusing between element and its content #33

Closed uuf6429 closed 1 week ago

uuf6429 commented 8 months ago

The first and only parameter of runPhpScriptTag is element, which is expected and used as exclusively as a DOM element node (element.getAttribute...).

However, the line below calls that function with a string, as far as I know (I think this is a bug): https://github.com/seanmorris/php-wasm/blob/094f4e00fa99b1271af077b6de7d0d38d475ecae/source/PhpWeb.js#L77

Other usages of that function seems to be confusing this as well, for example while the following line correctly passes an element, the previous line declares a code variable (from the element content) and doesn't use it anywhere. https://github.com/seanmorris/php-wasm/blob/818a3607b826f0b8eb029572c56042e0865170c1/source/PhpWeb.js#L90

A similar situation can be seen in other files, such as PhpShell.js and PhpWebDrupal.js.

seanmorris commented 1 week ago

This has been refactored.