2019-06-22 16:00:25 +02:00
<!DOCTYPE html>
< html >
< head >
2019-06-22 22:41:42 +02:00
< meta charset = "utf-8" >
2019-06-23 14:05:28 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
2019-06-22 16:00:25 +02:00
< title > Procedural cosmetic filters< / title >
< style >
.filters {
font-family: monospace;
white-space: pre;
}
.tests {
align-items: flex-start;
display: flex;
flex-wrap: wrap;
}
.tile {
display: inline-flex;
flex-direction: column;
margin: 0 20px 10px 0;
min-width: 200px;
}
.tile div {
align-items: center;
color: white;
display: flex;
justify-content: center;
}
.tile > div {
2019-06-22 22:41:42 +02:00
height: 50px;
2019-06-22 16:00:25 +02:00
position: relative;
}
.tile > div > div {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
2019-06-22 18:13:27 +02:00
.tile > code {
align-self: center;
}
2019-06-22 16:00:25 +02:00
.pass {
background-color: green;
}
.pass::before {
content: 'pass';
}
.fail {
background-color: red;
}
.fail::before {
content: 'fail';
}
2019-06-22 16:19:36 +02:00
.tests a, .tests b {
2019-06-22 16:00:25 +02:00
display: none;
}
2019-06-22 16:19:36 +02:00
.tests a::before {
2019-06-22 16:00:25 +02:00
opacity: 0;
}
2019-06-22 16:19:36 +02:00
.tests b::after {
2019-06-22 16:00:25 +02:00
opacity: 0;
}
< / style >
< / head >
< body >
< h1 > Procedural cosmetic filters< / h1 >
2019-06-22 16:19:36 +02:00
< p > < a href = "./." > Back< / a >
< br > < br > < / p >
2019-06-22 16:00:25 +02:00
< h3 > Filters< / h3 >
< div class = "filters" > < noscript > Enable JavaScript to see needed filters< / noscript > < / div >
< h3 > Tests< / h3 >
< div id = "pcf" class = "tests" >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-22 16:00:25 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(b)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-22 16:00:25 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(> a > b)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < / div > < a > < b > < / b > < / a > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(+ a > b)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < / div > < a > < b > < / b > < / a > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(:scope + a > b)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(:is(.pass a > b))< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:not(:has(c))< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > I am a needle!!!< / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has-text(needle)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > I am a needle!!!< / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has-text(/NEEDLE/i)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > I am a needle!!!< / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:not(:has-text(haystack))< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-22 16:00:25 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:matches-css(position: absolute)< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-22 16:00:25 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(a:matches-css-before(opacity: 0))< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(b:matches-css-after(opacity: 0))< / code >
2019-06-22 16:00:25 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail > a > b:nth-ancestor(2)< / code >
2019-06-22 18:13:27 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > :xpath(.//b/../..)< / code >
2019-06-22 18:13:27 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < div class = "fail" > < a > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna< b > aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.< / b > Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.< / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:min-text-length(300)< / code >
2021-07-23 14:39:23 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < a > < b > < / b > < / a > < div class = "fail" > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .pass > a:has(b) + .fail< / code >
2021-07-23 14:39:23 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2021-07-23 14:39:23 +02:00
< div class = "pass" > < a > < b > < / b > < / a > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .pass > a:has(b) + .fail:has(b)< / code >
2021-07-23 14:39:23 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile watchattr1" >
2019-06-22 22:41:42 +02:00
< div class = "pass" > < div class = "pass" > < a > < b class = "ok" > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > .pass:watch-attr(class) > .fail:has(b.notok)< / code >
2019-06-22 22:41:42 +02:00
< script >
self.setTimeout(( ) =>
{
2021-07-23 15:04:59 +02:00
document.querySelector('.watchattr1 .pass > .pass').className = 'fail';
document.querySelector('.watchattr1 .pass > .fail b.ok').className = 'notok';
2019-06-22 22:41:42 +02:00
},
500
);
< / script >
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-29 17:40:10 +02:00
< div class = "pass" > < div class = "fail" > < / div > < a > < / a > < b > < / b > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(+ a)< / code >
2019-06-29 17:40:10 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2019-06-29 20:07:54 +02:00
< div class = "pass" > < div class = "fail" > < / div > < a > < b > < / b > < / a > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:has(~ a:has(b))< / code >
2019-06-29 17:40:10 +02:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2020-03-07 20:25:06 +01:00
< div class = "pass" > < div class = "fail" > < / div > < a > < b > < / b > < / a > < / div >
2021-07-23 15:04:59 +02:00
< code > .fail:remove()< / code >
2020-03-07 20:25:06 +01:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2020-03-07 20:25:06 +01:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > b:upward(2)< / code >
2020-03-07 20:25:06 +01:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2020-03-07 20:25:06 +01:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > b:upward(.fail)< / code >
2020-03-07 20:25:06 +01:00
< / div >
2021-07-23 15:04:59 +02:00
< div class = "tile" >
2020-09-05 15:58:54 +02:00
< div class = "pass" > < div class = "fail" > < a > < b > < / b > < / a > < / div > < / div >
2021-07-23 15:04:59 +02:00
< code > b:upward(.fail):style(visibility: hidden !important)< / code >
2020-09-05 15:58:54 +02:00
< / div >
2019-06-22 16:00:25 +02:00
< / div >
< script >
const hostname = self.location.hostname;
const filters = [];
const fragment = document.createDocumentFragment();
2021-07-23 15:04:59 +02:00
let i = 1;
for ( const tile of document.querySelectorAll('.tile') ) {
const id = `a${i}`;
tile.id = id;
const code = tile.querySelector('code');
const filter = `#pcf #${id}${code.textContent}`;
code.textContent = filter;
2019-06-22 16:00:25 +02:00
const div = document.createElement('div');
2021-07-23 15:04:59 +02:00
div.textContent = `${hostname}#?#${filter}`;
2019-06-22 16:00:25 +02:00
fragment.appendChild(div);
2021-07-23 15:04:59 +02:00
i += 1;
2019-06-22 16:00:25 +02:00
}
const parent = document.querySelector('.filters');
while ( parent.lastElementChild !== null ) {
parent.removeChild(parent.lastElementChild);
}
parent.appendChild(fragment);
< / script >
< / body >
< / html >