CHROME 4.0.223.9 + jQuery
|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
CHROME 4.0.223.9 + jQueryCHROME 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 --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryI wonder how meaningless would be a getComputedStyle for a node not in DOM neither rendered yet ... it's not clear in any case which browser does what.
On Fri, Oct 23, 2009 at 11:58 AM, DBJDBJ <dbjdbj@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryWhat does W3C DOM spec says? --DBJ On Oct 23, 12:05 pm, Andrea Giammarchi <andrea.giammar...@...> wrote: > I wonder how meaningless would be a get*Computed*Style for a node not in DOM > neither rendered yet ... it's not clear in any case which browser does what. > > On Fri, Oct 23, 2009 at 11:58 AM, DBJDBJ <dbj...@...> wrote: > > > 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 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryOn Fri, Oct 23, 2009 at 11:11 AM, DBJDBJ <dbjdbj@...> wrote: > What does W3C DOM spec says? "Since a computed style is related to an Element node, if this element is removed from the document, the associated CSSStyleDeclaration and CSSValue related to this declaration are no longer valid." -- http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-OverrideAndComputed I think that would apply as well to an Element not yet added to the document, but the spec does not say so specifically. -- Scott --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryThanks Scott, my reply was quite sarcastic ... if a node is removed or is not in the document nothing changes, "Computed" words speaks itself ... I mean, if not rendered or present, there's nothing computed for sure.
Regards On Fri, Oct 23, 2009 at 5:25 PM, Scott Sauyet <scott.sauyet@...> wrote: "Since a computed style is related to an Element node, if this element --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryOh, I certainly caught the sarcasm. DBJDBJ's question piqued my curiosity. I wanted to see if the spec had something to say about how getComputedStyle worked with elements not in the DOM. It did. I couldn't tell if DBJDBJ was intending some sarcasm as well or simply was too lazy to Google it before posting... :-) -- Scott --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryWhat a waste of time ...I have posted the code which neither of you have checked in her browsers ... @Scot : where is the definition/explantaion of the CSS2 computed values about the created but un-attached dom element ? If this would be defined, FF and Chrome would most likely do it in the same way. So spare us of "It did" , dramatically made prominent on the separate line... @Andrea : says " ... I wonder how meaningless would be a get*Computed*Style for a node not in DOM neither rendered yet ... " Well for the FF team this was not meaningless, since it is possible to set/get css value on the non-attached newly created dom element in FF and then get to it through getComputedStyle() You just have to follow in the Firebug and Chrome console, what I have posted initally. Instead of "wondering" ... -- DBJ --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryOn Sat, Oct 24, 2009 at 12:22 AM, DBJDBJ <dbjdbj@...> wrote: Well for the FF team this was not meaningless, since it is possible to DBJ it does not matter what an engine does internally, it maters why on earth you would ask for a Computed property when this has never been computed ... this would be normal for a JScript engine, not SpiderMonkey or V8 where performances should be a priority. Accordingly, I would rather ask Firefox (or Firebug plug-in) or Chrome why they provide such information for an element has never been rendered since from Computation point of view this is the real waste of time/resurces and probablythe reason Firefox 3.5 is so slow with DOM render compared even with Internet Explorer. It's nice in any case to see how you trust "applications" more than logic ... do you agree that a picture could never be showed if that fact never happened? Regards --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQuery@Andrea : thanks for normal tone, but again somehow you fundamentaly misunderstood me ? If anything you (probably) followed my code through ;o) One of the strengths of jQuery is: It smooths the sharply uneven surface of cross browser javascript. If I post something that does not mean I want to do it that way and no other way. I simply stumbled upon this issue which , I thought, might be interesting for the jQ team, because this is yet another "feature" that works in some browsers and does not work in others. 99% of jQuery are much more concerned to have code that works and that uses jQuery, than to engage in W3C spec minutiae... My example/finding uses somewhat esoteric code, but the issue of CHROME not allowing getComputedStyle() on non-attached new elements, might break some other part of Sizzle or jQ core, so I thought I report it... --DBJ On Oct 24, 1:23 am, Andrea Giammarchi <andrea.giammar...@...> wrote: > On Sat, Oct 24, 2009 at 12:22 AM, DBJDBJ <dbj...@...> wrote: > > > Well for the FF team this was not meaningless, since it is possible to > > set/get css value on the non-attached newly created dom element in FF > > and then get to it through getComputedStyle() > > You just have to follow in the Firebug and Chrome console, what I have > > posted initally. Instead of "wondering" ... > > DBJ it does not matter what an engine does internally, it maters why on > earth you would ask for a Computed property when this has never been > computed ... this would be normal for a JScript engine, not SpiderMonkey or > V8 where performances should be a priority. > > Accordingly, I would rather ask Firefox (or Firebug plug-in) or Chrome why > they provide such information for an element has never been rendered since > from *Computation* point of view this is the real waste of time/resurces and > probablythe reason Firefox 3.5 is so slow with DOM render compared even with > Internet Explorer. > > It's nice in any case to see how you trust "applications" more than logic > ... do you agree that a picture could never be showed if that fact never > happened? > > Regards 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQuerySizzle searches over nodes already present in the document.
If I create a div inside whatever function thanks gosh Sizzle won't return that div in a search $("div"), do you follow me? I know you simply brought here yet another inconsistency in the browsers panorama, but to fix this doubtfully useful operation which logically does not make sense I would go for the other way .... if(!node.parentNode)return null; To have a computed style for a not in DOM element you need to append it, retrieve the style, remove the node ... no way, since this is gonna be a performances killer and we all take care about performances, don't we? Regards On Sat, Oct 24, 2009 at 10:14 AM, DBJDBJ <dbjdbj@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryP.S. for all ... the reason getComputedStyle does not make sense for a node is that styles are inherited and you'll never know in which position that style would be respected or not.
You append the div in a node with style color:red !important and your div had style color:black ... how can you predict a style if you don't know what kind of dependencies/inheritance that node is gonna have one appended somewhere? If an engine does it by default it's silly cause lots of properties gonna be replaced, changed, modified, due to Cascade Style Sheet inheritance. Regards On Sat, Oct 24, 2009 at 11:05 AM, Andrea Giammarchi <andrea.giammarchi@...> wrote: Sizzle searches over nodes already present in the document. --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQuery" ... If I create a div inside whatever function thanks gosh Sizzle won't return that div in a search $("div"), do you follow me? ..." I "follow" this yes, I am just "wondering" if this FF "feature" might break "something somewhere" in jQ, because jQ users are allowed to create dom nodes "on fly"and use them as a container (aka context), with Sizzle, without ever attaching them to the curent dom tree: // example 1 function faraway ( jq_ ){ return jq_.find(".a") ; } // $div = $("<div style='color:red!important' ><div><div><div class='a b c'>ABC</div></div></div></div>") ; // now pass and search inside this "un-attached" element $a = faraway( $div ) ; // $a.css("color") /* returns : red */ And , yes, for the above test Returns is an empty string (aka "") in CHROME : Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.3 (KHTML, like Gecko) Chrome/4.0.223.11 Safari/532.3 Return is "red" in IE8 : Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0) And return is "rgb(255, 0, 0)" (aka "red") in FF : Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.3) Gecko/ 20090824 Firefox/3.5.3 This example is not that esoteric jQ usage, and thus it is more likely to happen. And fail in CHROME ... Now I do not know is this only this Chrome . is it also the same in Chromium, or in Opera 10, etc ... ? For now I attach element to the head (temporarily) which seems to work. function example2(color) { function faraway(jq_) { return jq_.find(".a"); } var $div = $("<div style='color:" + color + "!important' ><div><div><div class='a b c'>ABC</div></div></div></div>"); // do this for browsers (like CHROME) who do not allow CSS2 properties on non-attached element $div.appendTo($("head")); // now pass and search inside this "un-attached" element var $a = faraway($div); var retval = $a.css("color") $div.remove(); return retval; } example2("red") returns "red" in IE and "rgb(255,0,0)" in FF and CHROME ... AS I said, if jQ team thinks this is necessary to solve before people start complaining (possibly) about jQ + Chrome, they are wellcome to use these findings. --DBJ On Oct 24, 11:09 am, Andrea Giammarchi <andrea.giammar...@...> wrote: > P.S. for all ... the reason getComputedStyle does not make sense for a node > is that styles are inherited and you'll never know in which position that > style would be respected or not. > > You append the div in a node with style color:red !important and your div > had style color:black ... how can you predict a style if you don't know what > kind of dependencies/inheritance that node is gonna have one appended > somewhere? > > If an engine does it by default it's silly cause lots of properties gonna be > replaced, changed, modified, due to Cascade Style Sheet inheritance. > > Regards > > On Sat, Oct 24, 2009 at 11:05 AM, Andrea Giammarchi < > > andrea.giammar...@...> wrote: > > Sizzle searches over nodes already present in the document. > > > If I create a div inside whatever function thanks gosh Sizzle won't return > > that div in a search $("div"), do you follow me? > > > I know you simply brought here yet another inconsistency in the browsers > > panorama, but to fix this doubtfully useful operation which logically does > > not make sense I would go for the other way .... if(!node.parentNode)return > > null; > > > To have a computed style for a not in DOM element you need to append it, > > retrieve the style, remove the node ... no way, since this is gonna be a > > performances killer and we all take care about performances, don't we? > > > Regards > > > On Sat, Oct 24, 2009 at 10:14 AM, DBJDBJ <dbj...@...> wrote: > > >> @Andrea : thanks for normal tone, but again somehow you fundamentaly > >> misunderstood me ? If anything you (probably) followed my code > >> through ;o) > > >> One of the strengths of jQuery is: It smooths the sharply uneven > >> surface of cross browser javascript. > >> If I post something that does not mean I want to do it that way and no > >> other way. > >> I simply stumbled upon this issue which , I thought, might be > >> interesting for the jQ team, because this is yet another "feature" > >> that works in some browsers and does not work in others. > >> 99% of jQuery are much more concerned to have code that works and that > >> uses jQuery, than to engage in W3C spec minutiae... > > >> My example/finding uses somewhat esoteric code, but the issue of > >> CHROME not allowing getComputedStyle() on non-attached new elements, > >> might break some other part of Sizzle or jQ core, so I thought I > >> report it... > > >> --DBJ > > >> On Oct 24, 1:23 am, Andrea Giammarchi <andrea.giammar...@...> > >> wrote: > >> > On Sat, Oct 24, 2009 at 12:22 AM, DBJDBJ <dbj...@...> wrote: > > >> > > Well for the FF team this was not meaningless, since it is possible to > >> > > set/get css value on the non-attached newly created dom element in FF > >> > > and then get to it through getComputedStyle() > >> > > You just have to follow in the Firebug and Chrome console, what I have > >> > > posted initally. Instead of "wondering" ... > > >> > DBJ it does not matter what an engine does internally, it maters why on > >> > earth you would ask for a Computed property when this has never been > >> > computed ... this would be normal for a JScript engine, not SpiderMonkey > >> or > >> > V8 where performances should be a priority. > > >> > Accordingly, I would rather ask Firefox (or Firebug plug-in) or Chrome > >> why > >> > they provide such information for an element has never been rendered > >> since > >> > from *Computation* point of view this is the real waste of time/resurces > >> and > >> > probablythe reason Firefox 3.5 is so slow with DOM render compared even > >> with > >> > Internet Explorer. > > >> > It's nice in any case to see how you trust "applications" more than > >> logic > >> > ... do you agree that a picture could never be showed if that fact never > >> > happened? > > >> > Regards 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryOn Sat, Oct 24, 2009 at 9:49 AM, DBJDBJ <dbjdbj@...> wrote: > I "follow" this yes, I am just "wondering" if this FF "feature" might > break "something somewhere" in jQ, So this is the question now? The way I remember it, the original question was "Chrome or JQuery or me , whose fault is this ?" -- Scott --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: CHROME 4.0.223.9 + jQueryOn Fri, Oct 23, 2009 at 7:22 PM, DBJDBJ <dbjdbj@...> wrote: > > What a waste of time ... Agreed > I have posted the code which neither of you > have checked in her browsers ... Yes, that would clearly be a waste of time... > @Scot : where is the definition/explantaion of the CSS2 computed > values about the created but un-attached dom element ? > If this would be defined, FF and Chrome would most likely do it in the > same way. So spare us of "It did" , dramatically made prominent on the > separate line... Funny, you asked the question about the spec. I pointed to the closest matching reference I found. Now I'm in the wrong for posting it? Andrea's first response, pointing out the absurdity of worrying about getComputedStyle here, is clearly the most lucid thing said on this thread. -- Scott --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to jquery-dev+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |