1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Add CSS.escape() JS function

This is the `CSS` namespace defined in IDL here:
https://www.w3.org/TR/cssom-1/#namespacedef-css , not to be confused
with our `Web::CSS` namespace. Words are hard.

`CSS.escape()` lets you escape identifiers that can then be used to
create a CSS string.

I've also stubbed out the `CSS.supports()` function.
This commit is contained in:
Sam Atkins 2021-10-06 14:27:13 +01:00 committed by Andreas Kling
parent 3c0b55c284
commit 575ce04148
6 changed files with 209 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/Shape.h>
#include <LibTextCodec/Decoder.h>
#include <LibWeb/Bindings/CSSNamespace.h>
#include <LibWeb/Bindings/CSSStyleDeclarationWrapper.h>
#include <LibWeb/Bindings/CryptoWrapper.h>
#include <LibWeb/Bindings/DocumentWrapper.h>
@ -104,6 +105,8 @@ void WindowObject::initialize_global_object()
define_native_accessor("screenLeft", screen_left_getter, {}, attr);
define_native_accessor("screenTop", screen_top_getter, {}, attr);
define_direct_property("CSS", heap().allocate<CSSNamespace>(*this, *this), 0);
// Legacy
define_native_accessor("event", event_getter, event_setter, JS::Attribute::Enumerable);