mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: support hiding caret in case of matching style rule (#12172)
This commit is contained in:
parent
6ec00a9ae5
commit
c98d595bea
@ -133,11 +133,9 @@ export class Screenshotter {
|
||||
await frame.nonStallingEvaluateInExistingContext('(' + (function(disableAnimations: boolean) {
|
||||
const styleTag = document.createElement('style');
|
||||
styleTag.textContent = `
|
||||
*,
|
||||
* > *,
|
||||
* > * > *,
|
||||
* > * > * > *,
|
||||
* > * > * > * > * { caret-color: transparent !important; }
|
||||
*:not(#playwright-aaaaaaaaaa.playwright-bbbbbbbbbbb.playwright-cccccccccc.playwright-dddddddddd.playwright-eeeeeeeee) {
|
||||
caret-color: transparent !important;
|
||||
}
|
||||
`;
|
||||
document.documentElement.append(styleTag);
|
||||
const infiniteAnimationsToResume: Set<Animation> = new Set();
|
||||
|
||||
@ -34,6 +34,16 @@ it.describe('page screenshot', () => {
|
||||
|
||||
it('should not capture blinking caret', async ({ page, server }) => {
|
||||
await page.setContent(`
|
||||
<!-- Refer to stylesheet from other origin. Accessing this
|
||||
stylesheet rules will throw.
|
||||
-->
|
||||
<link rel=stylesheet href="${server.CROSS_PROCESS_PREFIX + '/injectedstyle.css'}">
|
||||
<!-- make life harder: define caret color in stylesheet -->
|
||||
<style>
|
||||
div {
|
||||
caret-color: #000 !important;
|
||||
}
|
||||
</style>
|
||||
<div contenteditable="true"></div>
|
||||
`);
|
||||
const div = page.locator('div');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user