LibWeb: Update Selection.collapse algorithm

This commit is contained in:
HolonProduction 2024-09-02 14:03:45 +02:00 committed by Andreas Kling
commit 94230acf28
Notes: github-actions[bot] 2024-09-03 15:43:17 +00:00
3 changed files with 43 additions and 2 deletions

View file

@ -183,8 +183,8 @@ WebIDL::ExceptionOr<void> Selection::collapse(JS::GCPtr<DOM::Node> node, unsigne
return WebIDL::IndexSizeError::create(realm(), "Selection.collapse() with offset longer than node's length"_fly_string);
}
// 3. If node's root is not the document associated with this, abort these steps.
if (&node->root() != m_document.ptr())
// 3. If document associated with this is not a shadow-including inclusive ancestor of node, abort these steps.
if (!m_document->is_shadow_including_inclusive_ancestor_of(*node))
return {};
// 4. Otherwise, let newRange be a new range.