Skip to content

Commit

Permalink
Move element[s]FromPoint to DocumentOrShadowRoot (#1123)
Browse files Browse the repository at this point in the history
* Remove redundant Text#assignedSlot

Slottable already defines it.

* Move element[s]FromPoint to DocumentOrShadowRoot
  • Loading branch information
saschanaz authored Aug 27, 2021
1 parent 93a9848 commit d42f963
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
15 changes: 7 additions & 8 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4394,13 +4394,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
* @param filter A custom NodeFilter function to use.
*/
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element | null;
elementsFromPoint(x: number, y: number): Element[];
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
Expand Down Expand Up @@ -4558,6 +4551,13 @@ interface DocumentOrShadowRoot {
readonly pointerLockElement: Element | null;
/** Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */
readonly styleSheets: StyleSheetList;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element | null;
elementsFromPoint(x: number, y: number): Element[];
getAnimations(): Animation[];
}

Expand Down Expand Up @@ -13348,7 +13348,6 @@ declare var SubtleCrypto: {

/** The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children. */
interface Text extends CharacterData, Slottable {
readonly assignedSlot: HTMLSlotElement | null;
/** Returns the combined data of all direct Text node siblings. */
readonly wholeText: string;
/** Splits data at the given offset and returns the remainder as Text node. */
Expand Down
37 changes: 22 additions & 15 deletions inputfiles/addedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@
]
}
},
"DocumentOrShadowRoot": {
// Manually moved from Document
// See https://github.com/w3c/csswg-drafts/issues/5886 and https://github.com/w3c/csswg-drafts/issues/556
"methods": {
"method": {
"elementFromPoint": {
"name": "elementFromPoint",
"overrideSignatures": [
"elementFromPoint(x: number, y: number): Element | null"
]
},
"elementsFromPoint": {
"name": "elementsFromPoint",
"overrideSignatures": [
"elementsFromPoint(x: number, y: number): Element[]"
]
}
}
}
},
"GlobalEventHandlers": {
"events": {
"event": [
Expand Down Expand Up @@ -581,8 +601,7 @@
]
}
}
},

}
},
"EventListenerObject": {
"name": "EventListenerObject",
Expand All @@ -595,7 +614,7 @@
]
}
}
},
}
},
"Document": {
"methods": {
Expand Down Expand Up @@ -748,18 +767,6 @@
]
}
},
"Text": {
"name": "Text",
"properties": {
"property": {
"assignedSlot": {
"name": "assignedSlot",
"readonly": true,
"overrideType": "HTMLSlotElement | null"
}
}
}
},

This comment has been minimized.

Copy link
@orta

orta Sep 27, 2021

Contributor

Was this an over-delete by any chance? https://caniuse.com/?search=assignedSlot

  • Element API: assignedSlot is deprecated but...
  • Text API: assignedSlot is not

This comment has been minimized.

Copy link
@saschanaz

saschanaz Oct 2, 2021

Author Contributor

It's in Slottable mixin so this is just a duplication. No breaking change at all from this change.

"TextTrackList": {
"events": {
"event": [
Expand Down
10 changes: 7 additions & 3 deletions inputfiles/comments.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"mixins": {
"mixin": {
"DocumentOrShadowRoot": {
"methods": {
"method": {
"elementFromPoint": {
"comment": "Returns the element for the specified x coordinate and the specified y coordinate.\n@param x The x-offset\n@param y The y-offset"
}
}
},
"properties": {
"property": {
"styleSheets": {
Expand Down Expand Up @@ -752,9 +759,6 @@
"execCommand": {
"comment": "Executes a command on the current document, current selection, or the given range.\n@param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\n@param showUI Display the user interface, defaults to false.\n@param value Value to assign."
},
"elementFromPoint": {
"comment": "Returns the element for the specified x coordinate and the specified y coordinate.\n@param x The x-offset\n@param y The y-offset"
},
"write": {
"comment": "Writes one or more HTML expressions to a document in the specified window.\n@param content Specifies the text and HTML tags to write."
},
Expand Down
8 changes: 8 additions & 0 deletions inputfiles/removedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
}
},
"Document": {
"methods": {
"method": {
// Manually moved to DocumentOrShadowRoot
// See https://github.com/w3c/csswg-drafts/issues/5886 and https://github.com/w3c/csswg-drafts/issues/556
"elementFromPoint": null,
"elementsFromPoint": null
}
},
"implements": ["GeometryUtils"]
},
"Element": {
Expand Down

0 comments on commit d42f963

Please sign in to comment.