SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
: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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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)
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理A
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书A
 
APNIC Updates presented by Paul Wilson at CaribNOG 27
APNIC Updates presented by Paul Wilson at  CaribNOG 27APNIC Updates presented by Paul Wilson at  CaribNOG 27
APNIC Updates presented by Paul Wilson at CaribNOG 27APNIC
 
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...musaddumba454
 
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样AS
 
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...ZurliaSoop
 
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookTOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookVarun Mithran
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfe-Market Hub
 
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样AS
 
一比一原版罗切斯特大学毕业证如何办理
一比一原版罗切斯特大学毕业证如何办理一比一原版罗切斯特大学毕业证如何办理
一比一原版罗切斯特大学毕业证如何办理F
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理F
 
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsrahman018755
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowIdeoholics
 
一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书A
 
Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Dewi Agency
 
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Dewi Agency
 
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理Fir
 
一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理F
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理apekaom
 

Kürzlich hochgeladen (20)

一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书
 
APNIC Updates presented by Paul Wilson at CaribNOG 27
APNIC Updates presented by Paul Wilson at  CaribNOG 27APNIC Updates presented by Paul Wilson at  CaribNOG 27
APNIC Updates presented by Paul Wilson at CaribNOG 27
 
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...
100^%)( POLOKWANE))(*((+27838792658))*))௹ )Abortion Pills for Sale in Sibasa,...
 
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样
一比一原版(毕业证书)新西兰怀特克利夫艺术设计学院毕业证原件一模一样
 
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
 
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookTOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdf
 
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样
 
一比一原版罗切斯特大学毕业证如何办理
一比一原版罗切斯特大学毕业证如何办理一比一原版罗切斯特大学毕业证如何办理
一比一原版罗切斯特大学毕业证如何办理
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
 
一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书
 
Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303
 
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
 
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理
一比一原版(TRU毕业证书)温哥华社区学院毕业证如何办理
 
一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
 

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