[Proto-Scripty] Re: selectors failing in IE8FF3 @ Colin
Colin, I was just thinking about your statement: (OTOH I wish that browsers and libraries would object to a very common instance of invalid HTML: duplicate id's) And how much I agree. This is the result... (function () { var _domIdentities = function () {}; _domIdentities.prototype = { test: function () { var _error = new Error('Duplicate element ID exists'), _elems = $(document.body).select('*[id]'), _len= _elems.length, _temp = [], _i = 0; for( ; _i _len ; _i++ ) { if ( _temp.indexOf( _elems[_i].id ) = 0 ) throw _error + ' ' + _elems[_i].id + ''; else _temp.push( _elems[_i].id ); } } }; new _domIdentities().test(); delete _domIdentities; })(); Nothing I'd consider perfect but I think its an interesting starting point. ... perhaps if DOMNodeInserted and other mutation events where more widely supported. Just some zany ideas. On Wed, Jul 22, 2009 at 5:31 AM, ColinFine colin.f...@pace.com wrote: On Jul 21, 1:52 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: Each to their own, everyone has their own coding practices and concepts. Indeed. I'm not about to start using '.' or ':' in ID's myself. In PHP and Perl you -could- call . a heirachial operator as it joins 2 nodes (strings for example) together - thus jumping from one to the next or making the bridge (to assimilate them) - which is what it does in Javascript for example (kind of). I think this is a perverse argument, but I'm not going to get excited about it. As i said - each to their own but if CSS explicits .className as a classname then perhaps they should think about not having dots in ID's ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion. Classnames do not allow dots as far as i know. I would've thought the devs of JS libraries wluld have realised that perhaps 0.01% of javascript developers in the world would use dots and possibly didnt want the performance lack to accomodate these users Just my 2 pence worth!!! I think, as Rick implied above, that the designers of CSS selectors were ill-advised to use symbols which were permitted in id's (I'm assuming that the HTML spec came before the CSS one, but I haven't checked). But formally, there are no contexts in which these are ambiguous. But I think it would be wrong for JS libraries to refuse to work just because you had made certain (valid) choices in your HTML. (OTOH I wish that browsers and libraries would object to a very common instance of invalid HTML: duplicate id's) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
ColinFine wrote: On Jul 21, 1:52 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: Each to their own, everyone has their own coding practices and concepts. Indeed. I'm not about to start using '.' or ':' in ID's myself. Well... You have no idea how grateful I am you guys discussed this problem right now. Yes, I do have dots in some of my ids because it's the way the corresponding objects are being referenced at the server backend, so it just seemed sooo convenient. Me, a case for a psychiatrist, out of laziness? Maybe... ;-) I made the switch from Prototype 1.6.0.2 to 1.6.0.3 and a few down() calls stopped working for no obvious reasons. And it turned out to be just the problem you were discussing here. Would have taken me ages to track it down by myself. I just wanted to let you know, and to say thank you. Hope you don't mind. Have fun Daniel In PHP and Perl you -could- call . a heirachial operator as it joins 2 nodes (strings for example) together - thus jumping from one to the next or making the bridge (to assimilate them) - which is what it does in Javascript for example (kind of). I think this is a perverse argument, but I'm not going to get excited about it. As i said - each to their own but if CSS explicits .className as a classname then perhaps they should think about not having dots in ID's ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion. Classnames do not allow dots as far as i know. I would've thought the devs of JS libraries wluld have realised that perhaps 0.01% of javascript developers in the world would use dots and possibly didnt want the performance lack to accomodate these users Just my 2 pence worth!!! I think, as Rick implied above, that the designers of CSS selectors were ill-advised to use symbols which were permitted in id's (I'm assuming that the HTML spec came before the CSS one, but I haven't checked). But formally, there are no contexts in which these are ambiguous. But I think it would be wrong for JS libraries to refuse to work just because you had made certain (valid) choices in your HTML. (OTOH I wish that browsers and libraries would object to a very common instance of invalid HTML: duplicate id's) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
most welcome, glad to know that someone else out there is using dots in ids ;-) cheers -- mona On Fri, Jul 24, 2009 at 11:20 AM, Daniel Rubindru...@dimedis.de wrote: ColinFine wrote: On Jul 21, 1:52 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: Each to their own, everyone has their own coding practices and concepts. Indeed. I'm not about to start using '.' or ':' in ID's myself. Well... You have no idea how grateful I am you guys discussed this problem right now. Yes, I do have dots in some of my ids because it's the way the corresponding objects are being referenced at the server backend, so it just seemed sooo convenient. Me, a case for a psychiatrist, out of laziness? Maybe... ;-) I made the switch from Prototype 1.6.0.2 to 1.6.0.3 and a few down() calls stopped working for no obvious reasons. And it turned out to be just the problem you were discussing here. Would have taken me ages to track it down by myself. I just wanted to let you know, and to say thank you. Hope you don't mind. Have fun Daniel In PHP and Perl you -could- call . a heirachial operator as it joins 2 nodes (strings for example) together - thus jumping from one to the next or making the bridge (to assimilate them) - which is what it does in Javascript for example (kind of). I think this is a perverse argument, but I'm not going to get excited about it. As i said - each to their own but if CSS explicits .className as a classname then perhaps they should think about not having dots in ID's ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion. Classnames do not allow dots as far as i know. I would've thought the devs of JS libraries wluld have realised that perhaps 0.01% of javascript developers in the world would use dots and possibly didnt want the performance lack to accomodate these users Just my 2 pence worth!!! I think, as Rick implied above, that the designers of CSS selectors were ill-advised to use symbols which were permitted in id's (I'm assuming that the HTML spec came before the CSS one, but I haven't checked). But formally, there are no contexts in which these are ambiguous. But I think it would be wrong for JS libraries to refuse to work just because you had made certain (valid) choices in your HTML. (OTOH I wish that browsers and libraries would object to a very common instance of invalid HTML: duplicate id's) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
Yes I agree, now I know better ;) (dots) and (colons) in ids .. it's not really their place esp. with the new Selector API. Had this API been out with HTML 4, I'm sure this would've been deprecated. On my next project, I have to let go a bit of my obsession with namespaces :) cheers -- mona On Tue, Jul 21, 2009 at 6:40 PM, Rick Waldronwaldron.r...@gmail.com wrote: This is a really interesting thread... I don't want to retract my statement, but I dont entirely agree with what i wrote previously (it's all part of learning right ?). I've discussed this with a respected colleague, and we both agree that just because a spec says so doesn't make it right or best practice, to quote him: if i start seeing div id=iswear.iamnotaclass:honest I am going to take my life - Al MacDonald (hyper-metrix.com @f1lt3r) I couldn't agree more. On Tue, Jul 21, 2009 at 8:52 AM, Alex McAuley webmas...@thecarmarketplace.com wrote: Each to their own, everyone has their own coding practices and concepts. In PHP and Perl you -could- call . a heirachial operator as it joins 2 nodes (strings for example) together - thus jumping from one to the next or making the bridge (to assimilate them) - which is what it does in Javascript for example (kind of). As i said - each to their own but if CSS explicits .className as a classname then perhaps they should think about not having dots in ID's ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion. Classnames do not allow dots as far as i know. I would've thought the devs of JS libraries wluld have realised that perhaps 0.01% of javascript developers in the world would use dots and possibly didnt want the performance lack to accomodate these users Just my 2 pence worth!!! Alex Mcauley Developer The Vacancy Market LTD http://www.thevacancymarket.com - Original Message - From: ColinFine colin.f...@pace.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, July 21, 2009 1:09 PM Subject: [Proto-Scripty] Re: selectors failing in IE8FF3 On Jul 21, 10:42 am, Alex McAuley webmas...@thecarmarketplace.com wrote: Why would you want to use . in an id In most web programming a . or a :: means its a node or part of a class or something. This makes no sense to me why anyone would want to confuse js libraries and possible server side backends. I started out agreeing with you, then thought about it, and realised that I disagree quite strongly. Why shouldn't you use dots if you want? Different languagfe use symbols in different ways. In both Perl and PHP (two widely used languages for web programming) '.' is a concatenation operator, not a hierarchical one. It is now quite common to use dots between the parts of an email name, though the purists used to complain that the dot was supposed to denote hierarchy. If the HTML spec didn't allow '.', that would be different. But since it does you are free to use them. There's no question of 'confusing' js libraries or server programs unless those libraries and programs are wrong, in which case they ought to be fixed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). ... [1] So if HTML permits a '.' in the ID value of elements, so should prototype core. Another point is that even if I rewrote my selectors, there would still be a problem in doing the following $('my\.long\.id').down('.myclass'); as prototype would translate this into : element.querySelectorAll('#my.long.id .myclass') I still insist that escaping 'special' chars in Element#identify method is the way to go ... [1] http://www.w3.org/TR/html4/types.html#type-name cheers -- mona On Tue, Jul 21, 2009 at 4:16 AM, Rick Waldronwaldron.r...@gmail.com wrote: I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.com wrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.com wrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
Hi Mona, I agree, dots and colons are valid in HTML, and so should work with the selector engine. I took a quick look at Lighthouse[1], and it looks like there may be a ticket[2] or two[3] there that is relevant, although #559 is marked as fixed in 1.6.1 and you say what you're seeing is still an issue in RC3. It was a very quick search, though, so please have a good look and open a ticket if you don't find one already open for this. (I'm surprised that both 1.6.0.3 and 1.6.1 should have this bug, as they use completely different selector engines.) FWIW, can I suggest a one-page test case with no dependancies other than Prototype? Just something very simple; the one you posted earlier is a bit much to grok in the time most people have available. (Maybe this is less true for people who have used scripty's unit test suite more than I.) [1] http://prototype.lighthouseapp.com/projects/8886-prototype [2] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/559 [3] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/501 Cheers, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jul 21, 10:28 am, Mona Remlawi mona.reml...@gmail.com wrote: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). ... [1] So if HTML permits a '.' in the ID value of elements, so should prototype core. Another point is that even if I rewrote my selectors, there would still be a problem in doing the following $('my\.long\.id').down('.myclass'); as prototype would translate this into : element.querySelectorAll('#my.long.id .myclass') I still insist that escaping 'special' chars in Element#identify method is the way to go ... [1]http://www.w3.org/TR/html4/types.html#type-name cheers -- mona On Tue, Jul 21, 2009 at 4:16 AM, Rick Waldronwaldron.r...@gmail.com wrote: I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.com wrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.com wrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA
[Proto-Scripty] Re: selectors failing in IE8FF3
Why would you want to use . in an id In most web programming a . or a :: means its a node or part of a class or something. This makes no sense to me why anyone would want to confuse js libraries and possible server side backends. - Original Message - From: Mona Remlawi mona.reml...@gmail.com To: prototype-scriptaculous@googlegroups.com Sent: Tuesday, July 21, 2009 10:28 AM Subject: [Proto-Scripty] Re: selectors failing in IE8FF3 ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). ... [1] So if HTML permits a '.' in the ID value of elements, so should prototype core. Another point is that even if I rewrote my selectors, there would still be a problem in doing the following $('my\.long\.id').down('.myclass'); as prototype would translate this into : element.querySelectorAll('#my.long.id .myclass') I still insist that escaping 'special' chars in Element#identify method is the way to go ... [1] http://www.w3.org/TR/html4/types.html#type-name cheers -- mona On Tue, Jul 21, 2009 at 4:16 AM, Rick Waldronwaldron.r...@gmail.com wrote: I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.com wrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.com wrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
Hi T.J., ticket#559 is very relevant indeed, and the final patch contained ... id = id.replace(/[\.:]/g, \\$1); ... [1] does solve the issue with dots and colons in IDs. However, looks like this patch didn't make it to the 'bleeding-edge version'. [3] Instead, there is the old (still buggy) patch ... id = id.replace(/[\.:]/g, \\$0); ... [2] So, I don't know how to go from here, is RC4 due any time soon (i really dislike manual changes in prototype core :) ) [1] http://github.com/sstephenson/prototype/commit/059ce21040ce1c469d13c3633ead78d03fc610c3 [2] http://github.com/sstephenson/prototype/commit/97fc24a0b2f32717c40a0d71bbdea4ca58e0847b [3] http://prototypejs.org/assets/2009/6/16/prototype.js Thanks a lot, always helpful cheers -- mona On Tue, Jul 21, 2009 at 11:41 AM, T.J. Crowdert...@crowdersoftware.com wrote: Hi Mona, I agree, dots and colons are valid in HTML, and so should work with the selector engine. I took a quick look at Lighthouse[1], and it looks like there may be a ticket[2] or two[3] there that is relevant, although #559 is marked as fixed in 1.6.1 and you say what you're seeing is still an issue in RC3. It was a very quick search, though, so please have a good look and open a ticket if you don't find one already open for this. (I'm surprised that both 1.6.0.3 and 1.6.1 should have this bug, as they use completely different selector engines.) FWIW, can I suggest a one-page test case with no dependancies other than Prototype? Just something very simple; the one you posted earlier is a bit much to grok in the time most people have available. (Maybe this is less true for people who have used scripty's unit test suite more than I.) [1] http://prototype.lighthouseapp.com/projects/8886-prototype [2] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/559 [3] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/501 Cheers, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jul 21, 10:28 am, Mona Remlawi mona.reml...@gmail.com wrote: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). ... [1] So if HTML permits a '.' in the ID value of elements, so should prototype core. Another point is that even if I rewrote my selectors, there would still be a problem in doing the following $('my\.long\.id').down('.myclass'); as prototype would translate this into : element.querySelectorAll('#my.long.id .myclass') I still insist that escaping 'special' chars in Element#identify method is the way to go ... [1]http://www.w3.org/TR/html4/types.html#type-name cheers -- mona On Tue, Jul 21, 2009 at 4:16 AM, Rick Waldronwaldron.r...@gmail.com wrote: I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.com wrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.com wrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it
[Proto-Scripty] Re: selectors failing in IE8FF3
2009/7/21 Mona Remlawi mona.reml...@gmail.com: Hi T.J., ticket#559 is very relevant indeed, and the final patch contained ... id = id.replace(/[\.:]/g, \\$1); ... [1] does solve the issue with dots and colons in IDs. However, looks like this patch didn't make it to the 'bleeding-edge version'. [3] Instead, there is the old (still buggy) patch ... id = id.replace(/[\.:]/g, \\$0); ... [2] So, I don't know how to go from here, is RC4 due any time soon (i really dislike manual changes in prototype core :) ) [1] http://github.com/sstephenson/prototype/commit/059ce21040ce1c469d13c3633ead78d03fc610c3 [2] http://github.com/sstephenson/prototype/commit/97fc24a0b2f32717c40a0d71bbdea4ca58e0847b [3] http://prototypejs.org/assets/2009/6/16/prototype.js Thanks a lot, always helpful cheers -- mona On Tue, Jul 21, 2009 at 11:41 AM, T.J. Crowdert...@crowdersoftware.com wrote: Hi Mona, I agree, dots and colons are valid in HTML, and so should work with the selector engine. I took a quick look at Lighthouse[1], and it looks like there may be a ticket[2] or two[3] there that is relevant, although #559 is marked as fixed in 1.6.1 and you say what you're seeing is still an issue in RC3. It was a very quick search, though, so please have a good look and open a ticket if you don't find one already open for this. (I'm surprised that both 1.6.0.3 and 1.6.1 should have this bug, as they use completely different selector engines.) FWIW, can I suggest a one-page test case with no dependancies other than Prototype? Just something very simple; the one you posted earlier is a bit much to grok in the time most people have available. (Maybe this is less true for people who have used scripty's unit test suite more than I.) [1] http://prototype.lighthouseapp.com/projects/8886-prototype [2] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/559 [3] https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/501 Cheers, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jul 21, 10:28 am, Mona Remlawi mona.reml...@gmail.com wrote: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). ... [1] So if HTML permits a '.' in the ID value of elements, so should prototype core. Another point is that even if I rewrote my selectors, there would still be a problem in doing the following $('my\.long\.id').down('.myclass'); as prototype would translate this into : element.querySelectorAll('#my.long.id .myclass') I still insist that escaping 'special' chars in Element#identify method is the way to go ... [1]http://www.w3.org/TR/html4/types.html#type-name cheers -- mona On Tue, Jul 21, 2009 at 4:16 AM, Rick Waldronwaldron.r...@gmail.com wrote: I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.com wrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.com wrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic
[Proto-Scripty] Re: selectors failing in IE8FF3
On Jul 21, 10:42 am, Alex McAuley webmas...@thecarmarketplace.com wrote: Why would you want to use . in an id In most web programming a . or a :: means its a node or part of a class or something. This makes no sense to me why anyone would want to confuse js libraries and possible server side backends. I started out agreeing with you, then thought about it, and realised that I disagree quite strongly. Why shouldn't you use dots if you want? Different languagfe use symbols in different ways. In both Perl and PHP (two widely used languages for web programming) '.' is a concatenation operator, not a hierarchical one. It is now quite common to use dots between the parts of an email name, though the purists used to complain that the dot was supposed to denote hierarchy. If the HTML spec didn't allow '.', that would be different. But since it does you are free to use them. There's no question of 'confusing' js libraries or server programs unless those libraries and programs are wrong, in which case they ought to be fixed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
This is a really interesting thread... I don't want to retract my statement, but I dont entirely agree with what i wrote previously (it's all part of learning right ?). I've discussed this with a respected colleague, and we both agree that just because a spec says so doesn't make it right or best practice, to quote him: if i start seeing div id=iswear.iamnotaclass:honest I am going to take my life - Al MacDonald (hyper-metrix.com @f1lt3r) I couldn't agree more. On Tue, Jul 21, 2009 at 8:52 AM, Alex McAuley webmas...@thecarmarketplace.com wrote: Each to their own, everyone has their own coding practices and concepts. In PHP and Perl you -could- call . a heirachial operator as it joins 2 nodes (strings for example) together - thus jumping from one to the next or making the bridge (to assimilate them) - which is what it does in Javascript for example (kind of). As i said - each to their own but if CSS explicits .className as a classname then perhaps they should think about not having dots in ID's ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion. Classnames do not allow dots as far as i know. I would've thought the devs of JS libraries wluld have realised that perhaps 0.01% of javascript developers in the world would use dots and possibly didnt want the performance lack to accomodate these users Just my 2 pence worth!!! Alex Mcauley Developer The Vacancy Market LTD http://www.thevacancymarket.com - Original Message - From: ColinFine colin.f...@pace.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, July 21, 2009 1:09 PM Subject: [Proto-Scripty] Re: selectors failing in IE8FF3 On Jul 21, 10:42 am, Alex McAuley webmas...@thecarmarketplace.com wrote: Why would you want to use . in an id In most web programming a . or a :: means its a node or part of a class or something. This makes no sense to me why anyone would want to confuse js libraries and possible server side backends. I started out agreeing with you, then thought about it, and realised that I disagree quite strongly. Why shouldn't you use dots if you want? Different languagfe use symbols in different ways. In both Perl and PHP (two widely used languages for web programming) '.' is a concatenation operator, not a hierarchical one. It is now quite common to use dots between the parts of an email name, though the purists used to complain that the dot was supposed to denote hierarchy. If the HTML spec didn't allow '.', that would be different. But since it does you are free to use them. There's no question of 'confusing' js libraries or server programs unless those libraries and programs are wrong, in which case they ought to be fixed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.comwrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: selectors failing in IE8FF3
I feel like i should provide more insight. That was rather vague. An ID could be labelled a.b:c and referenced in your style sheet as #a.b:c but as well as being the id of an element, it could mean: id a, class b, pseudo-selector c. Best to avoid the confusion and stay away from using . and : altogether. On Mon, Jul 20, 2009 at 10:10 PM, Rick Waldron waldron.r...@gmail.comwrote: Instead of changing the way the core works... and potentially causing breakage to existing code - perhaps you might try rewriting your selector statement with escaped periods. This question caused me to read a bunch regarding valid id's from one html spec to another, and then double back to css selector specs. Apparently, they didn't compare notes... Rick On Mon, Jul 20, 2009 at 11:28 AM, Mona Remlawi mona.reml...@gmail.comwrote: You've guessed it, it's unfeasible, the amount of effort that takes makes my head hurt :) Anyway, i found the little bug in prototype (hooray!). IE8 and FF3 have their selectors go into 'selectorsAPI' mode, now into some debugging (version: 1.6.0.3) 2723: this.mode = 'selectorsAPI'; ... 2823: findElements: function(root) { ... 2837: case 'selectorsAPI': ... 2842: var oldId = root.id, id = $(root).identify(); 2843: e = # + id + + e; alert(e) // you'll see how the dots are confusing the selector for classnames ... Now for a fix, i changed the following line in Element#identify 1782: if (id) return id.replace(/\./g, '\\.'); to escape the dots. with that, the unit test will succeed. I'm not sure if this is the best way to go around it, or if there is another chars for escaping, so it's in your hands now. Waiting for the feedback and hopefully a patch :) cheers -- mona On Mon, Jul 20, 2009 at 5:06 PM, Richard Quadlingrquadl...@googlemail.com wrote: 2009/7/20 Mona Remlawi mona.reml...@gmail.com: Hello prototypers, I'm getting a basic error (in selectors) in *IE8/FF3* and don't think anyone has reported it yet -- or maybe did, i searched but not extensively. The problem is that the Element#selector fails when invoked on an Element that has a '.' in its id. I've put a small unit test on pastie, you just need to get a copy of unittest.js from scriptaculous (and test.css if you like colors :) ) http://pastie.org/552134 Tested with both version#1.6.0.3 and version#1.6.1RC#3 with the same results. Any help is greatly appreciated, I'm trying to debug on my own but doubt i'll reach somewhere. cheers -- mona I don't know how feasible it it, but maybe globally changing your IDs to use _ rather than . would be a quick and easy fix. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! ZOPA : http://uk.zopa.com/member/RQuadling --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---