Skip to content

Element which is not in page still :visible in IE8 #3043

@RobertMe

Description

@RobertMe

Hi,

I'm having an issue with the :visible/:hidden check giving the wrong result in IE8 when the element under test isn't in the page.

A simplified testcase is the following snippet: $('<div>Test</div>').is(':visible') In all browsers the result of this is false (because the element isn't in the page), except in IE8, for which it actually is true.

From what I've investigated it seems like the issue is the final return of the filterHidden function: https://github.com/jquery/jquery/blob/1.12-stable/src/css/hiddenVisibleSelectors.js#L19
I think this must check if the resulting node is a document fragment. If it is a fragment the element can't be visible, and the result must thus be true. And there may possibly be different node types which could be the parent while the element isn't actually in the page, for which the test also returns the wrong result.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions