opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

Custom namespaces for jQuery mobile attributes do not work #44

Closed jupiterplanet closed 12 years ago

jupiterplanet commented 12 years ago

I have defined a custom namespace for data-attributes (http://jquerymobile.com/test/docs/api/globalconfig.html) by binding to the mobileinit event in order to use e. g. data-jqm-role instead of data-role. With rc2 all namespaced data-attributes don't seem to be recognized.

See the jsFiddle at http://jsfiddle.net/jupiter/bmBHN/4/.

Change jquery-mobile-angular-adapter-1.0.7-rc2.js to jquery-mobile-angular-adapter-1.0.7-rc1.js to see it work with rc1.

I have used jquery mobile 1.1.0 and AngularJS 1.0.0rc9.

jupiterplanet commented 12 years ago

I think I have tracked down some lines of code which cause the problem:

234 var roleAttr = tAttrs.role;
291 var roleAttr = tAttrs["role"];
332 widgetDirective.scope = (tAttrs.role == 'page' || tAttrs.role == 'dialog');

When I change these three lines to

234 var roleAttr = tAttrs[$.mobile.nsNormalize('role')];
291 var roleAttr = tAttrs[$.mobile.nsNormalize('role')];
332 widgetDirective.scope = (tAttrs[$.mobile.nsNormalize('role')] == 'page' || tAttrs[$.mobile.nsNormalize('role')] == 'dialog');

it partially works. However, patching jqm widgets still doesn't work, e.g. the rendering of listview only works without namespace. So far, I couldn't find the reason.

tbosch commented 12 years ago

Updated jsfiddle with current libs: http://jsfiddle.net/tigbro/bmBHN/6/ jqm 1.1.0 angular 1.0.1 jquery 1.7.1