jquery-migrate
jquery-migrate copied to clipboard
Warn about use of jQuery.style
It's undocumented but that's never stopped anyone.
https://github.com/jquery/jquery/issues/2297
:+1: Since it's not going anywhere before 3.1.0, though, it doesn't have to make it to Migrate 3.0.
Since it's hard to detect which usages are inside jQuery core itself, I am thinking we want to defer this until jQuery core is refactored. Then we can put in a shim to add jQuery.style back in Migrate.
I removed the milestone because this isn't really possible until we refactor to remove any internal uses of jQuery.style. Otherwise it will give warnings due to jQuery's own use. In some minor jQuery 3.x release we should refactor the code but will need to leave jQuery.style exposed at least until 4.0.
Technically we're in the clear as jQuery.style is undocumented, we've hidden some undocumented APIs in 1.12/2.2. Do you think it might be used too much?
Michał Gołębiowski
Each time jQuery.style is called we'd generate a warning. Even if nobody outside jQuery calls it, our internal calls would mean the warning is generated. We could do like we've done before and pre-hook the methods where we know jQuery calls it internally, then set a flag saying the next call should not warn, but that's really messy IMO. It would be nicer to refactor jQuery to use an internal function and only expose it until the next major.
I agree that Migrate can't warn about it as long as we use it internally. I only said that we can remove this method earlier than in jQuery 4.0 as it's undocumented.