Simplify maintenance

This commit is contained in:
Raymond Hill 2021-07-23 09:04:59 -04:00
parent c893f76c12
commit 63c5bd34dc
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 59 additions and 52 deletions

View File

@ -73,133 +73,133 @@
<h3>Tests</h3> <h3>Tests</h3>
<div id="pcf" class="tests"> <div id="pcf" class="tests">
<div id="a1" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a1 .fail:has(b)</code> <code> .fail:has(b)</code>
</div> </div>
<div id="a2" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a2 .fail:has(> a > b)</code> <code> .fail:has(> a > b)</code>
</div> </div>
<div id="a3" class="tile"> <div class="tile">
<div class="pass"><div class="fail"></div><a><b></b></a></div> <div class="pass"><div class="fail"></div><a><b></b></a></div>
<code>#pcf #a3 .fail:has(+ a > b)</code> <code> .fail:has(+ a > b)</code>
</div> </div>
<div id="a4" class="tile"> <div class="tile">
<div class="pass"><div class="fail"></div><a><b></b></a></div> <div class="pass"><div class="fail"></div><a><b></b></a></div>
<code>#pcf #a4 .fail:has(:scope + a > b)</code> <code> .fail:has(:scope + a > b)</code>
</div> </div>
<div id="a5" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a5 .fail:has(:is(.pass a > b))</code> <code> .fail:has(:is(.pass a > b))</code>
</div> </div>
<div id="a6" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a6 .fail:not(:has(c))</code> <code> .fail:not(:has(c))</code>
</div> </div>
<div id="a7" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div> <div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div>
<code>#pcf #a7 .fail:has-text(needle)</code> <code> .fail:has-text(needle)</code>
</div> </div>
<div id="a8" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div> <div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div>
<code>#pcf #a8 .fail:has-text(/NEEDLE/i)</code> <code> .fail:has-text(/NEEDLE/i)</code>
</div> </div>
<div id="a9" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div> <div class="pass"><div class="fail"><a><b>I am a needle!!!</b></a></div></div>
<code>#pcf #a9 .fail:not(:has-text(haystack))</code> <code> .fail:not(:has-text(haystack))</code>
</div> </div>
<div id="a10" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a10 .fail:matches-css(position: absolute)</code> <code> .fail:matches-css(position: absolute)</code>
</div> </div>
<div id="a11" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a11 .fail:has(a:matches-css-before(opacity: 0))</code> <code> .fail:has(a:matches-css-before(opacity: 0))</code>
</div> </div>
<div id="a12" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a12 .fail:has(b:matches-css-after(opacity: 0))</code> <code> .fail:has(b:matches-css-after(opacity: 0))</code>
</div> </div>
<div id="a13" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a13 .fail > a > b:nth-ancestor(2)</code> <code> .fail > a > b:nth-ancestor(2)</code>
</div> </div>
<div id="a14" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a14:xpath(.//b/../..)</code> <code>:xpath(.//b/../..)</code>
</div> </div>
<div id="a15" class="tile"> <div class="tile">
<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> <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>
<code>#pcf #a15 .fail:min-text-length(300)</code> <code> .fail:min-text-length(300)</code>
</div> </div>
<div id="a16" class="tile"> <div class="tile">
<div class="pass"><a><b></b></a><div class="fail"></div></div> <div class="pass"><a><b></b></a><div class="fail"></div></div>
<code>#pcf #a16 .pass > a:has(b) + .fail</code> <code> .pass > a:has(b) + .fail</code>
</div> </div>
<div id="a17" class="tile"> <div class="tile">
<div class="pass"><a><b></b></a><div class="fail"><a><b></b></a></div></div> <div class="pass"><a><b></b></a><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a17 .pass > a:has(b) + .fail:has(b)</code> <code> .pass > a:has(b) + .fail:has(b)</code>
</div> </div>
<div id="a18" class="tile"> <div class="tile watchattr1">
<div class="pass"><div class="pass"><a><b class="ok"></b></a></div></div> <div class="pass"><div class="pass"><a><b class="ok"></b></a></div></div>
<code>#pcf #a18 .pass:watch-attr(class) > .fail:has(b.notok)</code> <code> .pass:watch-attr(class) > .fail:has(b.notok)</code>
<script> <script>
self.setTimeout(( ) => self.setTimeout(( ) =>
{ {
document.querySelector('#a18 .pass > .pass').className = 'fail'; document.querySelector('.watchattr1 .pass > .pass').className = 'fail';
document.querySelector('#a18 .pass > .fail b.ok').className = 'notok'; document.querySelector('.watchattr1 .pass > .fail b.ok').className = 'notok';
}, },
500 500
); );
</script> </script>
</div> </div>
<div id="a19" class="tile"> <div class="tile">
<div class="pass"><div class="fail"></div><a></a><b></b></div> <div class="pass"><div class="fail"></div><a></a><b></b></div>
<code>#pcf #a19 .fail:has(+ a)</code> <code> .fail:has(+ a)</code>
</div> </div>
<div id="a20" class="tile"> <div class="tile">
<div class="pass"><div class="fail"></div><a><b></b></a></div> <div class="pass"><div class="fail"></div><a><b></b></a></div>
<code>#pcf #a20 .fail:has(~ a:has(b))</code> <code> .fail:has(~ a:has(b))</code>
</div> </div>
<div id="a21" class="tile"> <div class="tile">
<div class="pass"><div class="fail"></div><a><b></b></a></div> <div class="pass"><div class="fail"></div><a><b></b></a></div>
<code>#pcf #a21 .fail:remove()</code> <code> .fail:remove()</code>
</div> </div>
<div id="a22" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a22 b:upward(2)</code> <code> b:upward(2)</code>
</div> </div>
<div id="a23" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a23 b:upward(.fail)</code> <code> b:upward(.fail)</code>
</div> </div>
<div id="a24" class="tile"> <div class="tile">
<div class="pass"><div class="fail"><a><b></b></a></div></div> <div class="pass"><div class="fail"><a><b></b></a></div></div>
<code>#pcf #a24 b:upward(.fail):style(visibility: hidden !important)</code> <code> b:upward(.fail):style(visibility: hidden !important)</code>
</div> </div>
</div> </div>
@ -208,10 +208,17 @@
const hostname = self.location.hostname; const hostname = self.location.hostname;
const filters = []; const filters = [];
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
for ( const node of document.querySelectorAll('code') ) { 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;
const div = document.createElement('div'); const div = document.createElement('div');
div.textContent = `${hostname}#?#${node.textContent}`; div.textContent = `${hostname}#?#${filter}`;
fragment.appendChild(div); fragment.appendChild(div);
i += 1;
} }
const parent = document.querySelector('.filters'); const parent = document.querySelector('.filters');
while ( parent.lastElementChild !== null ) { while ( parent.lastElementChild !== null ) {