Ticket #12267 (closed feature: patchwelcome)
investigate Making “offset” and “dimensions” modules independent of “css” module
| Reported by: | rafael@… | Owned by: | mikesherov |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | build | Version: | 1.8.0 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
With the new modular jQuery 1.8.0, I was excited to be able to strip some bytes off.
Like most developers these days, I try to let CSS do as much work as possible when it comes to styling and transitions. I never use .css(), .show(), .hide() or .animate(). Instead, I handle state changes only by toggling classes and I use CSS transitions where needed.
Thus, I’d really like to be able to get rid of both the “effects” and “css” modules, because they are huge. I can drop the “effects” module without problems since no other module depends on it. It’s not the case for “css”, on which “offset” and “dimensions” depend. I still use these two often because they solve many browser inconsistencies.
I’m certainly not the only developer in this situation. It would be very pragmatic to make “offset” and “dimensions” independent of “css”.
Change History
comment:1 Changed 9 months ago by rwaldron
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to build
- Milestone changed from None to 1.next
comment:2 Changed 9 months ago by mikesherov
Well, it depends. The reason offset and dimensions are small is because of their dependence on CSS, not in spite of it. To make them independent likely requires plenty of duplicated code.
Sure, it's worth exploring, but I doubt very little will be done here.
comment:3 Changed 9 months ago by rwaldron
@mikesherov - gotcha. Thanks for the quick clarification. I'm definitely anti-code-duplication.
comment:4 Changed 9 months ago by dmethvin
If the properties we need in offset/dimensions are consistently available via elem.style or getComputedStyle and don't need any of the .css() workarounds, it doesn't seem like it would be a problem to have that small amount of duplication. I suspect we'd have to wait for 2.0 and oldIE to be off our backs though.
comment:5 Changed 9 months ago by mikesherov
- Owner set to mikesherov
- Status changed from open to assigned
- Summary changed from Make “offset” and “dimensions” modules independent of “css” module to investigate Making “offset” and “dimensions” modules independent of “css” module
comment:6 Changed 8 months ago by dmethvin
- Type changed from enhancement to feature
Bulk change from enhancement to feature.
comment:7 Changed 4 months ago by dmethvin
- Status changed from assigned to closed
- Resolution set to patchwelcome
I can see some places in offset.js where the new array getter for .css() would be handy, at least for reducing file size if not performance.
To the subject of the ticket, it looks to me like we should keep the css.js dependency here. If someone wants to refactor to avoid it we could review the patch.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This is definitely a reasonable request to explore for (maybe 1.8.x) 1.9