Skip to content

Conversation

@JoelEinbinder
Copy link
Contributor

@JoelEinbinder JoelEinbinder commented Nov 10, 2017

This makes "visible" work recursively. visibility: hidden is inherited, and any element inside of something with display: none will have no width/height. This will give a false negative on an element with display: block; position: absolute; top:0; left:0; right:0; bottom:0; overflow: visible and child elements.

test/test.js Outdated
let divHidden = false;
await page.setContent(`<div style='display: block;'></div>`);
const waitForSelector = page.waitForSelector('div', {hidden: true}).then(() => divHidden = true);
await page.evaluate('1'); // do a round trip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests would always pass because they checked divHidden in the same microtask as it was assigned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(await page.waitForSelector('div')).toBe(true);

test/test.js Outdated
let divHidden = false;
await page.setContent(`<div style='display: block;'></div>`);
const waitForSelector = page.waitForSelector('div', {hidden: true}).then(() => divHidden = true);
await page.evaluate('1'); // do a round trip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(await page.waitForSelector('div')).toBe(true);

@aslushnikov aslushnikov merged commit f8d19e7 into puppeteer:master Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants