mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1729239 - Implement HTMLScriptElement.supports(type) method. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124900
This commit is contained in:
parent
ef0c6ca163
commit
82e1fab48c
@ -228,4 +228,11 @@ bool HTMLScriptElement::HasScriptContent() {
|
|||||||
nsContentUtils::HasNonEmptyTextContent(this);
|
nsContentUtils::HasNonEmptyTextContent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-supports
|
||||||
|
/* static */
|
||||||
|
bool HTMLScriptElement::Supports(const GlobalObject& aGlobal,
|
||||||
|
const nsAString& aType) {
|
||||||
|
return aType.EqualsLiteral("classic") || aType.EqualsLiteral("module");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla::dom
|
} // namespace mozilla::dom
|
||||||
|
@ -130,6 +130,9 @@ class HTMLScriptElement final : public nsGenericHTMLElement,
|
|||||||
GetEnumAttr(nsGkAtoms::referrerpolicy, "", aReferrerPolicy);
|
GetEnumAttr(nsGkAtoms::referrerpolicy, "", aReferrerPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] static bool Supports(const GlobalObject& aGlobal,
|
||||||
|
const nsAString& aType);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~HTMLScriptElement();
|
virtual ~HTMLScriptElement();
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ interface HTMLScriptElement : HTMLElement {
|
|||||||
attribute DOMString referrerPolicy;
|
attribute DOMString referrerPolicy;
|
||||||
[CEReactions, Throws]
|
[CEReactions, Throws]
|
||||||
attribute DOMString text;
|
attribute DOMString text;
|
||||||
|
|
||||||
|
static boolean supports(DOMString type);
|
||||||
};
|
};
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
[script-supports.html]
|
|
||||||
[Type of HTMLScriptElement.supports is function]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLScriptElement.supports resurns true for 'classic']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLScriptElement.supports resurns true for 'module']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLScriptElement.supports returns false for JavaScript MIME types]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLScriptElement.supports returns false for unsupported types]
|
|
||||||
expected: FAIL
|
|
@ -1,6 +1,3 @@
|
|||||||
[script-supports-importmap.html]
|
[script-supports-importmap.html]
|
||||||
[HTMLScriptElement.supports returns true for 'importmap']
|
[HTMLScriptElement.supports returns true for 'importmap']
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLScriptElement.supports returns false for unsupported types]
|
|
||||||
expected: FAIL
|
|
||||||
|
Loading…
Reference in New Issue
Block a user