[jQuery] Re-distribute jQuery
Hello, I want to include jQuery as part of my jQuery plugin so user can include only one file and can use immediately. I want to release under MIT liecnese, so is it just include the original liecnse senstence is okay? Thanks.
[jQuery] jQuery.get filtered JavaScript Tag
When using jQuery.get to fetch remote contents, the content inside the script tag will be removed and therefore not executed. Is it possible to incluce the script tag and run it automcatically when using jQuery.get ? Thanks.
[jQuery] Re: Cross domain Ajax without Proxy
On 12月11日, 上午2時32分, ricardobeat [EMAIL PROTECTED] wrote: I believe you have already answered that to yourself but was hoping for a misteryous miraculous solution right? :) No, there isn't, you'll have to do it server-side. Or if you're not playing with the remote page's content use an iframe. Not related to JavaScript, but is it possible to use other technologies such as Flash or Java Applet? I nevered tried before.
[jQuery] jQuery.get filtered JavaScript Tag
When using jQuery.get to fetch remote contents, the content inside the script tag will be removed and therefore not executed. Is it possible to incluce the script tag and run it automcatically when using jQuery.get ? Thanks.
[jQuery] Re: Image rollover using jQuery
Maybe this: http://code.google.com/p/jquery-swapimage/ On Nov 30, 5:14 pm, Ray M [EMAIL PROTECTED] wrote: Hello, Are there any existing jQuery plugin which can provide similar image rollover functions such as the one provided by Dreamweaver? Thanks. Ray
[jQuery] Is my style of writing jQuery plugin correct?
Codes... jQuery.test = function(val) { jQuery.test.foo = function() { alert( foo + jQuery.test.bar() ); }; jQuery.test.bar = function() { return bar +val; }; jQuery(document).ready(function() { jQuery.test.foo(); }); }; // To use script jQuery.test(Tom); /script Is my style of writing jQuery plugin correct? Thanks for comments...
[jQuery] How to position a footer always at bottom?
Consider the code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; html head title/title script type=text/javascript src=jquery-1.2.6.min.js/script script type=text/javascript $(document).ready(function() { var footer = $('#footer'); var w = ( $(window).width() - footer.width() ) / 2; footer.css('left', w); footer.css('display', 'block'); $(window).scroll(function(){ console.debug( $(window).height() ); footer.css('bottom', 0); }); }); /script style #footer{ background-color:green; height:30px; position:absolute; width:800px; bottom:0; display:none; } /style /head body pLorem ipsum dolor s.eugiat./p pLorem ipsum dolor s.eugiat./p pLorem ipsum dolor s.eugiat./p div id=footerFooter/div /body /html I want to footer always at the bottom, no matter I scoll the page. (while resize I don't care)
[jQuery] Server Side jQuery
Currently I have only tested 2 way to do server side jquery 1. env.js + rhino 2. jaxer Both 2 methods are following John's blog Anyone know other ways such as other JavaScript server implementations? Thanks.
[jQuery] Re: Server Side jQuery
On 6月16日, 上午2時34分, Nitsan Bin-Nun [EMAIL PROTECTED] wrote: I'm new here, For what cause you want to execute jquery on the server side? 'DOM Scraping' http://www.aptana.com/node/339
[jQuery] A simple plugin to check if your browser supported by jQuery - Officially
Just share with you one of a useful plugin: jQuery.supported = function() { if (typeof jQuery.supported.result != undefined) return jQuery.supported.result; jQuery.supported.browsers = [ [safari, 412], [opera, 9.0], [msie, 6.0], [mozilla, 1.8.1] ]; jQuery.supported.result = false; var b = jQuery.supported.browsers; for (var i=0; ib.length; i++){ if (typeof jQuery.browser[b[i][0]] != undefinded jQuery.browser[b[i][0]]) { var a1 = b[i][1].split(.);var a2 = jQuery.browser.version.split(.); var d1 = a1.shift();var d2 = a2.shift(); if ( parseFloat(d2 + . + a2.join()) = parseFloat(d1 + . + a1.join()) ) jQuery.supported.result = true; } } return jQuery.supported.result; }; // To use alert( jQuery.supported () );
[jQuery] Re: A simple plugin to check if your browser supported by jQuery - Officially
On 5月23日, 下午1時19分, Danny [EMAIL PROTECTED] wrote: ...people who felt browser-sniffing was too evil to ever allow. People saying this are those who never read the jQuery sources. Also, I agree this should be in the core of jQuery. Howard
[jQuery] Re: how to preserve the image that was there when I roll over
On 4月30日, 上午10時41分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have several images on my page, each with class myClass. I know when I roll over each image, I want its source to be over.gif. However, when I roll out I want the image to be whatever was there before, and it will be different for each image. How can I construct mouseover/mouseout handlers to accommodate this? you can refer to this plugin: http://code.google.com/p/jquery-swapimage/
[jQuery] Override original jQuery method?
Hi, For example, how to override the original hover() method and use my own code? jQuery.fn.extend({ hover: function(fnOver, fnOut) { return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); } }); Thanks
[jQuery] Override original jQuery method?
Hi, How to overrider the original jQuery method and use my own code? E.g. jQuery.fn.extend({ hover: function(fnOver, fnOut) { return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); } }); I want to override the hover method. Thanks.
[jQuery] jQuery.data and metadata plugin
Hi, Is it true that metadata plugin should be replaced by the jQuery.data? But I found no way to query the data value stored in css class just like metadata. Thanks.
[jQuery] Remote Dom using JQuery
Hi, If I use ajax to get a remote page, is it possible to process its dom just like the current HTML? E.g. $.get(data.url, function(data) { // data is HTML, I want to process data, using JQuery , e.g. get a particular class } Thanks.
[jQuery] jQuery on Mozilla rhino
Hello, Anyone tried to run jQuery on rhino? I followed John's post, it was okay. However, if I code in Java (since I don't use command line), the env.js cannot be interpreted: E.g. engine.eval(new FileReader(C:/env.js)); It gives: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing : after property id (Unknown source#15) in Unknown source at line number 15 at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source) at javax.script.AbstractScriptEngine.eval(Unknown Source) at Test.main(Test.java:33) Where line15 is: get userAgent(){ a little bit strange... Any idea? Thanks.
[jQuery] Re: Function overriding
On 3月3日, 下午11時56分, David Stamm [EMAIL PROTECTED] wrote: The function sayHello() is defined inside the function jQuery.example, and is thus an inner function or nested function. It exists only when jQuery.example is executing. It cannot be accessed from outside jQuery.example without doing some magic with closures. When you tried to override sayHello by setting jQuery.example.sayHello, you created a new property sayHello on the jQuery.example object. You can use this same technique to define this inner function the first time: jQuery.example = function(name) { jQuery.example.sayHello(name); }; jQuery.example.sayHello = function(str) { console.log(jQuery.example.sayHello: + str); }; You can then override sayHello with the exact code you used above: jQuery.example.sayHello = function(str) { alert(jQuery.example.sayHello(Overrided): + str); }; This is probably the easiest solution. Let me know if this doesn't answer your question. David Thanks. Unfortunately I don't want to modify the original sources, since for example, sometimes you want to modify an existing plugin, you want to make it more easy to maintain by function overriding. (Consider if they roll up a new version) Anyway, seems no better way. thanks.
[jQuery] Re: jQuery on Mozilla rhino
On 3月4日, 上午7時27分, John Resig [EMAIL PROTECTED] wrote: Sounds like you're using an old version of Rhino. --John Hi John, I am using the latest one: rhino1_6R7 I can run successfully according to your post, I just can't read the JavaScript file (env.js) by using Java! I will dig into the code to see what are the difference between load() in the js.jar and engine.eval(...) in Java. Thanks! Howard
[jQuery] Re: Function overriding
On 3月4日, 上午12時37分, David Stamm [EMAIL PROTECTED] wrote: I'm sorry, I thought you were trying to architect your own plugin to make it easier to override for others. A useful technique when you're overriding someone else's function, is to save a reference to the original implementation right before you override it: // save a reference to the original function fn = jQuery.example; // override function jQuery.example = function(str) { // use the original implementation fn(str.toUpperCase()); }; This doesn't really help in your example, since you're trying to override a call to alert(). But I thought I'd mention it, in case it does applies to your real-world situation. thanks, David Thanks for your tips. Howard
[jQuery] Function overriding
Consider I have a simple plugin, e.g. jQuery.example = function(name) { sayHello = function(str) { alert(jQuery.example.sayHello: + str); }; sayHello(name); }; at sometime later, I would want to override the original sayHello method(), so I add, jQuery.example.sayHello = function(str) { alert(jQuery.example.sayHello(Overrided): + str); }; But this does not work. Any idea? Thanks.
[jQuery] Event handlers stacking using JQuery
Currently document ready call at different place can be stacked together and call at once. How about normal events, e.g. window.onload (i.e. runonload.js is quite handy in this area, http://safari.oreilly.com/0596101996/jscript5-CHP-17-SECT-6) Besides, event such as mouse clicks, can we stack event handlers together so they can be called one by one? Best Regards, Howard
[jQuery] each() without the last element?
Hello, I want to loop thru each elements with the each() function, except I want to skip the last element, are there simple method? Thanks,
[jQuery] Customized user page?
This might not be jquery related, but I would like to hear experts' comments :) Let's say I have to make a user customizable front page, e.g. There are multiple blocks within a page (e.g. sports, news, finance, game etc), users would be able to choose their preferences (Something similar to Yahoo or iGoogle), they might choose the ordering, or to load/hide different blocks ect. The settings will be stored in cookies. I am considering serveral methods, e.g. 1. use of dynamic script (PHP) to read the cookie and do the loading/ hiding, only use Javascript only do the ordering. 2. completely use Javascript to rendering Which methods you preferred? or any other workarounds? Thanks. Howard
[jQuery] Re: Customized user page?
Thanks for your comments. On 1月31日, 下午9時21分, h0tzen [EMAIL PROTECTED] wrote: but with serverside scripting you may store the whole configuration in some backend-system (e.g. db) and only store the hash (much more flexibility) I don't think I will store the settings in db, as our services is NOT only provided to registered members. Those `widgets` can be pre-generated as static text files first (load on demand as iframe html). In this way, since our index is also a static html file, so this make our page very fast (server side) and can serve a lot of concurrent users. Besides, I am looking at ESI (www.esi.org) which seems a possible solutions, but never tried before. Howard.
[jQuery] JQuery Mobile/Lite?
Hi all, Given that many mobile devices will have a much better support for Javascript, e.g. iPhone, Nokia N-series handset (running webkit), or 3rd browsers such as Opera mobile/mini, Pocket IE ect, are there any plan to fork a branch of JQuery as JQuery mobile for example? It would be interesting? Howard
[jQuery] Server side JQeury
I have been following John's article: http://ejohn.org/blog/bringing-the-browser-to-the-server The script only support well formed XML, as defined in the function (env.js) window.__defineSetter__(location, function(url){ var xhr = new XMLHttpRequest(); xhr.open(GET, url); xhr.onreadystatechange = function(){ curLocation = new java.net.URL( curLocation, url ); window.document = xhr.responseXML; var event = document.createEvent(); event.initEvent(load); window.dispatchEvent( event ); }; xhr.send(); }); But why we need fetch valid XML?
[jQuery] Re: Server side JQeury
On 1月7日, 下午6時00分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jan 7, 3:46 am, howa [EMAIL PROTECTED] wrote: I have been following John's article:http://ejohn.org/blog/bringing-the-browser-to-the-server The script only support well formed XML, as defined in the function (env.js) window.__defineSetter__(location, function(url){ var xhr = new XMLHttpRequest(); xhr.open(GET, url); xhr.onreadystatechange = function(){ curLocation = new java.net.URL( curLocation, url ); window.document = xhr.responseXML; var event = document.createEvent(); event.initEvent(load); window.dispatchEvent( event ); }; xhr.send(); }); But why we need fetch valid XML? You don't have to use XML for sure, you can use JSON and fetch Javascript data structures from the server-side. I think it's often much easer for a server-side developer.. or you can just load plain html text into your DOM tree(usually into a single field). lihao(XC) from John's site, it said: This is one part that works pretty well right now - with the huge caveat that it only works on well-formed XML documents (oops!). I'll be integrating an HTML parser into the code base so that we can make this functionality a little more resilient. In the meantime, here's an example of the sort of scraping that you can do currently: I am wondering why it was difficult to parse HTML at the beginning. Howard
[jQuery] Re: Server side JQeury
On 1月8日, 上午12時50分, John Resig [EMAIL PROTECTED] wrote: I am wondering why it was difficult to parse HTML at the beginning. Simply: Because one doesn't exist. I've since written one and hope to be integrating it soon. --John Good! Server side using jquery is really useful for extracting useful information on remote sites without using many regex...
[jQuery] Can JQuery support iCab 3 (for legacy Mac OS9)
We have some users still running OS9, I would like to know if any OS9 users here can confirm if JQuery (1.2x) support iCab 3, so we can advise them to use this browser. http://www.icab.de/dl.php Thanks.
[jQuery] Re: AJAX Security
On 11月23日, 下午4時06分, Jörn Zaefferer [EMAIL PROTECTED] wrote: howa schrieb: On 11月22日, 下午7時15分, Fabien Meghazi [EMAIL PROTECTED] wrote: In non AJAX apps, automatic checking can be prevented using Captcha in the registration page. As you could do with an AJAX application, I don't understand what would prevent you to do so. What main difference do you see between a GET or POST made by the browser when submitting a plain old form and a GET or POST made using XMLHttpRequest ? Hello, let consider a simple membership registration page 1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe You can validate Captchas via ajax... Sure, but it oppose the original idea why you want to use AJAX for user to choose the username easily, well, this in fact related to doing Turing test on AJAX or RIA for max. usability.
[jQuery] Re: AJAX Security
On 11月22日, 下午7時15分, Fabien Meghazi [EMAIL PROTECTED] wrote: In non AJAX apps, automatic checking can be prevented using Captcha in the registration page. As you could do with an AJAX application, I don't understand what would prevent you to do so. What main difference do you see between a GET or POST made by the browser when submitting a plain old form and a GET or POST made using XMLHttpRequest ? Hello, let consider a simple membership registration page 1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe 2. AJAX User can select the username via AJAX API, where the possible automation came in
[jQuery] AJAX Security
Well, this is not JQuery related, but I want to know the current best practices in AJAX developments... In an AJAX apps, such as user registration, we might have a API for user to check if their desired user name has been taken by another user. If we expose this API using AJAX, then it might become very easy for other people to automate a computerized bot to query our system. Are there any plattern(?) to provide some kind of security to the apps such that bot can be prevented? Thanks.
[jQuery] Re: AJAX Security
On 11月21日, 上午6時34分, Fabien Meghazi [EMAIL PROTECTED] wrote: With a blank or mismatched referrer, the script will always return a username as unavailable. Unfortunately the referrer is easily spoofed, so I'm not sure how effective this will be. And just because it can be easily spoofed then you should not use referer. Yes, I agreed using referrer is not a reliable method. Please explain the difference between your worries about an ajax application and a non-ajax application. In non AJAX apps, automatic checking can be prevented using Captcha in the registration page. For example, in Yahoo, guess how they are checking? e.g. https://edit.yahoo.com/membership/json?PartnerName=yahoo_defaultRequestVersion=1AccountID=johndoeGivenName=FamilyName=ApiName=ValidateFields1763407 Howard
[jQuery] Move of namespace
It is possible to completely move a particular plugin namespace into other one? e.g. if (typeof Company == undefined) { var Company = {}; } Company.form = {}; Company.form.validator = jQuery.validator; // Assume already loaded // Now I want to modify some of its internal value Company.form.validator.messages.required= My Required; // However, it is different from alert( $.validator.messages.required ); // Show the original value, seems only a copy of validator is assigned to Company.form.validator, but not pass its reference
[jQuery] Namespace conflict
Hello, I want re-organize the jquery namespace into a more meaningful namespace, but I can't make it success, e.g. html head script src=jquery-1.2.1.pack.js/script script var company = {}; var company.animation = {}; // Why this didn't work? company.query = jQuery.noConflict(true); /script /head body script company.query ( function() { alert('test'); } ); /script /body/html If I removed the `var company.animation ..`, then code works but I don't know what's wrong with it...
[jQuery] Consider a standard documentations for plugins
Now, JQuery has many plugins, this is good. The bad side is different authors has different taste in writing documentation, I think it would be good to have a standard way to write documents, similar the one in the jquery doc., with examples, arguments description etc. It does not mean most authors are bad in writing documents, but using a standard way can help users to explore the plugin easier faster. Also, it would be good if allow user to comment on the plugin just like what we have in php.net. People can contribute to build up the knowledge base, such as the plugin was broken with browser abc, workaround etc.
[jQuery] Re: Consider a standard documentations for plugins
On 10月29日, 上午12時11分, Rick Faircloth [EMAIL PROTECTED] wrote: A good idea, Howa, however I've been barking up the standardization, consistency, documentation, plug-in-compatibility-with-various-jquery-versions, bring-all-this-together-in-a-standardized-format-in-one-location for months, now. The response I always get is: Core developers and plug-in authors are volunteers, so no one should expect that they will participate in the work involved to coordinate and standardize the jQuery core, plug-ins, and documentation. Hello, I think the point is: user can contribute this, not always the plugin developers. We can have a more functional standard plugin documentations here at jquery.com, user can contribute say, telling which browsers it work or didn't work, any special tricks even the author don't know, compatibility with jquery version etc.. wiki is a good tools for this. it can really boost the learning curve for using the plugin as currently different author has their own style in writing guideline.
[jQuery] Javascript best practices
More more plugins are using CSS to style the layout, this is good, but their didn't aware of if user browser don't know javascript, it is useless to load the CSS, e.g. thickbox script type=text/javascript src=path-to-file/thickbox.js/ script link rel=stylesheet href=path-to-file/thickbox.css type=text/ css media=screen / can be better: script type=text/javascript src=path-to-file/thickbox.js/ script script document.write('link rel=stylesheet href=path-to-file/ thickbox.css type=text/css media=screen /'); /script
[jQuery] Re: Javascript best practices
another reason i can think of: sometimes, you don't want to include jquery plugin in the head /, since maybe header.template is shared, then you put the include plugin codes into the templates only want to show the effect, this came to a problem...putting css into body failed the html validation. On 9月13日, 下午6時55分, Christof Donat [EMAIL PROTECTED] wrote: Hi, More more plugins are using CSS to style the layout, this is good, but their didn't aware of if user browser don't know javascript, it is useless to load the CSS, e.g. thickbox script type=text/javascript src=path-to-file/thickbox.js/ script link rel=stylesheet href=path-to-file/thickbox.css type=text/ css media=screen / can be better: script type=text/javascript src=path-to-file/thickbox.js/ script script document.write('link rel=stylesheet href=path-to-file/ thickbox.css type=text/css media=screen /'); /script Most userse do have JS active. The overall overhead in bytes downloaded for thickbox.css where it is not needed is smaller than the overhead of bytes you introduce with your additional script tag for all users. In most cases it is better to load the unused stylesheet. Christof- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] Thickbox loading image twice
If cache is disabled, you might use webdeveloper to try out.
[jQuery] Re: Is it possible to do something like Firebug `inspect` function with JQuery?
Yes, this is exactly what I want. This tool is really useful. Thanks. On 9月8日, 下午11時45分, Tzury [EMAIL PROTECTED] wrote: When mouse over an object, say a DIV for simplicity, I can use JQuery to get its absolute position in DOM tree, There is Modi (http://slayeroffice.com/tools/modi/v2.0/modi_help.html) not jQuery but still JavaScript
[jQuery] Is it possible to do something like Firebug `inspect` function with JQuery?
When mouse over an object, say a DIV for simplicity, I can use JQuery to get its absolute position in DOM tree, e.g. div#header body html Any idea?
[jQuery] Image rollover plugin?
Something like what dreamweaver provide, are there such as plugin in jQuery? Thanks.
[jQuery] Re: Image rollover plugin?
Rollover button (image), i.e. the classifcal MM_rollOver() MM_preloadImage() functions replacement using jQuery. On 9月7日, 上午1時22分, Glen Lipka [EMAIL PROTECTED] wrote: Could you be a little more specific? Maybe show a page that has the kind of effect you are looking for? I think the answer is Yes, but you need to be more specific, there are alot of different variations. You may not need a plugin at all. Glen On 9/6/07, howa [EMAIL PROTECTED] wrote: Something like what dreamweaver provide, are there such as plugin in jQuery? Thanks.- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] How to fade only the background?
Hi, The following code will fade the logo, instead of bg, e.g. html head script src=http://jqueryjs.googlecode.com/files/ jquery-1.1.4.pack.js /script style #bg{ width:600px; height:600px; background-color:blue; } / style /head body script jQuery(document).ready(function() { jQuery(#bg).fadeTo(slow, 0.5); jQuery(#logo).fadeTo(slow, 1.0); }); /script div id=bg img id=logo src=http://www.w3.org/Icons/w3c_main; / /div /body /html any workaround? thanks.
[jQuery] iframe + security (can be improved by jQuery/Ajax?)
Hello, Consider a blog apps like Blogger, you have a site like http://abc.blogspot.com each time, you want to leave a comment for an article, you will be redirected to another page under the blogger domain, e.g. https://www.blogger.com/comment.g. I think one of the reason why Blogger don't embed the comment box into the user's blogspot page directly is related to security (XSS? I am not sure) my questions: 1. Will there be any securty threats if I create an iframe, and put the blogger comment page directly into the user page (i.e. https://www.blogger.com/comment.g) 2. Can the security be improved by using jQuery / Ajax approach ? Thanks.
[jQuery] Wrap JQuery into YUI namespace?
Is it possible? e.g. YAHOO.util.jQuery(#test).each(...);
[jQuery] Rolling region plugin?
Anyone know there is such as plugin, e.g. div id=image1 img src='... desc... /div div id=image2 img src='... desc... /div div id=image3 img src='... desc... /div ... the effect is the DIVs keep rolling (over and over) from a limited area (which only show at most 2 items at the same time)
[jQuery] True overlay?
Hello, I am looking for a plugin for loading external page into a overlay like jqModal does, but when I click on the link in the overlay, I only want the overlay's content to be changed. Are there such plugin now? Thanks.
[jQuery] Dynamic Form Validation?
Hello, anyone has idea how to do dynamic form validation? e.g. using http://bassistance.de/jquery-plugins/jquery-plugin-validation/ input name=t1 type=text / input name=t2 type=text / I only want to check for required field for t2 ONLY if t1 is equal to some value e.g. If t1 = test, then t2 cannot be null, else never mind abt t2 has any idea?
[jQuery] Re: What does Unobtrusive Javascript mean?
http://developer.yahoo.com/yui/articles/gbs/ Progressive Enhancement vs. Graceful Degradation The concepts of graceful degradation and progressive enhancement are often applied to describe browser support strategies. Indeed, they are closely related approaches to the engineering of fault tolerance. These two concepts influence decision-making about browser support. Because they reflect different priorities, they frame the support discussion differently. Graceful degradation prioritizes presentation, and permits less widely-used browsers to receive less (and give less to the user). Progressive enhancement puts content at the center, and allows most browsers to receive more (and show more to the user). While close in meaning, progressive enhancement is a healthier and more forward-looking approach. Progressive enhancement is a core concept of Graded Browser Support. So to my understanding, Unobtrusive Javascript ~ Graceful Degradation not really a good thing and not the same as Progressive Enhancement On 8月16日, 下午10時13分, Pops [EMAIL PROTECTED] wrote: Ive seen this term referred to a few times, especially here: http://simonwillison.net/2007/Aug/15/jquery/ What does Unobtrusive Javascript mean? I am getting the idea that jQuery offers a way to bypass a user turning off JavaScript? How does jQuery do this? Thanks
[jQuery] Re: Jquery Vs. Prototype
i think that most important aspect is: jquery is more community driven... just paly around with its countless plugins, and also people here to discuss jquery related matters 24x7x365 i think the answer is clear that jquery is the way to go. On 8月4日, 下午11時48分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I am trying to decide on a JS framework for my website and I am looking at jQuery and prototype. While, I understand there are many philisophical differences between the implementations, it looks like to me one of the big differences are all of the new functions available in prototype. What I am curious about, is does jQuery have support for these things or in jQuery are you basically expected to use the easy access to DOM objects to create the functionality you need as you go. For example, in prototype, adds these methods to the form element (http://www.prototypejs.org/api/form ): disable enable findFirstElement focusFirstElement getElements getInputs request reset serialize serializeElements Does jQuery have anything similar? In jQuery would you just write these yourself? I can see the benefit of this being that you only include the methods you need and there is no bloat. But I just recently read that you can get a compressed prototype library down to 26k - so isn't that almost the same as jQuery? I guess I am just looking for a reason to use jQuery vs. Prototype and an argument about why I don't need all those (useful?) methods available in prototype? Anyone?
[jQuery] Move JSON into the JQuery's core?
What do you think? I think json is quite a standard way in developing javascript/ajax apps now.
[jQuery] Re: Move JSON into the JQuery's core?
serveral reasons: 1. json will become part of the JavaScript Programming Language in the Fourth Edition of the ECMAScript standard, we should encourage using it 2. jquery getJSON() is not too secure, e.g. data = eval(( + data + )); 3. size is not that large. 1.x kb only On 8月7日, 下午9時22分, John Resig [EMAIL PROTECTED] wrote: In what respect? jQuery can already consume JSON data - and it can serialize it back to a query string. If the JSON serialization plugins start getting used enough (which they aren't) then we may consider moving them into core. --John
[jQuery] Re: Move JSON into the JQuery's core?
even that, made this as an offical plugin would be good. :) On 8月8日, 上午10時35分, John Resig [EMAIL PROTECTED] wrote: Perfect for a plugin, then! :) On 8/7/07, howa [EMAIL PROTECTED] wrote: serveral reasons: 1. json will become part of the JavaScript Programming Language in the Fourth Edition of the ECMAScript standard, we should encourage using it 2. jquery getJSON() is not too secure, e.g. data = eval(( + data + )); 3. size is not that large. 1.x kb only On 8月7日, 下午9時22分, John Resig [EMAIL PROTECTED] wrote: In what respect? jQuery can already consume JSON data - and it can serialize it back to a query string. If the JSON serialization plugins start getting used enough (which they aren't) then we may consider moving them into core. --John- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] Draw line or polygon like Google Map?
Hello, Did you played with Google Map? Google Map allow you to draw lines or polygon by providing points array. So wouldn't it be great if we have plugin using jQuery to do the same thing, but no need to related to map, just a general drawing library? howa
[jQuery] Re: Validation Plugin
On 7月13日, 上午3時44分, J rn Zaefferer [EMAIL PROTECTED] wrote: howard chen wrote: abt this plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ several problems: 1. Is it possible to dynamic add INPUT into the current list of checking? You can use validator's refresh method to check for additional input elements. That works best when combined with metadata. Otherwise you have to extend the rules-object you passed into the plugin method. Hello, I am not using metadata, can you provide some sample how to refresh the inputs? (I use jQuery to clone an input text field, and insert into html by assigning a different ID but same name, i.e. email[]) 2. Is it possible to user `id` instead of `name`? You could overwrite jQuery.validator.prototype.idOrName to always return the ID of the given element. 3. Is it possible to check for something like name=email[] ? seems the codes has some of hardcoded element.name...modifying the idOrName is not enough, anyway, i get this work by replace all .name to .id Sure. Just put the name into quotes when specifying validation rules, eg. email[]: { required: true, email: true } this trick only work with the first input has the name email[], i.e. the following codes didn't work with the second and third inputs, e.g. htmlhead script src=jquery.js/script script src=jquery.validate.js/script /headbody script $(document).ready(function() { $(#form1).validate({ event: submit, rules: { email[] : { email: true } }, messages: { } }); }); /script form name=form1 id=form1 input type=text name=email[] value= / input type=text name=email[] value= / input type=text name=email[] value= / input type=submit name=submit value=submit! / /form /body/html Thank you so much or your help! Howa
[jQuery] How to re-select?
e.g. How to re-select? p id=i input ... / input ... / input ... / /p var i = jQuery(#i); Q: so how to select all the input inside p? i know i can use jQuery(p input), but I want to re-use the variable i as already selected since i want my functions be more flexible...
[jQuery] Re: Attn. developers. Speed of getElementById
Hi John, Currently jQuery don't have caching functions, wouldn't it be great if we add it? On 6月22日, 下午10時33分, John Resig [EMAIL PROTECTED] wrote: Dimitii - test_results.PNG 14K檢視下載 Those results are really interesting - you should post them to the jQuery Dev list (where we discuss issues like selector speed). More information about the list can be found here:http://docs.jquery.com/Discussion --John On 6/22/07, Dmitrii 'Mamut' Dimandt [EMAIL PROTECTED] wrote: The original is in Russian: http://blogs.gotdotnet.ru/personal/poigraem/PermaLink.aspx?guid=88FEC... Here's a quick translation: We've hit a problem where getElementById is working slowly on a _very_ large page After some research we've found out some interesting facts - Speed of getElementById depends on the length of ids. Tests have shown that for two identical documents, one with ids like a, another with ids like , the speed of getElementById would differ by a factor of two. This is especially important for ASP.NET pages which usually have long ids - There are fast methods and slow methods: -- Fast parentNode nextSibling ownerDocument firstChild -- Slow previousSibling getElementById lastChild The getElemenByTagName has a paradox. It returns the list of elements very quickly. However, access to elements from that list is very slow. It feels as if it were returning a proxy of sorts. In a large tree it's faster to collect a hash of all element ids than use getElementById. This may look like this: [code] function build_document_id_map() { var r = document; map = {} build_id_map( r, map ) return map } function build_id_map( node, map ) { for ( var e = node.firstChild; e != null; e = e.nextSibling ) { if ( e.id ) map[ e.id ] = e; if (e.firstChild ) build_id_map( e, map ) } } var cache; function get_element_by_id( id ) { if ( !cache ) cache = build_document_id_map(id) return cache[id]; } [/code] To test this, you may use the test I wrote: http://files.rsdn.ru/11521/test.htm For each type of element access the test prepares test data anew and runs the test three times. These three times appear in the table in milliseconds *getDocumentById -* find all nodes through getDocumentById *getDocumentById2 -* same, but after the test is run there is a small DOM manipulation in the end. See below for explanation of the test. *get_element_by_id* - find all nodes using the get_element_by_id described above. The ids cache is cleared every time before the test is run. *get_element_by_id2* - same, but the cache is not cleared. Expect to see speed increase in the second and the third run. Here's the table of results for my FF: http://files.rsdn.ru/11521/test_results.PNG [image: Test results for FF] Note that FF caches results of getDocumentById and in the first test the second and the third pass are much faster than the first one. But as soon as we manipulate the DOM even a little, the cache is reset, as we see it in the second test I'm not going to comment on the third and the fourth test, the numbers speak for themselves. I'm going to talk about disadvantages The method works well for a static tree. If the tree is being changed, there's problems with adding/removing elements. The problem of adding elements can easily be solved by: function get_element_by_id( id ) { if ( !cache ) cache = build_document_id_map( id ) if( !cache[id] ) cache[id] = document.getElementById( id ); return cache[id]; } Removal of elements in this case can only be done by a special method which will correct the cache. In this case you can forget about someElem.innerHTML = ; if you wish to remove a large portion of the tree - 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] Re: Is it possible to attach codes to body.onload via document.ready?
yes i know but the problem is: sometimes, you don't have the control over the body tag, for example, you are writing a plugin require to trigger some things during window onload, you can't force your users not to use body onload=xxx right? On 6月24日, 上午2時16分, Erik Beeson [EMAIL PROTECTED] wrote: Try this: html head script src=jquery.js/script script function test() { alert('test'); } $(document).ready(function() { }); // Assign event to window.onload $(window).load(test); /script /head body TEST123 /body /html --Erik On 6/23/07, howa [EMAIL PROTECTED] wrote: Thanks...but how to handle this? html head script src=jquery.js/script script jQuery(document).ready(function() { // Assign event to window.onload jQuery(window).load(function() { alert('Everything is loaded!'); }); }); function test() { alert('test'); } /script /head body onload=test(); TEST123 /body /html I don't want to override the original onload: test() also... why jQuery(body) or jQuery(body) didn't work? thanks. On 6月23日, 下午9時31分, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Howa, Try jQuery(window) without the quotes around window. That should do it! :) --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jun 23, 2007, at 9:20 AM, howa wrote: Hello Gilles Erik, the codes below never work with IE7 FF2.0 html head script src=jquery.js/script script jQuery(document).ready(function() { alert('ready'); // Assign event to window.onload jQuery('window').load(function() { alert('Everything is loaded!'); }); }); /script /head body TEST123 /body /html howa On 6月23日, 下午7時09分, Gilles (Webunity) [EMAIL PROTECTED] wrote: As i see your question, i think you mean this: jQuery(document).ready(function() { // Assign event to window.onload jQuery('body').load(function() { alert('Everything is loaded!'); }); }); On 23 jun, 12:52, howa [EMAIL PROTECTED] wrote: Hello, is it possible to attach some codes to the body.onload via document.ready, or other methods to attach body.onload? thanks.- 隱藏被引用文字 - - 顯示被引用文字 -- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] ANNOUNCE: Linux.com is using jQuery
jQuery rules
[jQuery] Re: Simple plugin to rollove an image
not really... being vision impaired is not a fault viewing your site on mobile device which don't understand css or js is not a fault you are just loosing your potential visitors, anyway, its up to you anyway... what i concern is we are doing web development, not game developement, don't use sprites - never :) On 6月23日, 下午2時10分, Matt Stith [EMAIL PROTECTED] wrote: Honestly when i develop, im not really worried about browsers that dont understand css or javascript. If they chose to use an incredibly outdated browser, thats their fault. On 6/23/07, howa [EMAIL PROTECTED] wrote: On 6月23日, 上午2時17分, Glen Lipka [EMAIL PROTECTED] wrote: I am not sure how it diminishes accessibility. What if your browser don't understand css and js? for jquery's solution, it is fine, you can still see the original image, but only drop the hover effect for css solutions, you might drop the whole image or only people can see the messy single image what's more... what is `alt` tag for your single image? how can a blind people understand your single image? think twice before you use the single image method... it is definitely accessiblity evil and hacky...- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] Is it possible to attach codes to body.onload via document.ready?
Hello, is it possible to attach some codes to the body.onload via document.ready, or other methods to attach body.onload? thanks.
[jQuery] Re: Is it possible to attach codes to body.onload via document.ready?
Hello Gilles Erik, the codes below never work with IE7 FF2.0 html head script src=jquery.js/script script jQuery(document).ready(function() { alert('ready'); // Assign event to window.onload jQuery('window').load(function() { alert('Everything is loaded!'); }); }); /script /head body TEST123 /body /html howa On 6月23日, 下午7時09分, Gilles (Webunity) [EMAIL PROTECTED] wrote: As i see your question, i think you mean this: jQuery(document).ready(function() { // Assign event to window.onload jQuery('body').load(function() { alert('Everything is loaded!'); }); }); On 23 jun, 12:52, howa [EMAIL PROTECTED] wrote: Hello, is it possible to attach some codes to the body.onload via document.ready, or other methods to attach body.onload? thanks.
[jQuery] Re: Is it possible to attach codes to body.onload via document.ready?
Thanks...but how to handle this? html head script src=jquery.js/script script jQuery(document).ready(function() { // Assign event to window.onload jQuery(window).load(function() { alert('Everything is loaded!'); }); }); function test() { alert('test'); } /script /head body onload=test(); TEST123 /body /html I don't want to override the original onload: test() also... why jQuery(body) or jQuery(body) didn't work? thanks. On 6月23日, 下午9時31分, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Howa, Try jQuery(window) without the quotes around window. That should do it! :) --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jun 23, 2007, at 9:20 AM, howa wrote: Hello Gilles Erik, the codes below never work with IE7 FF2.0 html head script src=jquery.js/script script jQuery(document).ready(function() { alert('ready'); // Assign event to window.onload jQuery('window').load(function() { alert('Everything is loaded!'); }); }); /script /head body TEST123 /body /html howa On 6月23日, 下午7時09分, Gilles (Webunity) [EMAIL PROTECTED] wrote: As i see your question, i think you mean this: jQuery(document).ready(function() { // Assign event to window.onload jQuery('body').load(function() { alert('Everything is loaded!'); }); }); On 23 jun, 12:52, howa [EMAIL PROTECTED] wrote: Hello, is it possible to attach some codes to the body.onload via document.ready, or other methods to attach body.onload? thanks.- 隱藏被引用文字 - - 顯示被引用文字 -
[jQuery] Re: Simple plugin to rollove an image
I completely agree CSS can do the job but IMHO, css's ways are even more `hacky` i.e. use of single image and simply shift the background think abt it, this is accessibility evil! On 6月22日, 下午1時16分, Ambient.Impact [EMAIL PROTECTED] wrote: I very much disagree with the following two points: On Jun 21, 10:51 pm, howard chen [EMAIL PROTECTED] wrote: 2. Put rollover stuffs into CSS is no good: CSS for layout design, JS for effect 1. CSS can't preload image, the plugin can 2. This is a subject that's certainly debatable, so I won't fault you for opting to use JavaScript to handle this effect. However, I personally think rollovers ARE part of the design. They certainly do have a certain amount of behaviour to them, but CSS offers a simpler and more lightweight way of achieving this effect, and it works if JavaScript is unavailable. But that's simply my opinion. 1. This is the more important thing I wanted to comment on. While it IS true that CSS rollovers are NOT preloaded if you swap out an image on hover, you can get around this quite elegantly if you use a different approach: use a single image and simply shift the background- position. Two well-known pieces on the subject: http://www.alistapart.com/articles/sprites/http://www.wellstyled.com/css-nopreload-rollovers.html I hope anyone reading this makes an informed decision about choosing how to tackle this problem. JavaScript isn't the only option.
[jQuery] Re: Simple plugin to rollove an image
On 6月23日, 上午2時17分, Glen Lipka [EMAIL PROTECTED] wrote: I am not sure how it diminishes accessibility. What if your browser don't understand css and js? for jquery's solution, it is fine, you can still see the original image, but only drop the hover effect for css solutions, you might drop the whole image or only people can see the messy single image what's more... what is `alt` tag for your single image? how can a blind people understand your single image? think twice before you use the single image method... it is definitely accessiblity evil and hacky...
[jQuery] Re: CNN and Apple Choose Prototype. Why?
IMHO, jQuery is surely the MOST successful JS library ever as you can see the things happening in this mailing lists. Developers/Users are so friendly and helpful to each others. what a mouthful It is enough for me. or do you care anyhting else? :) On Jun 14, 9:19 pm, AJ [EMAIL PROTECTED] wrote: Two stories today from Ajaxian (Ajaxian.com) caught my eye and made me curious: CNN Beta Site:http://ajaxian.com/archives/cnn-beta-site Apple Revamps Its Websitehttp://ajaxian.com/archives/apple-revamps-its-website In both cases, Apple and CNN have gone with Prototype and Scriptaculous. I should say up front I'm a big fan of jQuery and Interface, but I'm wondering why two big sites like this would adopt Prototype when other high-profile sites like Technorati have adopted jQuery.