- Screen name: ollie2893
ollie2893's Profile
16 Posts
201 Responses
1
Followers
Show:
- Expanded view
- List view
Private Message
- Hi,I have used .clone() to date always in the context of ui-draggable helpers etc, ie always on anonymous DOM elements. I today for the first time had occasion to duplicate a properly deep DOM structure, full of id'ed elements. I was surprised (not sure why) to find that .clone() faithfully clones every id. Therefore, after I inserted the clone into the DOM, the DOM had two ids of everything. Is this a problem? I retrieved the children I needed to target with $("no-longer-quite-so-unique-id",clone).Thanks.
Opera is the only browser giving trouble with this jQuery statement:
$("select").load("options.html",function() { $(this).val(1); });
The SELECT does not fill with ANY options. It is blank. Worse, I can turn on DragonFly in an effort to trace it down, and the problem disappears. The options are displayed as they should.
I have a .lload function that I use to work around caching problems in IE. Using this function in Opera does not fix the problem. I have no reason to believe, therefore, that this is a caching issue.
Anyone come across this?
- Hi folks,I have progressed to the user authentication of a web app I'm building. Implemented the mechanics of the login process in HTTP originally. The idea is for the login process to create a PHPSESSID which the SQL PHP would then recover. Worked all fine with HTTP. I then proceeded to enable SSL to hide the login dialog and session id. The bulk of the app should continue to download stuff using HTTP. So I have a sequence like HTTPS redirects to HTTP makes $.ajax calls to HTTPS. The latter bit crashes big time. Looking at Firebug, the Net panel reports that Firefox fired an OPTIONS header at my PHP script, which that script did not handle well. The script tried to recover the PHPSESSID from the OPTIONS header, failed and returned my "No active session" error. I understand that the problem results from HTTP://www.mydomain.com and HTTPS://www.mydomain.com being seen as different domains. (I'd actually appreciate a heads-up as to why a mere protocol change is considered toxic by people smarter than myself. It seems to me that it's all still the same domain...) And that Firefox is trying to establish with an Access-Control-Request whether my server would like to oblige. It seems prima facie that there may be something that I am required to do on my server. However, in researching this problem I stumbled upon JSONP. I have wondered before what that JSONP stuff in $.ajax was all about but since I managed to get by without it thus far, I never investigated. Reading some forum posts on JSONP, it seems that it might be a way around my problem. I have a few questions:(1)Why is it ok to download JS from 3rd parties, but not make $.ajax calls? Naively, I had thought that the former presents a considerably greater security risk than the latter. (What's the worst a $.ajax call could pull down? Probably JS actually...)(2)What do I have to do with my PHPSESSID cookie? I think that I should flag it "secure=true" such that it will only be sent along HTTPS connections. How will this affect my JSONP request? I am guessing that the script tag is loaded via HTTP? So will the SQL PHP script receive the cookie?(3)My server currently returns JSON data like so {}. JSONP is something like so callback= function() { return {}; }. I understand that I can configure the $.ajax call to do the padding for me. Should I? Or is it more efficient/better to rewrite my PHP script?Thank you for giving this post your attention (I apologise for the length).
- I was debugging some network traffic in Firebug and I noticed something rather strange: the GET request generated by $("#welcome").load("welcome.html"); was still spinning (in the Timeline) - despite the content of welcome.html having been properly displayed in #welcome for minutes. The behaviour doesn't change even following further network traffic. It looks like the .load() request hasn't terminated properly. This is entirely reproducible. Anyone noticed this behaviour before? Is this normal? Am I doing something wrong?Thanks.
IE6 has got me again! I can write
slideSuccess.show();
and all will be fine. When I replace that very line with
setTimeout(function() { slideSuccess.show(); }, 1000);
then, after 1 sec, my slide shows up garbled. Needless to say: the code works in all other browsers apart from IE...
Does anyone have any ideas what is going on here?
Thanks for looking.
- I invested a day on writing a crop editor based on ui-resizable/ui-draggable. Works very well but I am slightly irritated with the resize behaviour of my selection frame. I placed little squares all around my selection area (specifying handles for ui-resizable) but whilst all handles are functional, the actions of the handles on the left hand side and the top are totally counter-intuitive. The approach that ui-resizable appears to take is one of freezing [top,left] and resizing the object by moving [bottom,right] only. Now, I look at ui-dialog and I know it is based on ui-resizable and ui-draggable and yet ui-dialogs can be resized from the top-left just as well as from the bottom-right. Does anyone know the trick to use to make a ui-resizable resize in the same manner as a ui-dialog?Thanks.
- Quick question on a minor irritation: I am writing a little web app which splits its functionality over many free floating windows, all stackable ui-dialogs. Most of these windows have scroll bars. I notice that when two ui-dialogs overlap, then my mouse actions on the canvas of the top dialog impact on the scrollbars of thedialog beneath (depending on mouse placement, of course). I can put a stop to this by attaching .bind("mousedown",function() {return false;}); to each canvas, but feel a bit queasy about this. Anyone's come across this before and perhaps found a more subtle (CSS?) way to stop this?Thanks.
- I have hit upon this a few times and usually worked around with padding: the widget content is liable to "poke out" beyond the rounded edges drawn up with "ui-corner-all". This time around, padding is not an option: I would like to display an image with rounded corners (and not necessarily a border at all). Does anyone here know a way to make the corners positively cut off the overspill?Thanks.
- I recently picked up "selectable" for the first time and struggle to understand the event logic (*). Why is it that events are fired at the container (the thing that was made .selectable)? This imposes on the user an outside-in approach of managing selectees from the container-level. I have populated my container with tons of selectees which all maintain state within their own functional closure. I need my selectees to receive that event. I am thinking of logging an enhancement request to that effect. I figure that if the logic was changed so that these events are fired at the children, then this shouldn't break any existing code since the events will bubble up to the container if not caught, and outside-in management will continue to be an option? Or was the intention of selectable that there need not be a child-parent relationship between ui-selectee and ui-selectable?(*) Other widgets usually explain the event logic under the Overview tab of the documentation. It would be good if selectable did so, too. Explaining the structure of "ui" etc.
- Help, I'm losing my mind! I am creating a new UI dialog and am just trying to position it with the "position" option. I tried any permutation (mentioned in the manual) - none works. So I use Firebug to walk through the code and am now even more confused. My jQuery UI code calls jQuery.position like so:this.uiDialog// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781.css({ top: 0, left: 0 }).position({my: myAt.join(' '),at: myAt.join(' '),offset: offset.join(' '),of: window,collision: 'fit',// ensure that the titlebar is never outside the documentusing: function(pos) {var topOffset = $(this).css(pos).offset().top;if (topOffset < 0) {$(this).css('top', pos.top - topOffset);}}});The values in the parameter object all look alright but jQuery.position() does not take any input arguments:jQuery.fn.extend({position: function() {if ( !this[0] ) {return null;}...How is this supposed to work? I am running jQuery UI 1.8 and jQuery 1.4.2Does anyone have any suggestions? Thanks.
- I have just tested this code (abstraction):$.ajax({...async: false,success: function(data) {// do some sluggish post-processingalert(2);}});alert(1);And on my multi-processor, multi-threaded box I get the alerts in order 1, 2. I frankly expected 2, 1.It therefore seems to me that a synchronous $.ajax call returns as soon as the data has been received, and not (as I think is very reasonable to expect) when the success() or error() function has returned. This throws up problems with any expensive data processing (eg JSON parsing) but even with the most basic code like$.ajax({success: function(data) {globData= data;}alert(globData[0]);the access to globData[0] becomes subject to a race condition.This renders synchronous Ajax calls practically useless. Has anyone found a work-around?Thanks.PS: At a very minimum, the async option in $.ajax requires a much more nuanced manual entry...
- 05-May-2010 06:08 AM
- Forum: Using jQuery
My understanding had been that $.css("width") would return the original user selected style, eg "100%" or "10em", and $.width() returned the computed width, always in "px". Not so, following the code through for .css(), it calls something called getComputedStyle and the only difference between the two functions turns out to be a post-fix of "px" on the .css() result - not very useful. I need to know whether my user has called me with a proportional dimension, or a fixed one. How to tell with jQuery? Any ideas appreciated. Thanks.- Sorry to post this really dumb question. I built myself a UI widget like so:$.widget( "myWidget", {_init: function() {this.element.bind( "resize", function() {???????._myPrivateFunc();} );},_myPrivateFun: function() {// do something}});and instantiate like sovar div= $("<div>").myWidget();and later on fire a "resize" event like sodiv.trigger("resize");Good news is: the code finds its way into my resize handler. Bad news is: I have no idea how to find from the DOM element "this" (inside that handler) back to the widget instantiation such that the call to _myPrivateFunc() would actually resolve.Could anyone point me in the right direction? Thank you kindly.PS: I should mention that the firing code has no idea that myWidget is attached. That is, it would not know how to look for the widget context, nor would it know how to call _trigger.
- 11-Feb-2010 04:04 PM
- Forum: Using jQuery
Hi,I am new to jQuery and am about to embark on an intrepid venture to bend jQuery to my whim. Before I do so, I thought I had better first ask the experts here for their considered opinion. Here goes my cunning plan (almost real code):function myStatefulObject( sthg ) {// Parent:var that= jQuery( sthg ); // "sthg" is any valid jQuery selector expression and "that" will// become a new object *derived* from that selector.// Private:var someState; // This is what it's all about: I need to keep some XML data associated// with the DOM element.// Public:that.method= function(...) {// using private state data};that.data( "myInterface", that );return that;}Two questions at this juncture.(1) I have some reservations about deriving from (as opposed to containing) the jQuery object. I will obviously need to make sure that my that.method()s don't clash with existing jQuery methods, which I can. This doesn't though ward against future releases of jQuery using my names for completely different purposes. Won't break my code, clearly, since it could not have relied on these functions at the time. Might just look odd to future readers who by then will have different expectations... Any views?(2) Please confirm to me that the line in BOLD is really really well and truly OK. On the face of it, I am creating a circular reference. I know the .data() manual says not to worry. But I do. Is it kosher?I can now insert this stateful object into the DOM like so:myStatefulObject("<div>").id( "myStatefulObject" ).addClass( "ui-widget ui-content" ).appendTo( $("body") );Job done. Easy. Here comes the audacious proposal - fasten seat-belts:$= function( sthg ) { // Overloading trusty old $ - life's a box of chocolatesvar jqo= jQuery( sthg ); // So far so harmless - a mere indirection.var that= jqo.data( "myInterface" ); // Worth a shot ... "sthg" might just be one of minereturn that || jqo;}With that done, I should now be able to recover my stateful jQuery object using the usual moniker:$("#myStatefulObject").method(...);Does this make sense / seem like a good/awful idea?Appreciate your input.- Hi,A quick question re the ui object passed by Resizable into the "resize" event handler. Every time I use Resizable, I find myself having to manually resize one or more children. To that end, I need to understand by how much the event driver has actually resized. My immediate thought was therefore to calculate:dx= ui.size.width - ui.originalSize.width;dy= ui.size.height - ui.originalSize.height;Obviously, what I understand/want [dx, dy] to be is the change in dimensions over the previous step (so that I can mirror the incremental adjustment that has taken place). What happens instead is that originalSize never changes and my [dx, dy]s work out to be cumulative, relative to the (fairly arbitrary and somewhat irrelevant (coz long forgotten)) original size of the Resizable widget.I have obviously solved this dilemma by carrying around my own state data for "originalSize". It's tedious but I live. What I am curious to find out is whether ANYONE here found any use for ui.originalSize? In other terms, would a request to change the definition/behaviour of ui.originalSize give rise to any compatibility issues with existing code? Or have I perhaps missed a trick and there's another snippet of information lying about that would allow me to calculate the incremental [dx, dy] on the fly, without the need to carry my own state?Thanks.
Hi, I'm new here and not sure how to go about checking the progress of the development code to see whether what seems to me a bug has already been picked up.
I was trying to follow thru with the debugger why a scroll event does not appear to propagate up the food chain in IE6 when I stumbled across this piece of code at line 447 in ui.core.js (1.7.2):
$(document)
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
Judging by the textual layout employed - as well as by the actions performed - I'd guess that what was meant is this
$(document) {
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
}
How can I check whether this has been picked up?
Thanks.
- «Prev
- Next »
Moderate user : ollie2893
© 2013 jQuery Foundation
Sponsored by
and others.