[jQuery] Re: Atribute selector with squared brackets

2008-10-21 Thread jasonkarns

In XHTML, the name attribute on input (and textarea and select)
elements is defined as CDATA not NMTOKEN thus, brackets are legal in
name attributes on input elements. It is NOT backwards compatible with
HTML, where the character restriction is [a-z][A-Z]-_ and .

Further note, the id attribute has it's own separate set of
restrictions that are a subset of all HTML attributes.

http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_input
http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_select
http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_textarea

~Jason

On Oct 21, 12:07 pm, ricardobeat [EMAIL PROTECTED] wrote:
 Brackets are an invalid character in attributes, for XHTML served as
 text/html, which I guess accounts for most of jQuery usage anyway.
 Looks like someone already updated the docs.

 - ricardo

 On Oct 20, 11:36 pm, Ariel Flesler [EMAIL PROTECTED] wrote:

  We got a ticket about how to select elements by an attribute with
  brackets.
  I replied with the common link to the FAQ and the reporter replied
  that the example in the docs doesn't work.

  I tried that myself, and indeed, that didn't work.

 http://dev.jquery.com/ticket/3443

  $('[name=foo[bar]]'); // Doesn't work

  $('[name=foo\\[bar\\]]'); // Should work, but doesn't

  $('[name=foo[bar]]'); // Does work

  Now... I think the last option is good enough. But we need to update
  the docs.

  Anything to add ?
  Anyone volunteers to update the docs ?

  Cheers

  --
  Ariel Fleslerhttp://flesler.blogspot.com/


[jQuery] Hierarchical .parents()

2008-09-25 Thread jasonkarns

Will the .parents() method always return in hierarchical order? Say I
have:

ol id=outer
  li
ol id=inner
  li
a id=target/
  /li
/ol
  /li
/ol

If I do $(#target).parents(ol).eq(0), will I *always* get #inner,
or is the order of the resulting jQuery matched elements arbitrary?

~Jason