jquery/jquery-mobile — Issue #2813: .children() vs .find()
Author: jshepler
Created: 2011-10-22 17:27:30+00:00
State: open

Since .children() only searches 1 level down (immediate children), using it to reference the different sections of a page (header, content, footer) requires those sections to be immediate children of the page container.

Would it not be better (i.e. less restrictive) to use .find() instead?

This came up because I want to use asp.net master pages. The form control is on the master page (template), not the content pages. If the jQM page container is inside the form control, subsequent postbacks go to the incorrect handler. My workaround was to put the form tag inside the jQM page container so that it would be current with the displayed page.

However, doing so then stopped fixed toolbars from working because jQM uses .children() off the page container instead of .find(). When I changed the code (1.0rc2, lines 6481 and 6511) to use .find(), it worked just fine and I didn't notice anything "bad" happening as a result.

I could not put the form tag inside the content container because my header/footer sections also need to trigger postbacks (and asp.net only allows one form).