SlideShare a Scribd company logo
1 of 31
Download to read offline
:has() prototyping
Byungwoo Lee
Igalia, in partnership with EyeO
Ad Blocker Dev Summit
October 2021
1
Index
1. :has() pseudo class?
2. Problems?
3. Approaches?
4. Progress and Remaining issues?
5. Plans to forward?
2
:has() pseudo class?
3
4 directions that exist in the
relationship between two elements
<div> parent/ancestor of #refrence

<div> previous sibling of #reference </div>

<div id=reference>

<div> child/descendant of #reference </div>

</div>

<div> next sibling of #reference </div>

</div>
4
Combinators provide 

downward directions only
<div> parent/ancestor of #refrence

<div> previous sibling of #reference </div>

<div id=reference>

<div> child/descendant of #reference <!-- #reference div -->
</div>

<div> next sibling of #reference <!-- #reference ~ div --> </d
</div>
5
:has() pseudo class provides 

upward directions
<div> parent/ancestor of #refrence <!-- div:has(#reference) -->

<div> previous sibling of #reference <!-- div:has(~ #reference
<div id=reference>

<div> child/descendant of #reference </div>

</div>

<div> next sibling of #reference </div>

</div>
6
With :has(), you can use all relationships
of a reference element
7
<div id=div1>

<div id=div2></div>

</div>

<div id=div3>

<div id=div4>

<div id=div5></div>

</div>

<div id=reference>

<div id=div6></div>

</div>

<div id=div7>

<div id=div8></div>

</div>

</div>

<div id=div9>

<div id=div10></div>

</div>
You can match all relationships
8
<div>

<div></div>

</div>

<div>

<div>

<div></div>

</div>

<div id=reference>

<div></div>

</div>

<div>

<div></div>

</div>

</div>

<div>

<div></div>

</div>
You can select all relationships
9
<div> div1

<div> div2 </div>

</div>

<div> div3

<div> div4

<div> div5 </div>

</div>

<div id=reference> reference

<div> div6 </div>

</div>

<div> div7

<div> div8 </div>

</div>

</div>

<div> div9

<div> div10 </div>

</div>
You can style all relationships
10
Problems?
11
Matching .a .b on #subject element
:has() matching is heavy operation
O(n) where n is the number of descendants
Matching .a:has(.b) on #subject element
12
:has() matching can be O(n²) 

for the nested subjects
document.querySelectorAll('.a:has(.b)')
13
Changing .a for .a .b may affect downward
:has() cannot be easily integrated 

with existing invalidation
Because DOM mutations affect opposite direction.

Changing .b for .a:has(.b) may affect upward
14
:has() can easily increase invalidation
complexity
Changing .b for .a:has(:is(b .c)) {}
15
The engine differences 

between Blink, Gecko and Webkit 

make things worse.
16
Approaches?
Separations of concerns
Breaking the large/complex problems down into distinct
sections,

Getting feasible solutions for each sections, 

Finding a way of combining and extending the
solutions.
17
Start prototyping in Chromium
first
18
Split problems per profile
Snapshot Profile Live Profile
Main
category
:has() selector matching problem :has() style invalidation problem
Problems O(n) argument matching overhead
O(n²) repetive argument matching
overhead
Matching with shadow boundary
crossing
...
Code complexity and maintenance
overhead
Risk of regression on existing
invalidation

(performance, stability, accuracy, ...)
Complex traversal cases
non-terminal :has()
:has(:has())
:has(:is())
:has(:is(:has()))
Invalidation with shadow boundary
crossing
...
19
Find possible solutions
:has() matching problem Solution
O(n) argument matching overhead No solution yet. (Keep :has() matching result?)
O(n²) repetitive argument matching overhead Cache :has() matching result
Matching with shadow boundary crossing
...
Need more investigation
20
Find possible solutions
:has() invalidation problem Solution
Code complexity and maintenance overhead Place limitations / Reuse existing invalidation
Risk of regression on existing invalidation 

(Performance, Stability, Accuracy, ...)
Separate :has upward traversal
Complex traversal : non-terminal :has()
invalidation
Schedule general(downward) invalidation 

after traversing upward
Complex traversal : :has(:has()) invalidation Project to the single :has() invalidation
problem
Complex traversal : :has(:is()) invalidation Reduce traversal complexity by reducing filtering
accuracy
21
Progress and 

remaining issues?
22
Investigate approaches
Explainer & Initial Designs:
Measuring Performance: 


Start prototyping in chromium.
Intent to Prototyping :
Chromium Bug :
Chrome Platform Status :
Position requests to other browser
Gecko :
WebKit :
https://github.com/Igalia/explainers/tree/main/css/has
https://css-has.glitch.me
https://groups.google.com/a/chromium.org/g/blink-dev/c/hqkcKdDrhXE
https://crbug.com/669058
https://chromestatus.com/feature/5794378545102848
https://github.com/mozilla/standards-positions/issues/528
https://www.mail-archive.com/webkit-dev@lists.webkit.org/msg30129.html
23
Prototyping progress (For snapshot profile)
What have done so far
Landed : Chromium (6 CLs) / WPT (3 PRs)
Support almost all :has() expressions (except related with shadow boundary crossing)
O(n²) repetitive argument matching
Propose a spec change : Remove :scope dependency from <relative selector> (
)


Need more investigations
O(n) argument matching
:has() matching with shadow boundary crossing
issue/6399
24
How to enable :has in snapshot profile
Enable experimental web platform features in the latest Chrome Dev (95.0.4608.0 ~)
Or pass the commandline flag CSSPseudoHasInSnapshotProfile
$ google-chrome-unstable --enable-blink-features=CSSPseudoHasInSnapshotProfile
25
Prototyping progress (For live profile)
Investigated (WIP)
Support invalidation for class selectors in argument : ,
Support invalidation for elemental selectors in argument :
Support invalidation for attribute selectors in argument :
Support nested :has() invalidation :
Support invalidation for :focus in argument :
Support non-terminal :has() invalidation :
Support invalidation for :has(:is()) case: 


Under discussion
Clarify possible limitations to balance coverage and complexity/performance impact

Start from the maximum limitations
Support :has() at terminal top-level compound
Support :has() argument starts with child or descendant combinator
Support only one compound in :has()
Support attribute/elemental selectors in :has()
https://crrev.com/c/3067100
https://crrev.com/c/3167634
https://crrev.com/c/3067024
https://crrev.com/c/3063755
https://crrev.com/c/3066704
https://crrev.com/c/3067025
https://crrev.com/c/3067024
https://crrev/c/2893774
https://github.com/Igalia/explainers/blob/main/css/has/invalidation-discussions.md
26
How to enable :has in live profile
pass the commandline feature flag CSSPseudoHas
$ google-chrome-unstable --enable-blink-features=CSSPseudoHas
27
This is what currently under discussion in
live profile
28
Plans to forward?
29
Plans for the remaining tasks
~ 2021.Q4
Initial :has() invalidation
Support :has() at terminal top-level compound
Support :has() argument starts with child or descendant combinator
Support only one compound in :has()
Support attribute/elemental selectors in :has() 


Not yet planned
:has() in live profile
Support complex selector in :has()
Support selector list in :has()
Support non-terminal :has()
Support :has() in logical combinations
Support :has() argument starts with ~ or +
Support pseudos in :has()
:has() in snapshot profile
O(n) argument matching overhead
:has() matching with shadow boundary crossing
:has() in other browsers ( :has seems to be in WebKit Radar 2022)
30
31

More Related Content

Similar to CSS :has The story so far and the path ahead

Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work EverywhereDoris Chen
 
Test-Driven Design Insights@DevoxxBE 2023.pptx
Test-Driven Design Insights@DevoxxBE 2023.pptxTest-Driven Design Insights@DevoxxBE 2023.pptx
Test-Driven Design Insights@DevoxxBE 2023.pptxVictor Rentea
 
WordCamp Thessaloniki2011 The NextWeb
WordCamp Thessaloniki2011 The NextWebWordCamp Thessaloniki2011 The NextWeb
WordCamp Thessaloniki2011 The NextWebGeorge Kanellopoulos
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworksYuri Visser
 
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia
 
III - Better angularjs
III - Better angularjsIII - Better angularjs
III - Better angularjsWebF
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartScott DeLoach
 
Changes and Bugs: Mining and Predicting Development Activities
Changes and Bugs: Mining and Predicting Development ActivitiesChanges and Bugs: Mining and Predicting Development Activities
Changes and Bugs: Mining and Predicting Development ActivitiesThomas Zimmermann
 
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQAFest
 
Basta! 2010 - VB6 Migration: Tips, Traps, and Techniques
Basta! 2010 - VB6 Migration: Tips, Traps, and TechniquesBasta! 2010 - VB6 Migration: Tips, Traps, and Techniques
Basta! 2010 - VB6 Migration: Tips, Traps, and TechniquesTraction Management s.r.l.
 
Grokking Techtalk #38: Escape Analysis in Go compiler
 Grokking Techtalk #38: Escape Analysis in Go compiler Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #38: Escape Analysis in Go compilerGrokking VN
 
JavaScript-based Visualization in R
JavaScript-based Visualization in RJavaScript-based Visualization in R
JavaScript-based Visualization in RFan Li
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureThoughtworks
 
solUI Introduction (2019)
solUI Introduction (2019)solUI Introduction (2019)
solUI Introduction (2019)Ramesh Nair
 

Similar to CSS :has The story so far and the path ahead (20)

HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
Lec18
Lec18Lec18
Lec18
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work Everywhere
 
Test-Driven Design Insights@DevoxxBE 2023.pptx
Test-Driven Design Insights@DevoxxBE 2023.pptxTest-Driven Design Insights@DevoxxBE 2023.pptx
Test-Driven Design Insights@DevoxxBE 2023.pptx
 
WordCamp Thessaloniki2011 The NextWeb
WordCamp Thessaloniki2011 The NextWebWordCamp Thessaloniki2011 The NextWeb
WordCamp Thessaloniki2011 The NextWeb
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworks
 
Word camp nextweb
Word camp nextwebWord camp nextweb
Word camp nextweb
 
Word camp nextweb
Word camp nextwebWord camp nextweb
Word camp nextweb
 
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
 
III - Better angularjs
III - Better angularjsIII - Better angularjs
III - Better angularjs
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
 
Changes and Bugs: Mining and Predicting Development Activities
Changes and Bugs: Mining and Predicting Development ActivitiesChanges and Bugs: Mining and Predicting Development Activities
Changes and Bugs: Mining and Predicting Development Activities
 
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
 
Basta! 2010 - VB6 Migration: Tips, Traps, and Techniques
Basta! 2010 - VB6 Migration: Tips, Traps, and TechniquesBasta! 2010 - VB6 Migration: Tips, Traps, and Techniques
Basta! 2010 - VB6 Migration: Tips, Traps, and Techniques
 
DCI with groovy
DCI with groovyDCI with groovy
DCI with groovy
 
Grokking Techtalk #38: Escape Analysis in Go compiler
 Grokking Techtalk #38: Escape Analysis in Go compiler Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #38: Escape Analysis in Go compiler
 
JavaScript-based Visualization in R
JavaScript-based Visualization in RJavaScript-based Visualization in R
JavaScript-based Visualization in R
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary Architecture
 
solUI Introduction (2019)
solUI Introduction (2019)solUI Introduction (2019)
solUI Introduction (2019)
 

More from Igalia

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 

More from Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 

Recently uploaded

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 

Recently uploaded (20)

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 

CSS :has The story so far and the path ahead

  • 1. :has() prototyping Byungwoo Lee Igalia, in partnership with EyeO Ad Blocker Dev Summit October 2021 1
  • 2. Index 1. :has() pseudo class? 2. Problems? 3. Approaches? 4. Progress and Remaining issues? 5. Plans to forward? 2
  • 4. 4 directions that exist in the relationship between two elements <div> parent/ancestor of #refrence <div> previous sibling of #reference </div> <div id=reference> <div> child/descendant of #reference </div> </div> <div> next sibling of #reference </div> </div> 4
  • 5. Combinators provide downward directions only <div> parent/ancestor of #refrence <div> previous sibling of #reference </div> <div id=reference> <div> child/descendant of #reference <!-- #reference div --> </div> <div> next sibling of #reference <!-- #reference ~ div --> </d </div> 5
  • 6. :has() pseudo class provides upward directions <div> parent/ancestor of #refrence <!-- div:has(#reference) --> <div> previous sibling of #reference <!-- div:has(~ #reference <div id=reference> <div> child/descendant of #reference </div> </div> <div> next sibling of #reference </div> </div> 6
  • 7. With :has(), you can use all relationships of a reference element 7
  • 8. <div id=div1> <div id=div2></div> </div> <div id=div3> <div id=div4> <div id=div5></div> </div> <div id=reference> <div id=div6></div> </div> <div id=div7> <div id=div8></div> </div> </div> <div id=div9> <div id=div10></div> </div> You can match all relationships 8
  • 10. <div> div1 <div> div2 </div> </div> <div> div3 <div> div4 <div> div5 </div> </div> <div id=reference> reference <div> div6 </div> </div> <div> div7 <div> div8 </div> </div> </div> <div> div9 <div> div10 </div> </div> You can style all relationships 10
  • 12. Matching .a .b on #subject element :has() matching is heavy operation O(n) where n is the number of descendants Matching .a:has(.b) on #subject element 12
  • 13. :has() matching can be O(n²) for the nested subjects document.querySelectorAll('.a:has(.b)') 13
  • 14. Changing .a for .a .b may affect downward :has() cannot be easily integrated with existing invalidation Because DOM mutations affect opposite direction. Changing .b for .a:has(.b) may affect upward 14
  • 15. :has() can easily increase invalidation complexity Changing .b for .a:has(:is(b .c)) {} 15
  • 16. The engine differences between Blink, Gecko and Webkit make things worse. 16
  • 17. Approaches? Separations of concerns Breaking the large/complex problems down into distinct sections, Getting feasible solutions for each sections, Finding a way of combining and extending the solutions. 17
  • 18. Start prototyping in Chromium first 18
  • 19. Split problems per profile Snapshot Profile Live Profile Main category :has() selector matching problem :has() style invalidation problem Problems O(n) argument matching overhead O(n²) repetive argument matching overhead Matching with shadow boundary crossing ... Code complexity and maintenance overhead Risk of regression on existing invalidation (performance, stability, accuracy, ...) Complex traversal cases non-terminal :has() :has(:has()) :has(:is()) :has(:is(:has())) Invalidation with shadow boundary crossing ... 19
  • 20. Find possible solutions :has() matching problem Solution O(n) argument matching overhead No solution yet. (Keep :has() matching result?) O(n²) repetitive argument matching overhead Cache :has() matching result Matching with shadow boundary crossing ... Need more investigation 20
  • 21. Find possible solutions :has() invalidation problem Solution Code complexity and maintenance overhead Place limitations / Reuse existing invalidation Risk of regression on existing invalidation (Performance, Stability, Accuracy, ...) Separate :has upward traversal Complex traversal : non-terminal :has() invalidation Schedule general(downward) invalidation after traversing upward Complex traversal : :has(:has()) invalidation Project to the single :has() invalidation problem Complex traversal : :has(:is()) invalidation Reduce traversal complexity by reducing filtering accuracy 21
  • 23. Investigate approaches Explainer & Initial Designs: Measuring Performance: Start prototyping in chromium. Intent to Prototyping : Chromium Bug : Chrome Platform Status : Position requests to other browser Gecko : WebKit : https://github.com/Igalia/explainers/tree/main/css/has https://css-has.glitch.me https://groups.google.com/a/chromium.org/g/blink-dev/c/hqkcKdDrhXE https://crbug.com/669058 https://chromestatus.com/feature/5794378545102848 https://github.com/mozilla/standards-positions/issues/528 https://www.mail-archive.com/webkit-dev@lists.webkit.org/msg30129.html 23
  • 24. Prototyping progress (For snapshot profile) What have done so far Landed : Chromium (6 CLs) / WPT (3 PRs) Support almost all :has() expressions (except related with shadow boundary crossing) O(n²) repetitive argument matching Propose a spec change : Remove :scope dependency from <relative selector> ( ) Need more investigations O(n) argument matching :has() matching with shadow boundary crossing issue/6399 24
  • 25. How to enable :has in snapshot profile Enable experimental web platform features in the latest Chrome Dev (95.0.4608.0 ~) Or pass the commandline flag CSSPseudoHasInSnapshotProfile $ google-chrome-unstable --enable-blink-features=CSSPseudoHasInSnapshotProfile 25
  • 26. Prototyping progress (For live profile) Investigated (WIP) Support invalidation for class selectors in argument : , Support invalidation for elemental selectors in argument : Support invalidation for attribute selectors in argument : Support nested :has() invalidation : Support invalidation for :focus in argument : Support non-terminal :has() invalidation : Support invalidation for :has(:is()) case: Under discussion Clarify possible limitations to balance coverage and complexity/performance impact Start from the maximum limitations Support :has() at terminal top-level compound Support :has() argument starts with child or descendant combinator Support only one compound in :has() Support attribute/elemental selectors in :has() https://crrev.com/c/3067100 https://crrev.com/c/3167634 https://crrev.com/c/3067024 https://crrev.com/c/3063755 https://crrev.com/c/3066704 https://crrev.com/c/3067025 https://crrev.com/c/3067024 https://crrev/c/2893774 https://github.com/Igalia/explainers/blob/main/css/has/invalidation-discussions.md 26
  • 27. How to enable :has in live profile pass the commandline feature flag CSSPseudoHas $ google-chrome-unstable --enable-blink-features=CSSPseudoHas 27
  • 28. This is what currently under discussion in live profile 28
  • 30. Plans for the remaining tasks ~ 2021.Q4 Initial :has() invalidation Support :has() at terminal top-level compound Support :has() argument starts with child or descendant combinator Support only one compound in :has() Support attribute/elemental selectors in :has() Not yet planned :has() in live profile Support complex selector in :has() Support selector list in :has() Support non-terminal :has() Support :has() in logical combinations Support :has() argument starts with ~ or + Support pseudos in :has() :has() in snapshot profile O(n) argument matching overhead :has() matching with shadow boundary crossing :has() in other browsers ( :has seems to be in WebKit Radar 2022) 30
  • 31. 31