mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:27: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:
parent
3c0b55c284
commit
575ce04148
6 changed files with 209 additions and 0 deletions
28
Userland/Libraries/LibWeb/Bindings/CSSNamespace.h
Normal file
28
Userland/Libraries/LibWeb/Bindings/CSSNamespace.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
// The `CSS` namespace object in IDL. https://www.w3.org/TR/cssom-1/#namespacedef-css
|
||||
class CSSNamespace final : public JS::Object {
|
||||
JS_OBJECT(CSSNamespace, JS::Object)
|
||||
|
||||
public:
|
||||
explicit CSSNamespace(JS::GlobalObject&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual ~CSSNamespace() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(escape);
|
||||
JS_DECLARE_NATIVE_FUNCTION(supports);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue