From 67b742bf3218ced0cc0471ae8615beed66fe2cd3 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 25 May 2020 21:12:00 +0100 Subject: [PATCH] LibWeb: Add document.querySelector() --- .../anon/www/canvas-path-quadratic-curve.html | 2 +- Base/home/anon/www/canvas-path.html | 2 +- Base/home/anon/www/img-canvas.html | 4 ++-- Base/home/anon/www/location.html | 2 +- Libraries/LibWeb/Bindings/DocumentWrapper.cpp | 19 ++++++++++++++++++ Libraries/LibWeb/Bindings/DocumentWrapper.h | 1 + Libraries/LibWeb/DOM/Document.cpp | 20 +++++++++++++++++++ Libraries/LibWeb/DOM/Document.h | 1 + 8 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Base/home/anon/www/canvas-path-quadratic-curve.html b/Base/home/anon/www/canvas-path-quadratic-curve.html index 89c4a1d098..0985f97184 100644 --- a/Base/home/anon/www/canvas-path-quadratic-curve.html +++ b/Base/home/anon/www/canvas-path-quadratic-curve.html @@ -9,7 +9,7 @@ function drawSomeCurves() { -var canvas = document.querySelectorAll("canvas")[0]; +var canvas = document.querySelector("canvas"); var ctx = canvas.getContext("2d"); var x = 150; var y = 150; diff --git a/Base/home/anon/www/canvas-path.html b/Base/home/anon/www/canvas-path.html index 2f6c26c068..b44c7d655f 100644 --- a/Base/home/anon/www/canvas-path.html +++ b/Base/home/anon/www/canvas-path.html @@ -9,7 +9,7 @@ function drawHouse() { -var ctx = document.querySelectorAll("canvas")[0].getContext("2d"); +var ctx = document.querySelector("canvas").getContext("2d"); ctx.fillStyle = 'black'; ctx.fillRect(0, 0, 300, 300); diff --git a/Base/home/anon/www/img-canvas.html b/Base/home/anon/www/img-canvas.html index 5a4f0fde80..a21add25ac 100644 --- a/Base/home/anon/www/img-canvas.html +++ b/Base/home/anon/www/img-canvas.html @@ -9,10 +9,10 @@