mathiasbynens / jquery-details

World’s first <details>/<summary> polyfill™
https://mths.be/details
GNU General Public License v2.0
121 stars 34 forks source link

Fix wrapping of child `TextNode`s in jQuery 1.1x.x [fixes #16] #23

Closed bcjordan closed 9 years ago

bcjordan commented 9 years ago

This fixes hiding of non-wrapped TextNodes using jQuery 1.10+, which may be issue #16

.contents(':not("any-old-filter")') in jQuery > 1.9 happens to also filter out all non-wrapped TextNodes, while contents() and children() without filters specified leave all of them in. That caused the old $detailsNotSummaryContents to exclude the nodes that still needed <span> wrapping to hide properly.

jQ 1.9 (leaves in unwrapped nodes): http://codepen.io/anon/pen/MwQmVb jQ 1.10 (filters out unwrapped nodes): http://codepen.io/anon/pen/YXeVLJ

bcjordan commented 9 years ago

Ah, shoot, I see PR#18 handles this as well in a slightly different way. That one is less obtrusive so I'd prefer that one be merged.