mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:47:35 +00:00
LibWeb: Parse <script> elements and run any JavaScript found inside
This patch begins integrating LibJS into LibWeb. Document holds the JS::Interpreter for now, and it is created on demand when you first call Document::interpreter(). We also add a simple "alert()" function to the global object.
This commit is contained in:
parent
f94099f796
commit
9c9d3f0904
11 changed files with 142 additions and 3 deletions
|
@ -38,6 +38,7 @@
|
|||
#include <LibWeb/DOM/HTMLImageElement.h>
|
||||
#include <LibWeb/DOM/HTMLInputElement.h>
|
||||
#include <LibWeb/DOM/HTMLLinkElement.h>
|
||||
#include <LibWeb/DOM/HTMLScriptElement.h>
|
||||
#include <LibWeb/DOM/HTMLStyleElement.h>
|
||||
#include <LibWeb/DOM/HTMLTitleElement.h>
|
||||
|
||||
|
@ -82,6 +83,8 @@ NonnullRefPtr<Element> create_element(Document& document, const String& tag_name
|
|||
|| lowercase_tag_name == "h6") {
|
||||
return adopt(*new HTMLHeadingElement(document, lowercase_tag_name));
|
||||
}
|
||||
if (lowercase_tag_name == "script")
|
||||
return adopt(*new HTMLScriptElement(document, lowercase_tag_name));
|
||||
return adopt(*new Element(document, lowercase_tag_name));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue