jquery-migrate icon indicating copy to clipboard operation
jquery-migrate copied to clipboard

Warn about use of jQuery.style

Open dmethvin opened this issue 9 years ago • 6 comments

It's undocumented but that's never stopped anyone.

https://github.com/jquery/jquery/issues/2297

dmethvin avatar Mar 05 '16 15:03 dmethvin

:+1: Since it's not going anywhere before 3.1.0, though, it doesn't have to make it to Migrate 3.0.

mgol avatar Mar 05 '16 15:03 mgol

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.

dmethvin avatar Mar 29 '16 01:03 dmethvin

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.

dmethvin avatar Jul 12 '16 20:07 dmethvin

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

mgol avatar Jul 13 '16 06:07 mgol

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.

dmethvin avatar Jul 13 '16 12:07 dmethvin

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.

mgol avatar Jul 13 '16 12:07 mgol