LeaVerou / prefixfree

Break free from CSS prefix hell!
http://projects.verou.me/prefixfree/
MIT License
3.83k stars 712 forks source link

[Bug] disabled property should apply after style appended #6131

Open Aqours opened 6 years ago

Aqours commented 6 years ago

disabled property should apply after style appended.

https://github.com/LeaVerou/prefixfree/blob/0d3d2a0e6656316f385cd1d57559a19bcbbf2c57/prefixfree.js#L77-L83

Fixed code:

 // style.disabled = link.disabled;
 style.setAttribute('data-href', link.getAttribute('href')); 

 if(link.id) style.id = link.id; 

 parent.insertBefore(style, link); 
 style.disabled = link.disabled; // after style appended, otherwise disabled is always false.
 parent.removeChild(link); 
jljr222 commented 5 years ago

Thank you for this fix, helped me with a project.