"
....
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 Waldron<waldron.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
>>> Quadling<rquadl...@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=ZEND002498&r=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
-~----------~----~----~----~------~----~------~--~---

Reply via email to