Need a way to tell the framework not to enhance any markup in a specific container #3154

Closed
jblas opened this Issue Nov 23, 2011 · 5 comments

Comments

Projects
None yet
2 participants
@jblas
Contributor

jblas commented Nov 23, 2011

As of jQuery Mobile 1.0, the entire markup within a page is scanned for elements to be enhanced. This is problematic for 3rd party widgets/libraries that don't want anybody enhancing their markup or attaching behavior. We need some data-* attribute that we can place on an element container that tells the framework not to enhance anything inside it.

There is a potential performance problem here since this means all components that do enhancement must first look up the ancestor hierarchy to see if the element they are about to enhance falls under one of these special containers. @toddparker and I were discussing this and he suggested that perhaps we only pay this cost if a configuration flag is turned on ... that is support for this special attribute would only be available if the user knowingly turned it on and was willing to pay the price. When implementing this feature, keep in mind that we may want to avoid using $.fn.closest() and instead crawl the ancestor hierarchy manually since it is much faster.

@ghost ghost assigned johnbender Nov 23, 2011

@johnbender johnbender closed this in 0a2744f Feb 8, 2012

@johnbender johnbender reopened this Feb 8, 2012

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Feb 8, 2012

Contributor

Controlgroup and Page still need alterations to respect data-enhance=false.

Contributor

johnbender commented Feb 8, 2012

Controlgroup and Page still need alterations to respect data-enhance=false.

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Feb 17, 2012

Contributor

Stuff still left to deal with:

jquery.mobile.grid.js
jquery.mobile.fieldContain.js
jquery.mobile.links.js
jquery.mobile.page.sections.js

Contributor

johnbender commented Feb 17, 2012

Stuff still left to deal with:

jquery.mobile.grid.js
jquery.mobile.fieldContain.js
jquery.mobile.links.js
jquery.mobile.page.sections.js

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Feb 17, 2012

Contributor

@toddparker @jblas

So I stopped to think about making this alteration to the various $.fn plugins. In the same way it doesn't make sense (to me at least) to just exclude elements from widget enhancement implicitly by adding logic to our _createWidget decoration, it doesn't make sense for someone to call $("foo").controlgroup() and only have some of the elements enhance without an obvious reason why.

Instead I've added $.fn.jqmEnhanceable (open to naming suggestions) as a collection pruning method so that wherever these fluent helpers are called it will be obvious where to look for the exclusion logic.

$("foo").jqmEnhanceable().buttonMarkup();

I'm going under the assumption that I should add these to all the callsites of all the plugins internally because these data-enhance false containers could live inside widget markup that might contain something that requires buttonMarkup.

Contributor

johnbender commented Feb 17, 2012

@toddparker @jblas

So I stopped to think about making this alteration to the various $.fn plugins. In the same way it doesn't make sense (to me at least) to just exclude elements from widget enhancement implicitly by adding logic to our _createWidget decoration, it doesn't make sense for someone to call $("foo").controlgroup() and only have some of the elements enhance without an obvious reason why.

Instead I've added $.fn.jqmEnhanceable (open to naming suggestions) as a collection pruning method so that wherever these fluent helpers are called it will be obvious where to look for the exclusion logic.

$("foo").jqmEnhanceable().buttonMarkup();

I'm going under the assumption that I should add these to all the callsites of all the plugins internally because these data-enhance false containers could live inside widget markup that might contain something that requires buttonMarkup.

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Feb 18, 2012

Contributor

All that's left, barring a @scottjehl injunction on the whole explicit/implicit business, is the documentation of data-enhance=false and $.fn.jqmEnhanceable.

Contributor

johnbender commented Feb 18, 2012

All that's left, barring a @scottjehl injunction on the whole explicit/implicit business, is the documentation of data-enhance=false and $.fn.jqmEnhanceable.

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Feb 21, 2012

Contributor

docs are in, closing.

Contributor

johnbender commented Feb 21, 2012

docs are in, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment