- Screen name: dbjdbj
dbjdbj's Profile
42 Posts
260 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- $(new String("button")).get();
- /* returns
- b,u,t,t,o,n
- */
This (ridiculous?) $() call is it seems easy to avoid by replacing (jQuery.1.9.1.js line 132):- // Handle HTML strings
- if ( typeof selector === "string" ) {
With this :I can't think of any other use case for this change to be perhaps necessary. Please discuss.- // Handle HTML strings
- if ( jQuery.type(selector) === "string" ) {
--DBJ- 1.4.2 fails in IE9. Solution.Instead of :// Make sure that the execution of code works by injecting a script// tag with appendChild/createTextNode// (IE doesn't support this, fails, and uses .text instead)if (window[id]) {jQuery.support.scriptEval = true;delete window[id];}Should be :// Make sure that the execution of code works by injecting a script// tag with appendChild/createTextNode// (IE doesn't support this, fails, and uses .text instead)if (window[id]) {jQuery.support.scriptEval = true;try { // DBJ fix for IE9delete window[id];} catch (x) { }}
--DBJjQuery.version and/or jQuery.version()
(moved from guithubI think we are all in agreement here, and this is why I have tried to draft one VERY short proposal for a good jQuery team. In case they do agree with it, I am sure they will be perfectly capable to sort out the implementation details. Recap:
1. jQuery.version perhaps as an simple object, to be added
2. versioning tag composition documented in the form of the minimal grammar (BNF), to be made
3. Official plugin that will provide additional functionality to plugin authors community (much like meta-data plugin does), to be added
4. jQuery.fn.jquery to be deprecatedCan we please be productive , stop the debate, and vote ? I would ideally like to have jQuery.version as an object, perhaps :
jQuery.version = {
prm : 1,
sec : 4,
ter : 3,
stage : "pre",
timestamp: "20100625223456", // 2010-07-02 DBJ added who : " openID uri ", toString : function () { return this.prim + "." + this.sec + "." + this.ter + "." + this.stage ; } }This addition will help to plugin developers, in the testing management and in the jQuery development management.
Update :: Plugin versioning and classification
I added the property 'who', to the version object, whose string value repreents openID URI of the person who made the release. This would allow for better plugins management, classification, etc.
WIth the sam as above version object structure, jQuery plugin developers should version their plugins, too. This would allow consistent and manageable verison check on plugins. Eg:
alert ( jQuery.somePlugin.version ) ; // display the versin of some plugin
if ( $.somePlugin.version.sec > 1 ) { /* use new plugin feature */ }
--DBJ- Currently we have :
// The current version of jQuery being used
jquery: "@VERSION",
Which is reachable as an property of the jQuery instance (aka "object")$().jquery /* returns string: "1.4.2" */
I would like *not* to be obliged to make an jQuery instance just to be able to find out what the version is.
It would be trivial to make this an property of the jQuery object , so that one can use it like this :
jQuery.jquery // returns "1.4.2."
Ideally I would like to see a structured version information, perhaps with an "normal" name to :
jQuery.version // returns array of three numbers: [1,4,2]
Where:
jQuery.version[0] // is a primary version
jQuery.version[1] // is a sub version
jQuery.version[2] // is a build number
All, just a standard stuff really ...
--DBJ
--DBJ- Has anyone downloaded it and can share it , perhaps ?
--DBJ- 17-Mar-2010 04:31 AM
- Forum: Developing jQuery Core
Congratulations to John and the Team ... I hope due dilligence was performed before embracing MSFT.
--DBJ- 25-Feb-2010 08:43 PM
- Forum: Developing jQuery Core
- I shall be so bold, to suggest slightly improved isEmptyObject() .../*currently in jQueryisEmptyObject : function(obj) {for (var name in obj) {return false;}return true;} ,*//*return undefined on any object that is not "object" or "function"also ignore the possible prototype chain*/// slightly improvedisEmptyObject : function (object) {if (typeof object !== 'object' && typeof object !== 'function') return ;for (var name in object) {if (Object.prototype.hasOwnProperty.call(object,name)) {return false;}}return true;};
--DBJ- This was started almost a year ago. jQuery.each() improvement.Inside it, instead of :for ( name in object ) {if ( callback.apply( object[ name ], args ) === false ) {break;}}One would expect to see :for ( name in object ) {if ( ! Object.prototype.hasOwnProperty.call( object, name )) continue ;if ( callback.apply( object[ name ], args ) === false ) {break;}}Now this is somewhat controversial, beacuse we all know this will slow down this function. But it is perphaps inevitable, since it is "the right thing to do" ...Can we plese have yes or no, with a reasoning behind?Thank's:
--DBJ- Good news ...
http://code.google.com/p/v8/issues/detail?id=372
If anyone remembers how jQuery forum JSON.parse "upheaval" started ( a month ago?). When we noticed that JSON.parse() allows illegal JSON string syntax ? And when strict conformance to JSON syntax was introduced.
Well I made a little fuss over there and I was notified today this is fixed , inside V8.
Now it just has to surface in some near future CHROME update.
This news might ( just might!) allow jQuery ajax *not* to do "manual" checking of data , before passing it to JSON.parse(). But to do it only for browsers which still do not have native JSON.
--DBJ- The simplest and fastest rx-es that work are /^[\s\xA0]+/ and /[\s\xA0]+$/(thanks travis.hardiman)jquery-1.4.1.js (arround line#3859 ) has : rleadingWhitespace = /^\s+/,which is perhaps a bug because IE does not cover \u00A0, as a white-spaceIf I may suggest, introduction of :
- rleadingWhitespace = /^[\s\xA0]+/,
- rtrailingWhitespace = /[\s\xA0]+$ ,
somewhere at the top of jQuery enclosure, where all the jQuery wide, var's are declared.to be used wherever required/needed.This is also good for new jQuery.trim() proposed, which will be using them both if host does not support "".trim()--DBJBefore we get 100+ long threads about pros-and-cons of WebSockets and pros-and-cons of jQuery core using them or wrapping them in any way. Before any of that, here are a few simple facts about WebSockets, today.
- Q1:: Are WebSockets, actually part of HTML5 ?
- A1 :: No ( They were developed as part of HTML5 originally. )
- Q2 :: Can Appache out-of-the-box support WebSockets? Can IIS ?
- A2:: No ( WebSockets is not part of HTTP; it's a separate protocol and needs separate servers (though it can be integrated with HTTP servers in certain cases).
- Q3 :: Can HTTPS work over WebSockets ?
- A3:: No ( WebSockets can be encrypted using TLS. One can not run raw HTTPS over WebSockets, though, that wouldn't make much sense.)
Please do not get this as "patronising".
If you wish to develop a "WebSockets jQuery plugin", feel free to do it.
( I very much doubt that WebSockets will be "covered" by jQuery core, any time soon. )--DBJ
Yes, this (forum) is way better than anything else jQuery community had before.
Although (currently) https://forum.jquery.com/ end user experience , can be hardly described as "smooth".
There is a lot of page flicker, etc ... Not exactly how jQuery based pages should look like ;)
There is a difference between "hosted by" and "powered by" (Zoho), as we see.
I am sure this is being worked on right now and will be sorted soon ...
--DBJ
2010 JAN 21
I already see improvements to this. Well done!
Still, it is especially *Not smooth* when I do select "Login with your Google account" button , on the start.
One can see "the thing" going to the Zoho server , then 1-2 seconds of "just white" and then page is back again ...
Almost there ;)
- What would happen if jQuery would "force" a "singleton" for a host
document ?
What if :
$()
$("html")
$( document )
... etc
Would all point to the same jQuery instance ? One document one jQuery.
Do we already have it in core.js :
// A central reference to the root jQuery(document)
rootjQuery,
And can we "just use it" like this :
// Handle $(""), $(null), or $(undefined)
if (!selector) {
return rootjQuery; // originaly returning 'this'
}
Is there anything that "obviously" renders this "impossible" ?
This (for sure) will provoke some people to think about using
potentially removed nodes, or attributes "changed by something else".
At least some rudimentary ("free" ?) mechanism, for multiple callers/
users operating on a single document, in the same time.
And. It seems this will allow jQuery "internals" to have (at least
some) way of knowing that rootjQuery.length has changed. By
"something or someone" ;o)
--DBJ
--
CHROME supports this ... but FF does not. same as IE8 .
http://www.w3.org/2003/02/06-dom-support.html
jQuery 1.5 perhaps ?
What I am actually talking is jQuery implementing support for
"Mutation Events" , which is DOM Level 2 ...
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-mutationevents
Mutation Events are actualy consequences of CRUDE operations on the
dom tree ...
This would allow $("div) that $("div").find(".subset").remove() has
happened.
For example :
var d1 = $("div") ; // .length === 10
// d1 is made by you
var d2 = $("div.foo") ; // subset of div's , length === 3
// imagine d2 was made inside some plugin out of your control, but on
the same page
d2.remove() ;
d1.length === 7 // because mutation event was fired (by dom itself)
and d1 "knows" what was removed
// optionaly one can could "get" the clones of removed nodes, if "one"
has subscribed to a Mutation Event
jQuery.subscribeToMutation( "REMOVE" , function ( mutation_event )
{ /* receive a mutation event upon removal of any dom node */});
Would this be just nice ?
Although I can see difficulties for this working in IE6 ;o)
--DBJ
--- 15-Nov-2009 06:22 AM
- Forum: Developing jQuery Core
I noticed this by accident (I had a bug in some speed tests)
If i give them both an array of size 1e5, the latest one is twice as
fast as 1.2.6 ?
var A[1e5], j=1e5; while(j--) A[j] = j ;
$140(A), exits (on average) twice as fast as $126(A) ...
--DBJ
PS:
$126 --- jQuery 1.2.6
$140 -- jQuery 1.4.pre
CHROME 4.0.223.9
If one does this :
var dumsy = $("<div style='display:none;'></div>").css
("color", "red");
C = window.getComputedStyle(dumsy[0], null).getPropertyValue
("color");
C will be empty string , aka "". Also observing
window.getComputedStyle(dumsy[0], null).cssText will reveal that
"color:" has no value , as everything else in that long string.
Then if one does this :
var dumsy = $("<div style='display:none;'></div>").css
("color", "red");
dumsy.appendTo(document.body);
C = window.getComputedStyle(dumsy[0], null).getPropertyValue
("color");
C will be "rgb(255,0,0)" as it should ...
Chrome or JQuery or me , whose fault is this ?
Ah, yes, this works in FireFox (even) without : dumsy.appendTo
(document.body);
--DBJ
Matt Kruse has an nice and simple jQuery "ideas page". I could not
make it work for me.
http://dbj.org/h.htm
The difference is I am using the latest jQuery.And I have also removed
some parts from Matt's page.
The first example. "Details" Table . My page is (obviously) not
working. Why?
Link to the Matt's page is there. His page uses (I think) jQ 1.2 and
is working.
Simple Tree View works on both pages.
Also when using IE the behaviour of my page is much worse.
Any advice? Idea?
--DBJ
Not 100% certain, but it *seems* Microsoft Office Web Apps , do not
support IE6. The lowest Ie version is 7.
"...Office Web Apps support Internet Explorer (IE) 7 and IE8; Firefox
3.5 on Windows, Mac and Linux; and Safari 4.0 on the Mac..."
--DBJ
I think we all know that In IE, typeof window.alert , returns “object”
Here is my portable isFunction() , IMHO it might be ine of the
simplest solutions that I have seen?
// GPL (c) 2009 by DBJ.ORG
var isFunction = typeof (top.alert) == "object" ?
function(x) {
return (x + "").match(/function/) !== null ;
}
:
function (x) {
return x instanceof Function;
}
// test
isFunction( window.alert )
// returns true, in all browsers
Enjoy …
--DBJ
In case you might think, things are advancing quite well for the web
world, and javascript+css+html web apps will very soon "rule the
world" (if they are not already ruling it), please read this:
http://blog.hedgerwow.com/2009/02/20/notes-from-stylesheet-debugjs/
--DBJ
Need to work with jQuery in Windows ? This might come usefull :
http://blogs.msdn.com/joshpoley/archive/2008/01/15/running-jscript-in-a-cmd-file.aspx
--DBJ
John,
Todays nightly build has this on the top :
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent.toLowerCase(),
Above is using the window global, where I suppose you want 'userAgent'
to be "sandboxed" and you want to reference the window argument, not
the window global ?
// Keep a UserAgent string for use with jQuery.browser
// Corrected: using the window argument
userAgent = window.navigator.userAgent.toLowerCase(),
Regards: DBJ- «Prev
- Next »
Moderate user : dbjdbj
© 2013 jQuery Foundation
Sponsored by
and others.