I have a script that parses an XML doc that was loaded via ajax. On a PC it works fine and takes about a half second to parse. But I also need it to work on a mobile device, where it takes significantly longer (8 - 10 seconds or more)
On my ipod touch there seems to be a javascript execution time limit of somewhere around 10 or 15 seconds, and frequently the script is stopped before it completes, so I need to speed it up as much as possible. Can anyone help out with these questions:
what's the difference between using $.parseXML to loop through a tag in the XML vs just $( xmlString ).find( "tag" ).each() ? I've tried both and it seems insignificant as far as processing time goes
what's the difference between $( "otherTag", this).attr( "someAttribute" ) vs $(this).find( "otherTag" ).attr( "someAttribute" ) ? I've tried both and these also seem insignificant in terms of speed
A little more background about the XML for anyone interested, the particular spot that's taking a long time is looping through about 270 tags called "prodDetails", each of which has 2 attributes and about 18 child tags with attributes that I need to access. So the code looks something like this:
//xml is a string of xml data
$(xml).find("prodDetails").each(function(){
var product = new Array(); // I also tried making this {}; and using "attr" : value below.. no real difference
I've always had a habit of checking if a certain element exists before telling jquery to do anything with it, just to be thorough. But it doesn't generate an error if I just try to attach my miscellaneous code to an element that happens to not exist, so should I bother checking first? Could it actually slow down the code to do lots of these checks, vs just attempting to set up the behavior regardless?
For example on product pages I have a particular jquery file that runs, and handles all the behaviors for various products. But not all products have the same features, so I don't always need to set up every behavior, so I check beforehand.
I just noticed that some javascript I put in the <head> section of a page that's later loaded via ajax isn't being run in safari. For example here's a page:
safari never fires the alert, but all other browsers do
Is this by design, maybe head sections are supposed to be ignored in ajax content? It's not a big deal, I can easily put the script into the <body> section which solves the problem
Just wondering if it's a bug or by design. Maybe I should stop including <html><head> and <body> tags in ajax content just because of potential problems like this
We tested one of our pages on android today and it seems like our email address field always got marked as not being a valid email address, even though it was
I changed the validation to only require an email address if the userAgent wasn't android, which solved the problem enough so that people could continue
Anyone know what the problem might be? We were initially using validator 1.7 but I saw that version 1.8 was available so I updated to that, but the problem was still there
I frequently forget my login ID and password, and the login form doesn't allow my browser to remember them (google chrome). As a result I'm constantly going to the forgot password page.
Forgetting my password is my own fault, but I think there are a couple of ways to make this easier for people like me
1. It wouldn't be so bad if not for that nice checkbox that said 'Keep me signed in' on the login page, which I always check. Apparently the cookie doesn't last that long because I always get logged out anyway. What's the point of this checkbox if it's just going to eventually log me out anyway - I'd rather it was permanent. The text itself 'keep me signed in' seems to imply permanence - for example it doesn't say 'keep me signed in for 2 weeks and then sign me out'
2. Alternatively if the login form allowed my browser to save my login info, that would help too
With 1 error class it works fine, but adding a second one makes it fail. Here are some links, just hit the submit button a few times on each one to see what I mean
Not sure if this is a bug or by design, but I noticed today that when attempting to get the height of a dialog window that hasn't been created yet, it returns an Object instead of "undefined" as it did in 1.7.2.
$("#dialog").dialog( "option","height" );
returns [object Object] if #dialog has not already been turned into a dialog yet.
This breaks code like:
if ( !$("#dialog").dialog( "option", "height" ) ) {
$("#dialog").dialog();
}
Maybe it has something to do with whether #dialog already exists (as a div) on the page
Anyone know of a way to get the blind effect, when showing an element, to roll upwards from the bottom, and when hiding it to roll down from the top? I see you can choose between vertical and horizontal but not the direction of the animation. It's either: show (vertical) = top to bottom hide (vertical) = bottom to top show (horizontal) = left to right hide (horizontal) = right to left anyone know if it can be reversed, or if another effect can? --
We're loading content via ajax using .load, into a jquery ui dialog box. Everything is fine but I'd like to have a loading animation until the ajax content is ready to go I tried something along the lines of: - put a loading animation in "#divForDialog" - $(divForDialog).dialog().load( 'page.htm') so the loading animation displays when the dialog pops up, and then ajax loads content that erases the loading animation it's fine except that the ajax content still takes a while to load, but the system erases the loading animation the moment it receives some of the ajax content another complication is that the ajax content pulls in images etc via css and via jquery.css('background-image' : 'url(path/to/file.jpg)') type calls I'm sure there must be an easy way to make the .load wait till the ajax content is 100% done loading before injecting the content?
Hi all, I'm trying something along these lines: my domain = example.com external domain = otherExample.com example.com/test.htm contains: iframe src=otherExample.com/test2.htm I want test2.htm to have access to the contents of test.htm. I can do this using selectors like $("p",top.document) ONLY if test2.htm is loaded from example.com rather than from otherExample.com. As soon as it's loaded from otherExample.com, it can't get access to the contents of example.com/test.htm Is it possible to do this? thanks in advance
I was about to use inArray (http://docs.jquery.com/Utilities/ jQuery.inArray) to determine if an element was in an array or not, but I realized I can't use it as a true/false response since it returns the position (and could return 0 if the element was found in position 0 - returns -1 if not found). I was expecting something with the same functionality as the PHP function in_array (http://us3.php.net/ in_array) I know it's a minor point but wouldn't it be more intuitive if called arrayPosition? with a name like that I'd expect the functionality it has now.
I'm helping someone set up thickbox to work on their yahoo store. It seems like Yahoo has a built-in click tracking system that is messing up the thickbox though. For example clicking on a thickbox link that points to "theFile.htm" first makes a request to yahoo for something like: http://a.analytics.yahoo.com/p.pl?a=....... with a ton of analytical data appended to the URL. It returns a tracking gif, and the real content of theFile.htm never loads. (you just stare at thickbox's loadingAnimation.gif forever) Has anyone ever seen this before and come up with a workaround?
Hi all, I have a couple questions about the superfish navigation menu (http://users.tpg.com.au/j_birch/plugins/superfish/#examples) First is that the menu claims to degrade nicely when javascript is turned off -- but for me when I disable JS and hover over the menus, nothing happens. Even looking at the superfish examples on tpg.com, if i disable js there the menus don't appear on hover. Second, anyone know if superfish can be used to display a menu very similar to REI.com? I can get the nav-bar style to be close, but I can't get it to automatically extend multiple columns. I'm tinkering with it but I'm beginning to wonder if I'm better off just creating my own menu from scratch instead thanks all