Bug Tracker

Ticket #13743 (closed feature: fixed)

Opened 19 months ago

Last modified 17 months ago

Remove jQuery.support.boxModel

Reported by: m_gol Owned by: m_gol
Priority: low Milestone: 1.10/2.0
Component: support Version: 2.0b2
Keywords: Cc:
Blocking: Blocked by:

Description

jQuery.support.boxModel has been deprecated since 1.3 (!), is there anything stopping us from removing it?

Saves 23 bytes in the minified & gzipped code.

Change History

comment:2 Changed 19 months ago by m_gol

It'll break compatibility with 1.9, though (in a very minor way, but still). I've read about soon 1.10 plans so I suspect there were some decision changes in the roadmap?

comment:3 Changed 19 months ago by Michał Gołębiowski

Ref #13743. Remove support.boxModel, deprecated 1.3. Close gh-1230.

Changeset: 1233fc77883c26eeeea4847f9f0b90e07d189b90

comment:4 Changed 19 months ago by m_gol

  • Owner set to m_gol
  • Status changed from new to assigned

comment:5 Changed 19 months ago by dmethvin

  • Milestone changed from None to 1.10

comment:6 Changed 19 months ago by m_gol

  • Priority changed from undecided to low

comment:7 Changed 19 months ago by m_gol

  • Component changed from unfiled to support

comment:8 Changed 18 months ago by m_gol

  • Milestone changed from 1.10 to 1.10/2.0

comment:9 Changed 18 months ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:10 Changed 17 months ago by anonymous

Umm, this is just wrong!!

jQuery.support.boxModel was NOT deprecated in v1.3

jQuery.boxModel is what was deprecated in v1.3...  http://api.jquery.com/jQuery.boxModel/

The jQuery.support() function with the boxModel test was never deprecated, and is in fact the example used to show how one uses jQuery.support() in your own API Documentation!!!  http://api.jquery.com/jQuery.support/

This needs to be corrected as jQuery.support.boxModel() is one of the new fallback methods developers are using to detect for old IE since $.browser is now gone!!!

comment:11 Changed 17 months ago by dmethvin

As the jQuery.support documentation says:

Since jQuery requires these tests internally, they must be performed on every page load. Although some of these properties are documented below, they are not subject to a long deprecation/removal cycle and may be removed once internal jQuery code no longer needs them.

We have not used either boxModel property for many releases.

comment:12 Changed 17 months ago by props

I definitely can't understand why $.support.boxModel has been removed in 1.10. Though this feature detection isn't used anymore in jQuery internal code, it still makes huge sense for user code, especially as the 1.x version remains for legacy browsers.

comment:13 Changed 17 months ago by dmethvin

jQuery never supported quirks mode. If you are using .boxModel you're already doing something that jQuery never supported. You can check document.compatMode === "BackCompat" if you want to know you're in quirks.

Would it help to have that in the jQuery Migrate plugin?

Last edited 17 months ago by dmethvin (previous) (diff)

comment:14 Changed 17 months ago by m_gol

@props I really don't understand what's the issue here. Are we supposed to support every little detail that has been introduced to jQuery codebase at any point in time? It's not feasible and it would seriously hamper any improvements.

It's not that we cut out any significant feature, too. Come on, the whole support.boxModel definition was one line of code, is it that hard to replicate it in your code if you really need it? I bet 99% people using jQuery didn't use that option (which is a good practice if you ask me).

Last edited 17 months ago by m_gol (previous) (diff)

comment:15 Changed 17 months ago by props

Thank you for your replies... I know of course this was not a key feature, and is easy to replace with the document.compatMode test. You may say all the developpers like you and me hate quirks mode, BUT unfortunately this is not always a choice. There are still many business apps to maintain that rely on old standards, and we can't help decide anything on this point. So yes, I often use .boxModel, as well as the (awful) $.browser... My aim is to be efficient, while keep on focusing on evolution, and that is your main idea too with the two branches. Imho the 1.x should then really keep this legendary efficiency... Anyway, having it in the migrate plugin would be a good idea. Thank you very much

comment:16 Changed 17 months ago by ajpiano

I tend to agree that if one of our goals with the Migrate plugin is to allow people to be ready to transition to 2.0 and otherwise warn about things we don't want people doing, warning when people access $.support in general, in addition to just boxModel, might be a good idea to add to Migrate.

Thoughts?

comment:17 Changed 17 months ago by dmethvin

I already created a ticket to add jQuery.support.boxModel to Migrate this morning.  https://github.com/jquery/jquery-migrate/issues/41

The problem with warning about any access to jQuery.support is that we use it legitimately inside jQuery, and any warning coming from inside jQuery itself will cause problems as far as spurious messages and user confusion.

Eventually all those properties will be broken off into their corresponding modules and don't even need to be exposed, and many won't be run until they're needed. That can prevent some expensive at-ready-time reflows.

There is already a docs ticket to make the message about jQuery.support more urgent.  https://github.com/jquery/api.jquery.com/issues/315

Removing the jQuery.support property is a possibility but would break code outside core that decided their own private feature detects should go there as well.

 https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.support.js#L188

 https://github.com/medialize/jQuery-contextMenu/blob/963af85f3efe31357aa918d0b7be966ca72de1f4/src/jquery.contextMenu.js#L22

If we eliminated internal uses we could fully warn on *any* use of jQuery.support and move the property to be handled and always warned by Migrate.

comment:18 Changed 17 months ago by dmethvin

Also, the jQuery Migrate plugin already *warns* about quirks mode. This new feature will generate a second warning about jQuery.support.boxModel and also restore the setting so the old code continues to work to some extent, although it's hard to say how well since we don't test with quirks so behavior isn't guaranteed across versions.

Note: See TracTickets for help on using tickets.