[webkit-changes] [WebKit/WebKit] aebf3a: [Remote Inspection] nth-child selectors may target...
Wenson Hsieh
noreply at github.com
Sat Apr 13 00:16:45 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: aebf3a2151c5d375c404747ae5090e255984cae5
https://github.com/WebKit/WebKit/commit/aebf3a2151c5d375c404747ae5090e255984cae5
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-04-12 (Fri, 12 Apr 2024)
Changed paths:
M Source/WebCore/page/ElementTargetingController.cpp
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm
A Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-5.html
Log Message:
-----------
[Remote Inspection] nth-child selectors may target the wrong element
https://bugs.webkit.org/show_bug.cgi?id=272612
rdar://126362427
Reviewed by Megan Gardner and Abrar Protyasha.
Currently, the `N` used for `nth-child(N)` selectors when extracting targeted elements represents
the Nth index of that element type; instead, it should represent the Nth element child relative to
the parent (regardless of type). Fix this bug by adjusting `parentRelativeSelectorRecursive`, and
add an API test to cover these cases.
* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::findChild):
(WebCore::parentRelativeSelectorRecursive):
(WebCore::childIndexByType): Deleted.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm:
(TestWebKitAPI::TEST(ElementTargeting, ParentRelativeSelectors)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-5.html: Added.
Canonical link: https://commits.webkit.org/277449@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list