In IE6 and IE7, the following results in an empty jQuery selector being returned: $("form[name='formname']")
I tried matching on other attributes of my form such as: $("form[method='post']") which works without any problems.
It seems that the only situation that does not work is when trying to match the name attribute on forms. I am guessing this is just a browser bug/limitation but is it something jQuery could potentially work around? Any odd solutions out there other than just not doing it that way? I just would prefer matching forms by name for certain situations since it makes the most sense semantically in many cases for me. Would love to know the reason why this happens. Thanks everyone!
EDIT: Found this bug first in jQuery 1.4.4 but forgot about it at the time until it just came up again which I replicated in version 1.5.2 and then again when I upgraded to test in version 1.6.4.
When you create a nested list, the sub-pages it creates are nicely auto-generated but I'm having difficulties controlling the styling of these pages since none of the parent page's properties seem to inherit. Specifically I want to change the pages' "header" theme. If, on my main page where the nested list is located, I use a header of:
<div data-role="header" data-theme="e">
I was expecting that all auto-generated sub-pages from nested lists would inherit and apply the same header theme to each page but instead it always defaults to the blue theme (theme "b"). In the source of the listview widget, it has an option named "headerTheme" with a default of "b" which is where it gets it... but it doesn't seem like there's actually a way to override this default at all. Has anyone ever been able to use any non-blue theme on a nested list's sub-page header and how??
I run a few apps for clients and have just a single jQM css file I use with custom themes setup in it. I prefer naming things semantically so for a purple theme I named the classes with "-purple" i.e - ".ui-btn-up-purple". And obviously to use it, I just change the data-theme value to "purple" where appropriate.
Everything works fine except when controls are automatically generated such as the header and the back/home buttons that can be added. Let's say on one of my pages I have the following header:
When the anchor tag gets transformed automatically by jQM into a button, it adds the class "ui-btn-up-p" and sets the data-theme property to "p" so basically it truncates all but the first letter of the theme it inherits. The short term fix for me is just naming things by single letter only (so changing "-purple" to just "-p") so it all plays nice but don't see any reason why this should be doing this especially for flexible, semantic layouts.
In jQM alpha 2, the selectmenu widget for creating nice select boxes was basically unusable to me because it contained really bad bugs that caused javascript errors with the hashtag page tracking and had a lot of display bugs as well. Specifically the biggest issue was when you had a select box with several option items... it creates a full-sized page that acts as a dialog to display the option menus as opposed to when the list is short and it generates an overlay on the same active page. My original post of the problem is located at:
So I just upgraded to jQM alpha 3 since I heard it may have solved the issue and while it doesn't have random display issues and doesn't trigger javascript errors, it still is completely broken. Looking for someone else to verify this as well to make sure somehow it isn't just me or maybe there's some known information on this already. I created a test page off of my root application page and added a select box with several menu items so that it will create a dialog page to display them. I click the select box and it opens the large dialog with my options... click an option or just click the X to close the window without making a selection... then click back on the browser... blank page. Try clicking forward... blank page. I really don't think it's just me but this is a really, really bad bug because if that's the case then the select menu widget is again just unusable at all in its current state. It doesn't even seem like anyone tested it since it's such an obvious bug that I found within the first minute of testing it out. Anyone have any insight here? Thanks!!
I was looking into theming a bit more and noticed that if I inner wrap my entire page container (data-role="page") with a div with classes of "ui-body ui-body-a" then all the form controls inside are auto-colored to fit the theme best. I tried instead adding a data-theme="a" to my page container verus adding the inner wrapping div but this doesn't auto-theme the form controls. Is there any way to add a data-theme attribute to a certain container to auto-color form contains inside? Just seems a bit weird to me if only way to achieve this is by adding the extra ui-body div.
In my app I have a few pages where I went back after it was finished and added some extra CSS rules to make them look nicer for whichever orientation mode the phone is currently in. I basically did this by just prefixing my css rules with the class names ".portrait" or ".landscape". It works fine in iPhones but it seems like in Droid phones that orientation rules don't work too well.... they tend to "stick". It will look fine usually in whatever mode it first opens in but when trying to flip it, the old changes remain the same, and flipping again to go back sometimes reapplies the last orientations mode style. I can't seem to find a pattern to it yet and other Droids I've tested behave the same way. Is this just an inherit bug in their mobile browser? Does anyone know any ways to actually make these orientation display changes work... maybe using CSS rules doesn't but there are alternatives? Just trying to figure out if I need to scratch the whole orientation mode changes just because not everyone can handle it correctly... it wouldn't be so bad if it was at least consistent but the partial changes end up mixing states and looking terrible.
Just curious since I couldn't seem to find any solid information of how to do custom theming in jQM. If I wanted to make a completely different color theme, let's say purple, is there a certain process to go about doing this? After looking at the jQM css file, my first thought was to look for groups of classes ending in theme suffixes like "-b" and "-c" and duplicate another set with a new custom suffix and then change hex colors. This about right or anything I'm missing?
I have a simple list that I created which is of course rendered as a listview widget by jQM. One of the list items I actually want to wireup some simple JavaScript functionality using a "click" event. I tried binding directly to the list item I want, using a delegate to do so, etc and no luck. I have even tried binding this after running a die().unbind().undelegate() on the UL of the list itself and still no luck... somehow my click event just won't trigger and I can't seem to find a reason. I ran a .data() on the UL just to check and on the specific LI to check when using bind to test and my event is in there, and the only "click" event... just can't trigger it for some reason. Anyone have any luck with this before?
I just ran into another situation where I was loosing my current page's "state" and then I realized it's because the select box opens long lists in its own on the fly created page. I knew this before but the connection wasn't being made until just now when I realized the implications. If you run a javascript function to wireup functionality on a form page using the 'pageshow' event, your state resets every time a select box with a long list is used because when the option list on the fly page hides again, it will re-run that same initializer function. So if any locally scoped variables are set on initialization, they will be reset to defaults after a select box is viewed... all bindings are re-fired... any code to reset your app state per page to get around caching is called again... etc. I think for some app pages this will be a complete dead end as right now this is yet another brick wall I hit with select boxes which are just essentially unusable to me. This should either be an option or I think an overlay needs to be looked into instead of doing this as a separate "page" in jQM terms which messes everything up. I don't see a reason why an overlay couldn't be used like the small list version except... make it bigger and imitate the page look instead of it actually being a new page. I think overall the select box really needs re-thought because it just has so many problems making it impossible to use for any advanced app functionality.
As a temp solution, I was hoping to comment out the parts in jQM framework for the selectmenu widget that decides if it will use a on fly created page (since these are the root of all select box evil) so it will be forced to use the overlay list view meant for small option lists. However, as someone pointed out (in the link above about other select box problems), on iPads and Androids if you try using the overlay view for long lists of option items, it starts too high on the screen cutting it off so that's another dead end on that solution. Ill be switching back to pretty CSS3 normal select boxes or trying to re-code the widget to work right.
It seems like currently there is a fairly large bug in the select box control which variates whether it displays a listview overlay or creates a new page of list items (for small/larger lists of items for usability). Even the jQM example at:
is affected as well it seems. The bug only seems to occur if the amount of items in the select box is reasonably close or more than enough for a full screens worth of select box items but there's a large variance it accepts. Try going to that example and look at the "Your State" select box example. Click it once and it should display the select box items in the "full page" format, then X out of the box without selecting anything, and then click it again and it shows the "list overlay" format. Doing this more and more, it alternates each time which version it displays when it should just be the full page format every time consistently since there's a lot of items (50 of course). And when it does incorrectly display in the "list overlay" format, since there are so many items it often is shifted far down the screen and looks really bad on the page. Every other time the select box widget calculates the size of the menu height to determine which to display, it somehow gets a 0 height for the menu and displays the incorrect "overlay list" format.
I could make due with this for now but it is causing me application errors. On one of my forms, after clicking around on the select boxes eventually I can also trigger an error "urlStack.pop() is undefined" in the changePage method called from the select box when doing the "full page" format. I'm just guessing but it seems like this display bug is causing unexpected counts in the page history tracked in changePage eventually resulting in this error. This error also prevents the form from submitting since I use changePage to move the user to their resulting page.
Has anyone else noticed this at all? It seems like a fairly large problem with the select box widget but can't find anyone else mentioning yet on forums. Anyone solve this their own way??
I ran into circumstances where I don't want certain pages in my app to cache. I think there should be an attribute that can be added to any div tag with date-role='page' such as data-cache="false" which would prevent that page from caching.
For my solution, I added a 'pagehide' binding in the dom ready event of the root index page for the app:
$j("div[data-role*='page']").live('pagehide', function(event, ui) { if ($j(this).children("div[data-role*='content']").is(".command-no-cache")) $j(this).remove(); });
And then I simply add the class 'command-no-cache' to 'content' data-role div for each page. This way upon leaving the page it removes itself from the cached dom.
When using nested lists, if the very last nested list is an ordered list then the numerals for the list items will not display. Anyone notice this and find a workaround?
In the below example, I want the "third tier" items to have their numerals
since its declared as an ordered list but it doesn't display them at
all:
I have been working a lot with the Tabs widget lately and have noticed a few things that caused me trouble/confusion so I was hoping someone could help. Specifically I am using the tabs widget in a "popup"/"lightbox" by having it controlled by another element source to toggle its visibility and the tabs are loaded via the Tabs ajax option for lazy loading content.
The first is the ordering of the events which, as I always read the ordering always follows, is select -> load -> show. The first oddity I was hoping someone could answer is why when I use Tabs with an fx option enabled then everything works fine and the events follow in that order... but if I remove the option for any effects on tab switching does the order change from select (of course) -> show -> load. I figured most, since by default its off, dont use the fx option so it seems the default event ordering is consistently reversed from the expectations. I know they're asynchronous calls so I guess in the case it's a battle of the timing it takes between the fickle ajax call and the static timing on the fx animation. But isn't this still a bit odd or could have been avoided by handling callbacks better in the source?
The second question/actual problem is partly related but specifically about the "show" event. I needed to add a reload capability to my implementation of the tabs which was nothing more than just simple calling .tabs('load', requestedIndex). I take care of all my binding for my UI on the load callback that I set when initializing the tabs. But here is what is giving me a problem... when you call 'load' it does not trigger the 'show' callback I set when initializing as well. I recently needed to add bindings in the content, for in this case, adding a jQuery UI accordion which needs the full height of its parent for initializing since I use it with the option fillSpace set to true. But creating the accordion with the rest of my bindings in the load callback did not work because it tries initializing the accordion before the tab is shown so it starts collapsed due to incorrect heights. When I move the bindings/call to initialize the accordion to the 'show' callback it works like a charm since it occurs after the content is displayed. So this was perfect except my catch 22 of needing to reload a tab... calling reload does not trigger show. So lets say someone clicks a button on my site to open my "tab lightbox"... switching back and forth between tabs the accordion works just fine because the 'show' event is triggered. But I basically lightly wrapped the tabs functionality to my own interface and one option is to specify which tab index as an argument for displaying the "tab lightbox"... so it is quite possible that when someone clicks to open it, they will try opening the same tab and I want to content to refresh via ajax as well no matter what like the others. So basically the only way I could do this was by storing the last tab index viewed and if the current one being selected is the same then it called 'load' instead of 'select' since 'select' wouldn't work anyway detecting that the tab is already active but its previous state was simply hidden. So in this situation of opening the "tab lightbox" to the same tab and trying to reload content... the accordion never can initialize in this situation since my 'show' callback isnt triggered.
Any tricks to get around this other than getting desperate and adding a setTimeout of a second or two to my load callback which always works?... but obviously I don't want to do it in such a sloppy way as that. And is there any good reason why the 'show' callback shouldn't be fired as well from the queue when content is manually reloaded using 'load'? It seems that if you're letting people manually reload content by offering that option then triggering the 'show' event and callback seems like it should naturally occur since, well, after it loads the content will be shown so why not? Any info or tricks would be greatly, greatly appreciated. Thanks!