summaryrefslogtreecommitdiff
path: root/Base/home
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-14 13:15:11 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-14 13:25:40 +0100
commit1c406294fc426a2d083e7d5f30f7e4e97ef4a794 (patch)
tree9dbd3c6fce454018e1f0af6c9dd2ecad1b779898 /Base/home
parent9c9d3f090429746df8a39232eb75467007463a9e (diff)
downloadserenity-1c406294fc426a2d083e7d5f30f7e4e97ef4a794.zip
LibWeb: Start implementing basic JavaScript DOM bindings
This patch introduces the Wrapper and Wrappable classes. Node now inherits from Wrappable, and can be wrapped in a GC-allocated Bindings::NodeWrapper object. The only property we expose right now is the very simple nodeName property. When a Document's JS::Interpreter is first instantiated, we add a "document" property with a DocumentWrapper object to the global object. This is pretty cool! :^)
Diffstat (limited to 'Base/home')
-rw-r--r--Base/home/anon/www/dom.html12
-rw-r--r--Base/home/anon/www/welcome.html1
2 files changed, 13 insertions, 0 deletions
diff --git a/Base/home/anon/www/dom.html b/Base/home/anon/www/dom.html
new file mode 100644
index 0000000000..0c6a15dfad
--- /dev/null
+++ b/Base/home/anon/www/dom.html
@@ -0,0 +1,12 @@
+<!DOCTYPE>
+<html>
+ <head></head>
+ <body>
+ <div id="foo"></div>
+ <script>
+ alert(document.nodeName);
+ //var e = document.getElementById("foo");
+ //alert(e.nodeName);
+ </script>
+ </body>
+</html>
diff --git a/Base/home/anon/www/welcome.html b/Base/home/anon/www/welcome.html
index 6f7f3a3a78..4f2d30a013 100644
--- a/Base/home/anon/www/welcome.html
+++ b/Base/home/anon/www/welcome.html
@@ -23,6 +23,7 @@ h1 {
<p>This is a very simple browser built on the LibWeb engine.</p>
<p>Some small test pages:</p>
<ul>
+ <li><a href="dom.html">simple DOM JS test</a></li>
<li><a href="alert.html">alert() test</a></li>
<li><a href="small.html">small</a></li>
<li><a href="first-child.html">:first-child</a></li>