Bug 1880189 - Align our WebIDL better with current specs. r=webidl,smaug

Differential Revision: https://phabricator.services.mozilla.com/D205213
This commit is contained in:
Emilio Cobos Álvarez 2024-03-20 21:51:22 +00:00
Родитель 77dbe4f846
Коммит acea330fc8
6 изменённых файлов: 28 добавлений и 40 удалений

Просмотреть файл

@ -98,8 +98,6 @@ interface Document : Node {
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
[Pure]
HTMLCollection getElementsByClassName(DOMString classNames);
[Pure]
Element? getElementById(DOMString elementId);
// These DOM methods cannot be accessed by UA Widget scripts
// because the DOM element reflectors will be in the content scope,
@ -387,17 +385,6 @@ partial interface Document {
readonly attribute Element? scrollingElement;
};
// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
partial interface Document {
[Throws, Pure]
Element? querySelector(UTF8String selectors);
[Throws, Pure]
NodeList querySelectorAll(UTF8String selectors);
//(Not implemented)Element? find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
//(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
};
// https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface
partial interface Document {
[Func="Document::AreWebAnimationsTimelinesEnabled"]
@ -758,3 +745,5 @@ partial interface Document {
[ChromeOnly]
boolean isActive();
};
Document includes NonElementParentNode;

Просмотреть файл

@ -4,8 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/2012/WD-dom-20120405/#interface-documentfragment
* http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
* https://dom.spec.whatwg.org/#documentfragment
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@ -15,16 +14,7 @@
interface DocumentFragment : Node {
[Throws]
constructor();
Element? getElementById(DOMString elementId);
};
// http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
partial interface DocumentFragment {
[Throws]
Element? querySelector(UTF8String selectors);
[Throws]
NodeList querySelectorAll(UTF8String selectors);
};
DocumentFragment includes ParentNode;
DocumentFragment includes NonElementParentNode;

Просмотреть файл

@ -4,10 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dom.spec.whatwg.org/#element and
* http://domparsing.spec.whatwg.org/ and
* http://dev.w3.org/csswg/cssom-view/ and
* http://www.w3.org/TR/selectors-api/
* https://dom.spec.whatwg.org/#interface-element
* https://domparsing.spec.whatwg.org/
* https://drafts.csswg.org/cssom-view/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@ -112,7 +111,7 @@ interface Element : Node {
* Returns whether this element would be selected by the given selector
* string.
*
* See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
* https://dom.spec.whatwg.org/#dom-element-matches
*/
[Throws, Pure, BinaryName="matches"]
boolean mozMatchesSelector(UTF8String selector);
@ -192,7 +191,7 @@ interface mixin ElementCSSInlineStyle {
readonly attribute CSSStyleDeclaration style;
};
// http://dev.w3.org/csswg/cssom-view/
// https://drafts.csswg.org/cssom-view/
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
dictionary ScrollIntoViewOptions : ScrollOptions {
ScrollLogicalPosition block = "start";
@ -208,7 +207,7 @@ dictionary CheckVisibilityOptions {
[ChromeOnly] boolean flush = true;
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
// https://drafts.csswg.org/cssom-view/#extensions-to-the-element-interface
partial interface Element {
DOMRectList getClientRects();
DOMRect getBoundingClientRect();
@ -268,14 +267,6 @@ partial interface Element {
undefined insertAdjacentHTML(DOMString position, DOMString text);
};
// http://www.w3.org/TR/selectors-api/#interface-definitions
partial interface Element {
[Throws, Pure]
Element? querySelector(UTF8String selectors);
[Throws, Pure]
NodeList querySelectorAll(UTF8String selectors);
};
// https://dom.spec.whatwg.org/#dictdef-shadowrootinit
dictionary ShadowRootInit {
required ShadowRootMode mode;

Просмотреть файл

@ -0,0 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#nonelementparentnode
*/
interface mixin NonElementParentNode {
[Pure]
Element? getElementById(DOMString elementId);
};

Просмотреть файл

@ -30,4 +30,9 @@ interface mixin ParentNode {
undefined append((Node or DOMString)... nodes);
[CEReactions, Throws, Unscopable]
undefined replaceChildren((Node or DOMString)... nodes);
[Throws, Pure]
Element? querySelector(UTF8String selectors);
[Throws, Pure]
NodeList querySelectorAll(UTF8String selectors);
};

Просмотреть файл

@ -755,6 +755,7 @@ WEBIDL_FILES = [
"NodeFilter.webidl",
"NodeIterator.webidl",
"NodeList.webidl",
"NonElementParentNode.webidl",
"Notification.webidl",
"NotificationEvent.webidl",
"NotifyPaintEvent.webidl",