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

fix: ensure priority is set before calling the onchange callback #152

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LeahHirst
Copy link

fixes jsdom/jsdom#2649

The onChange callback is called prematurely when invoking setProperty with an important priority. This results in elements wrongly being assigned an inline style attribute value without !important. Setting multiple important properties in jsdom results in the last one assigned missing !important:

const el = document.createElement('div');
el.style.setProperty('opacity', '0', 'important');
el.style.setProperty('width', '0', 'important');
el.getAttribute('style'); // `opacity: 0 !important; width: 0;` 

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.

HTML is incorrect after using style.setProperty(n, v, 'important')
1 participant