(element: DOMElement)
| 208 | * @param element - The DOM element |
| 209 | */ |
| 210 | const match = (element: DOMElement) => { |
| 211 | for (const child of element.childNodes) { |
| 212 | if (isDOMElement(child)) { |
| 213 | const hasNode = child.hasAttribute(DATA_EDITABLE_NODE) |
| 214 | const node = hasNode ? Editable.toEditorNode(editor, child) : null |
| 215 | if (node) { |
| 216 | if (Element.isElement(node)) { |
| 217 | if (editor.isVoid(node)) { |
| 218 | const rect = resetElementRect( |
| 219 | child.getBoundingClientRect(), |
| 220 | calculateElementHeight(child), |
| 221 | ) |
| 222 | compareHeight(rect) |
| 223 | } else if (editor.isInline(node)) { |
| 224 | const height = calculateElementHeight(child) |
| 225 | const rects = child.getClientRects() |
| 226 | for (let r = 0; r < rects.length; r++) { |
| 227 | const rect = resetElementRect(rects[r], height) |
| 228 | compareHeight(rect) |
| 229 | } |
| 230 | } else { |
| 231 | match(child) |
| 232 | } |
| 233 | } else { |
| 234 | const nodes = child.querySelectorAll( |
| 235 | `[${DATA_EDITABLE_STRING}], [${DATA_EDITABLE_COMPOSITION}], [${DATA_EDITABLE_ZERO_WIDTH}]`, |
| 236 | ) |
| 237 | nodes.forEach(node => { |
| 238 | const height = calculateElementHeight(node) |
| 239 | const rects = node.getClientRects() |
| 240 | for (let r = 0; r < rects.length; r++) { |
| 241 | const rect = resetElementRect(rects[r], height) |
| 242 | compareHeight(rect) |
| 243 | } |
| 244 | }) |
| 245 | } |
| 246 | } else { |
| 247 | match(child) |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | match(element) |
| 254 | return lineRect |
no test coverage detected
searching dependent graphs…