views:

37

answers:

1

With jQuery 1.4.2, :hidden filter is not filtering out elements that were hidden, but i've made then visible by calling show(). Filter assumes it is still hidden.

Is this bug or am i missing something? Consider the following code:

$("td.ms-authoringcontrols > span[id*='_ParallelApprovers']:hidden:first").css("display")
"none"
$("td.ms-authoringcontrols > span[id*='_ParallelApprovers']:hidden:first").show()
Object
$("td.ms-authoringcontrols > span[id*='_ParallelApprovers']:hidden:first").css("display")
"inline" // ?? Let me scratch my head...
$("td.ms-authoringcontrols > span[id*='_ParallelApprovers']:hidden:first").is(":hidden")
true //element with "display:inline", visible in browser, but yet it is hidden

Instead of "inline", you would expect "none", because :hidden filter was used.

What it does is from an array of objects it selects first hidden element. Each time i call these lines of code, i expect them to select next hidden element (not the one i just showed).

+2  A: 

Your code would be correct assuming the .show() happened linearly. However .show() starts an animation that ends with the object being shown. If you would like to execute code after it has shown use the alternative form with a animation length and a callback .show(100,function(){}).

Jonathan Park
Thank you. When i specified animation length, it now works as expected.
Janis Veinbergs