Skip to content

Conversation

@timmywil
Copy link
Member

@timmywil timmywil commented May 8, 2015

Fixes gh-2227

- Reverts behavior from 10399dd, which we never released.
  BR and inline elements are considered visible.
- The possibility of dropping .offsetWidth and .offsetHeight
  was debunked by this perf:
  http://jsperf.com/visible-hidden-and-getclientrects

Fixes jquerygh-2227
@gibson042
Copy link
Member

LGTM

@mgol
Copy link
Member

mgol commented May 9, 2015

Does it mean we might not be able to use fractional values for .css('width') and friends due to perf reasons?

@gibson042
Copy link
Member

I don't think so. .css is explicitly asking for style computation, as opposed to these selectors which should be as fast as possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to inline and reverse the logic from jQuery.expr.filters.visible() to save a func call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't noticed a perf loss and this way guarantees hidden and visible are opposites.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The browser probably does that anyway, and even if it does take another function call the DOM queries will be much more cruel.

@timmywil timmywil closed this in 79bcb29 May 12, 2015
timmywil added a commit that referenced this pull request May 12, 2015
- Reverts behavior from 10399dd, which we never released.
  BR and inline elements are considered visible.
- The possibility of dropping .offsetWidth and .offsetHeight
  was debunked by this perf:
  http://jsperf.com/visible-hidden-and-getclientrects

Fixes gh-2227
Close gh-2281
@timmywil timmywil deleted the 2227-visible branch May 12, 2015 14:08
timmywil added a commit that referenced this pull request Nov 10, 2015
- Reverts behavior from 10399dd, which we never released.
  BR and inline elements are considered visible.
- The possibility of dropping .offsetWidth and .offsetHeight
  was debunked by this perf:
  http://jsperf.com/visible-hidden-and-getclientrects

Fixes gh-2227
Close gh-2281
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

:visible/:hidden selectors unreliable

6 participants