Robert new Number is simply for a reason, in IE: var div = document.createElement("div"); div.whatever = 1; alert(div.outerHTML); // <DIV whatever=1></DIV>
div.removeAttribute("whatever"); div.whatever = new Number(1); alert(div.outerHTML); // <DIV></DIV> if there are no side effects I can't see why DIV should be dirty in IE. Also via new Number the behavior is a bit more standard (Firefox and other like) On Sun, Oct 18, 2009 at 1:27 AM, Robert Katić <robert.ka...@gmail.com>wrote: > > If I was not clear enough here are some code http://pastebin.com/m14c0aa3b > > PS: For now, I am not sure if new Number(...) is necessary and that it > is safe enough. > > On Oct 18, 1:05 am, Robert Katić <robert.ka...@gmail.com> wrote: > > I am certainly in favor to that that $.data(elem) returns data object > > instead of id. > > > > I would like that $.data() will not handle getting/setting too, but > > then we would probably consider how to handle getting without > > generating the data object. Maybe an $.data(elem, true) to get data > > object without creating it? > > Because I wouldn't like to be forced to use $(elem).data(prop) only > > because $.fn.data() prevents unnecessary data creations and $.data() > > not. > > > > On Oct 17, 3:40 am, John Resig <jere...@gmail.com> wrote: > > > > > > Of course, although it would simplify the $.data() implementation > > > > (speed performances too) it would breaks compatibility with many > > > > existent plugins. However, $.data() in 1.4 will breaks it already... > > > > > If developers want to switch to this style they're absolutely welcome > > > to (in fact, we already have in jQuery core for performance > > > advantages, in a number of places). > > > > > I've done a quick search on Google Code Search and have only found a > > > couple places where jQuery.data(elem) is used (outside of jQuery > > > itself). Right now I'm leaning towards keeping the API change > > > (especially since the alternative would be pretty lame - like doing > > > jQuery.data(elem, true) or some such) but if the change is too bad > > > then we can always reconsider. > > > > > I should note that in jQuery 1.4 you can do $(elem).data() to get at > > > the element's data, no problem (there was no API conflict for that > > > method). > > > > > --John > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---