-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pseudo-element anchors #213
Conversation
✅ Deploy Preview for anchor-position-wpt canceled.
|
✅ Deploy Preview for anchor-polyfill ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
b6c871c
to
cc71cfd
Compare
I updated the tests and fixed Currently all these changes add about 15ms to the polyfill (on the homepage, on my machine). It seem that the increase is only because of enabling I looked into WPT, the problem is that One unrelated WPT test started passing with these changes ( |
The pseudoelement tests are not using |
I'm not familiar with the WPT codebase, but could |
Yeah- there are some |
I think I didn't explain well. What I meant is: Is it possible to implement support for injecting <!DOCTYPE html>
<script>
await console.log('Hello') // throws
// Remove the injected script tag from the DOM.
document.currentScript.remove();
</script>
<title>Test</title>
<div id="element">Test</div>
<script>
test(() => {
assert_equals(element.textContent, 'Test');
}, 'Test');
</script> And with something like <!DOCTYPE html>
<title>Test</title>
<div id="element">Test</div>
<script type="module">
await console.log('Hello')
// Remove the injected script tag from the DOM.
document.currentScript.remove();
</script>
<script>
test(() => {
assert_equals(element.textContent, 'Test');
}, 'Test');
</script> This would solve our use case. A issue with this idea is that all tests would have to be converted to |
No- you explained well, on my second reading I realized I had misunderstood, but you got your response up first. To boil down the problem, the tests are running before the polyfill is complete. Ideally, we would add some delays for testing the polyfill that wouldn't impact non-polyfill tests. I don't think that adding an injected module script would be simple. We do have a few tools at our disposal-
But that also impacts non-polyfilled tests. @jgerigmeyer Do you have any thoughts on an analog to the |
@jamesnw Yeah, when we landed web-platform-tests/wpt#38442 we knew that there were a few WPTs that called |
I opened a PR on oddbird:wpt https://github.com/oddbird/wpt/pull/3/files that adds a test function which waits for the polyfill to run. It makes If this seems like it will fix this, I'll check with mfreed7 and work on upstreaming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is looking pretty good!
At some point, could you also open issues for the things we are not covering here- other pseudo elements like the file upload input button, or scrolling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions and minor suggestions, but this is looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! 🚀
@ayoreis I'm going to go ahead and merge this -- thanks! I think the only outstanding somewhat-related item I see is this, but it's not urgent/blocking:
|
TODO:
customPropsMapping
seems not to get populated.anchored1.offsetTop === 100
) but WPT reports0
, no tests went down.Performance does not seem worse (tested withconsole.time
consistently at ~110ms).Closes #208.