Skip to content
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

require-atomic-updates: document.title (false positive) #1320

Closed
Lonniebiz opened this issue Jul 8, 2019 · 2 comments
Closed

require-atomic-updates: document.title (false positive) #1320

Lonniebiz opened this issue Jul 8, 2019 · 2 comments

Comments

@Lonniebiz
Copy link

I'm using eslint 6.0.1 and believe I'm getting a false positive for the require-atomic-updates rule. Here's a code sample which reproduces the false-positive:

async function test()
{
	document.createElement("div");
	await Promise.resolve();
	document.title = "Test";
}
test();

The line document.title = "Test"; (above) produces this error:

Possible race condition: `document.title` might be reassigned based 
on an outdated value of `document.title`. (require-atomic-updates)

However, I noticed that if I change document.title to window.document.title the error goes away:

async function test()
{
	document.createElement("div");
	await Promise.resolve();
	window.document.title = "Test";
}
test();
@Lonniebiz Lonniebiz changed the title require-atomic-updates: document.title false positive require-atomic-updates: document.title (false positive) Jul 8, 2019
@Lonniebiz
Copy link
Author

Lonniebiz commented Jul 8, 2019

Sorry, I just realized that didn't post this issue where I intended. I've moved the issue here:
eslint/eslint#11967

@feross
Copy link
Member

feross commented Jul 10, 2019

Thanks for moving the issue to the correct repo!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants