You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:visible & :hidden which are jQuery selector extensions defined in src/css/hiddenVisibleSelectors.js. :hidden is defined as a negation of :visible so we can focus on the latter. And browsers differ here:
Chrome 76, Safari 12.1 & Edge 18 match 0 elements for :visible
Firefox 68 matches 2 elements. Its results for those two:
From a quick look at the CSSOM spec, all three properties (offsetWidth, offsetHeight & getClientRects) are expressed in terms of CSS layout box which has a note in the spec:
ISSUE 1 The terms CSS layout box and SVG layout box are not currently defined by CSS or SVG.
It is an inconsistency, but I don't know that we should solve it. Lots of elements default to not having layout (<meta>, <style>, <template>, etc.), and in some cases that can be overridden. For example, <style> elements can have display: block, and—especially relevant here—<option>s in a <select multiple> really do take up space.
I think the right approach here is to push for a fix in Firefox, acknowledge that IE is just wrong, and add documentation recommending increased caution when using :hidden and :visible.
From jquery/jquery#4463 (comment) by me:
:visible
&:hidden
which are jQuery selector extensions defined in src/css/hiddenVisibleSelectors.js.:hidden
is defined as a negation of:visible
so we can focus on the latter. And browsers differ here::visible
:visible
. The results are not affected bydisplay: none
:getClientRects()
has all properties set to0
.The test case for the results I provided above: https://output.jsbin.com/bawosuv
From jquery/jquery#4463 (comment) by me:
From a quick look at the CSSOM spec, all three properties (
offsetWidth
,offsetHeight
&getClientRects
) are expressed in terms of CSS layout box which has a note in the spec:That indicates we're in a gray area here.
From jquery/jquery#4463 (comment) by @gibson042:
It is an inconsistency, but I don't know that we should solve it. Lots of elements default to not having layout (
<meta>
,<style>
,<template>
, etc.), and in some cases that can be overridden. For example,<style>
elements can havedisplay: block
, and—especially relevant here—<option>
s in a<select multiple>
really do take up space.I think the right approach here is to push for a fix in Firefox, acknowledge that IE is just wrong, and add documentation recommending increased caution when using
:hidden
and:visible
.Issue reported in Firefox's bug tracker at https://bugzilla.mozilla.org/show_bug.cgi?id=1584752.
The text was updated successfully, but these errors were encountered: