2011/9/6 nathanJsweet <nathanjsw...@gmail.com>: > Hey all, > I'm building my selector engine still (for those of you who remember > my ill-fated test suite), I'll be submitting it for code review > shortly, but I ran into an interesting issue that I was hoping someone > could resolve for me. Nowhere, that I can find, in the CSS spec does > it say that an attribute-value may not contain spaces in it using the > attribute selector. In fact, quite the opposite seems to be stated in > section 6.3 of the spec it says: > > "Attribute values must be CSS identifiers or strings." > > This is in explicit reference to the attribute selector, which would > lead me to believe that whitespace is certainly allowed. However, I > have noticed that in Sizzle and other selector engines, including the > native querySelector function, that whitespace throws an error; also, > not one of the examples in the attribute selector section of the CSS > spec has an example with whitespace. My question is: is there > something I'm missing? > > My selector engine can handle whitespace in this situation, and I see > no reason why it shouldn't, because it's not as though whitespace in > this situation can create syntactic confusion as a brace, "]", > delimits the whole selection. jQuery('[class="first last"]')
works fine on <li class="first last"> and same should go for anything else. Same goes to jQuery('[name="my fancy[] stuff"]') with <a name="my fancy[] stuff"> -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com