mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
parent
ed97ee902b
commit
2f426765a6
3 changed files with 33 additions and 0 deletions
|
@ -32,6 +32,12 @@ public:
|
||||||
|
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-supports
|
||||||
|
static bool supports(String const& type)
|
||||||
|
{
|
||||||
|
return type.is_one_of("classic", "module");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepare_script();
|
void prepare_script();
|
||||||
void script_became_ready();
|
void script_became_ready();
|
||||||
|
|
|
@ -6,6 +6,8 @@ interface HTMLScriptElement : HTMLElement {
|
||||||
[Reflect] attribute boolean defer;
|
[Reflect] attribute boolean defer;
|
||||||
[Reflect] attribute DOMString integrity;
|
[Reflect] attribute DOMString integrity;
|
||||||
|
|
||||||
|
static boolean supports(DOMString type);
|
||||||
|
|
||||||
[Reflect] attribute DOMString charset;
|
[Reflect] attribute DOMString charset;
|
||||||
[Reflect] attribute DOMString event;
|
[Reflect] attribute DOMString event;
|
||||||
[Reflect=for] attribute DOMString htmlFor;
|
[Reflect=for] attribute DOMString htmlFor;
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
describe("HTMLScriptElement.supports", () => {
|
||||||
|
loadLocalPage("/res/html/misc/blank.html");
|
||||||
|
|
||||||
|
afterInitialPageLoad(page => {
|
||||||
|
test("length is 1", () => {
|
||||||
|
expect(page.HTMLScriptElement.supports).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Basic functionality", () => {
|
||||||
|
expect(page.HTMLScriptElement.supports("classic")).toBeTrue();
|
||||||
|
expect(page.HTMLScriptElement.supports("module")).toBeTrue();
|
||||||
|
expect(page.HTMLScriptElement.supports("abc")).toBeFalse();
|
||||||
|
|
||||||
|
// Is case sensitive.
|
||||||
|
expect(page.HTMLScriptElement.supports("Classic")).toBeFalse();
|
||||||
|
expect(page.HTMLScriptElement.supports("Module")).toBeFalse();
|
||||||
|
|
||||||
|
// Doesn't strip whitespace.
|
||||||
|
expect(page.HTMLScriptElement.supports(" classic ")).toBeFalse();
|
||||||
|
expect(page.HTMLScriptElement.supports(" module ")).toBeFalse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
waitForPageToLoad();
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue