[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread Liam Potter


why not do this

$('span.mycategory').length

(I've not worked with jquery and xml so I don't know anything about it)



ml1 wrote:

I have something very strange going on trying to create a wrapped set
of elements from an xml file loaded via jquery's xmlhttprequest.   The
xml has a number of entries with class attributes that have multiple
values, ie span class=mycategory mychoice ../span

When I use this selector:

   $('span[class*=mycategory],xml).length

jquery returns zero.  Weirdly if I do exactly the same thing but use a
different attribute name from class in the xml and the query, it
works perfectly.

If I use this method I get the expected result:

   $('span').attr('class')

It returns mycategory mychoice

Is there something special about the class attribute in xml that is
causing this?
  


[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread Michael Lawson

You should wrap your string in '?
so your code would be
$('span[class*='mycategory'],xml).length

cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone:  1-919-517-1568 Tieline:  255-1568
E-mail:  mjlaw...@us.ibm.com

'Examine my teachings critically, as a gold assayer would test gold. If you
find they make sense, conform to your experience, and don't harm yourself
or others, only then should you accept them.'


   
  From:   ml1 tsummer...@gmail.com   
   
  To: jQuery (English) jquery-en@googlegroups.com  
   
  Date:   02/16/2009 11:08 AM  
   
  Subject:[jQuery] class weirdness in loaded XML?!?  
   






I have something very strange going on trying to create a wrapped set
of elements from an xml file loaded via jquery's xmlhttprequest.   The
xml has a number of entries with class attributes that have multiple
values, ie span class=mycategory mychoice ../span

When I use this selector:

   $('span[class*=mycategory],xml).length

jquery returns zero.  Weirdly if I do exactly the same thing but use a
different attribute name from class in the xml and the query, it
works perfectly.

If I use this method I get the expected result:

   $('span').attr('class')

It returns mycategory mychoice

Is there something special about the class attribute in xml that is
causing this?

inline: graycol.gifinline: ecblank.gif

[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread ml1

Thank you for the reply, but I'm afraid that doesn't work either.

Using your code (after correcting the small typos with the quotes) I
tried this:

$(span[class*='mycategory'],x).length

It still returns zero.

On Feb 16, 11:15 am, Michael Lawson mjlaw...@us.ibm.com wrote:
 You should wrap your string in '?
 so your code would be
 $('span[class*='mycategory'],xml).length

 cheers

 Michael Lawson
 Content Tools Developer, Global Solutions, ibm.com
 Phone:  1-919-517-1568 Tieline:  255-1568
 E-mail:  mjlaw...@us.ibm.com

 'Examine my teachings critically, as a gold assayer would test gold. If you
 find they make sense, conform to your experience, and don't harm yourself
 or others, only then should you accept them.'

   From:       ml1 tsummer...@gmail.com                                      
                                     

   To:         jQuery (English) jquery-en@googlegroups.com                 
                                    

   Date:       02/16/2009 11:08 AM                                             
                                    

   Subject:    [jQuery] class weirdness in loaded XML?!?                     
                                    

 I have something very strange going on trying to create a wrapped set
 of elements from an xml file loaded via jquery's xmlhttprequest.   The
 xml has a number of entries with class attributes that have multiple
 values, ie span class=mycategory mychoice ../span

 When I use this selector:

    $('span[class*=mycategory],xml).length

 jquery returns zero.  Weirdly if I do exactly the same thing but use a
 different attribute name from class in the xml and the query, it
 works perfectly.

 If I use this method I get the expected result:

    $('span').attr('class')

 It returns mycategory mychoice

 Is there something special about the class attribute in xml that is
 causing this?

  graycol.gif
  1KViewDownload

  ecblank.gif
  1KViewDownload


[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread Karl Swedberg
The string does not need to be wrapped in single quotation marks.  
Also, why does the selector begin with a single quotation mark and end  
with a double? Are these just typos in the emails?


Try this:

$('span[class*=mycategory]',xml).length

Just one set of single quotation marks, and the closing mark is to the  
right of the closing bracket.


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:


You should wrap your string in '
so your code would be
$('span[class*='mycategory'],xml).length

cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone: 1-919-517-1568 Tieline: 255-1568
E-mail: mjlaw...@us.ibm.com

'Examine my teachings critically, as a gold assayer would test gold.  
If you find they make sense, conform to your experience, and don't  
harm yourself or others, only then should you accept them.'


graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very  
strange going on trying to create a wrapped set


ecblank.gif
From:   ecblank.gif
ml1 tsummer...@gmail.com
ecblank.gif
To: ecblank.gif
jQuery (English) jquery-en@googlegroups.com
ecblank.gif
Date:   ecblank.gif
02/16/2009 11:08 AM
ecblank.gif
Subject:ecblank.gif
[jQuery] class weirdness in loaded XML?!?




I have something very strange going on trying to create a wrapped set
of elements from an xml file loaded via jquery's xmlhttprequest.   The
xml has a number of entries with class attributes that have multiple
values, ie span class=mycategory mychoice ../span

When I use this selector:

  $('span[class*=mycategory],xml).length

jquery returns zero.  Weirdly if I do exactly the same thing but use a
different attribute name from class in the xml and the query, it
works perfectly.

If I use this method I get the expected result:

  $('span').attr('class')

It returns mycategory mychoice

Is there something special about the class attribute in xml that is
causing this?






[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread Michael Lawson

I didn't notice the quotation discrepancy, good catch!  Also, I know
they're not required, but it's good practice IMHO.
cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone:  1-919-517-1568 Tieline:  255-1568
E-mail:  mjlaw...@us.ibm.com

'Examine my teachings critically, as a gold assayer would test gold. If you
find they make sense, conform to your experience, and don't harm yourself
or others, only then should you accept them.'


   
  From:   Karl Swedberg k...@englishrules.com
   
  To: jquery-en@googlegroups.com   
   
  Date:   02/16/2009 11:31 AM  
   
  Subject:[jQuery] Re: class weirdness in loaded XML?!?  
   





The string does not need to be wrapped in single quotation marks. Also, why
does the selector begin with a single quotation mark and end with a double?
Are these just typos in the emails?

Try this:

$('span[class*=mycategory]',xml).length

Just one set of single quotation marks, and the closing mark is to the
right of the closing bracket.

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:



  You should wrap your string in '
  so your code would be
  $('span[class*='mycategory'],xml).length

  cheers

  Michael Lawson
  Content Tools Developer, Global Solutions, ibm.com
  Phone: 1-919-517-1568 Tieline: 255-1568
  E-mail: mjlaw...@us.ibm.com

  'Examine my teachings critically, as a gold assayer would test gold.
  If you find they make sense, conform to your experience, and don't
  harm yourself or others, only then should you accept them.'

  graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very
  strange going on trying to create a wrapped set
   
 ecblank.gifecblank.gif
 From:ml1 ?tsummer...@gmail.com  
   
 ecblank.gifecblank.gif
 To:  jQuery (English) jquery-en@googlegroups.com  
   
 ecblank.gifecblank.gif
 Date:02/16/2009 11:08 AM  
   
 ecblank.gifecblank.gif
 Subject: [jQuery] class weirdness in loaded XML?!?  
   








  I have something very strange going on trying to create a wrapped set
  of elements from an xml file loaded via jquery's xmlhttprequest.
  The
  xml has a number of entries with class attributes that have multiple
  values, ie span class=mycategory mychoice ../span

  When I use this selector:

$('span[class*=mycategory],xml).length

  jquery returns zero.  Weirdly if I do exactly the same thing but use
  a
  different attribute name from class in the xml and the query, it
  works perfectly.

  If I use this method I get the expected result:

$('span').attr('class')

  It returns mycategory mychoice

  Is there something special about the class attribute in xml that is
  causing this?



inline: graycol.gifinline: ecblank.gif

[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread ml1

Tragically none of those quoting variations work.   (I've pretty much
exhausted every quote variation in my desperate search to try to
figure out what's going on.)

Any other ideas?  Could this possibly be a jquery bug?

On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote:
 I didn't notice the quotation discrepancy, good catch!  Also, I know
 they're not required, but it's good practice IMHO.
 cheers

 Michael Lawson
 Content Tools Developer, Global Solutions, ibm.com
 Phone:  1-919-517-1568 Tieline:  255-1568
 E-mail:  mjlaw...@us.ibm.com

 'Examine my teachings critically, as a gold assayer would test gold. If you
 find they make sense, conform to your experience, and don't harm yourself
 or others, only then should you accept them.'

   From:       Karl Swedberg k...@englishrules.com                           
                                    

   To:         jquery-en@googlegroups.com                                      
                                     

   Date:       02/16/2009 11:31 AM                                             
                                    

   Subject:    [jQuery] Re: class weirdness in loaded XML?!?                 
                                    

 The string does not need to be wrapped in single quotation marks. Also, why
 does the selector begin with a single quotation mark and end with a double?
 Are these just typos in the emails?

 Try this:

 $('span[class*=mycategory]',xml).length

 Just one set of single quotation marks, and the closing mark is to the
 right of the closing bracket.

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:

       You should wrap your string in '
       so your code would be
       $('span[class*='mycategory'],xml).length

       cheers

       Michael Lawson
       Content Tools Developer, Global Solutions, ibm.com
       Phone: 1-919-517-1568 Tieline: 255-1568
       E-mail: mjlaw...@us.ibm.com

       'Examine my teachings critically, as a gold assayer would test gold.
       If you find they make sense, conform to your experience, and don't
       harm yourself or others, only then should you accept them.'

       graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very
       strange going on trying to create a wrapped set

  ecblank.gif    ecblank.gif                                            
  From:            ml1 ?tsummer...@gmail.com                              

  ecblank.gif    ecblank.gif                                            
  To:              jQuery (English) jquery-en@googlegroups.com          

  ecblank.gif    ecblank.gif                                            
  Date:            02/16/2009 11:08 AM                                      

  ecblank.gif    ecblank.gif                                            
  Subject:         [jQuery] class weirdness in loaded XML?!?              

       I have something very strange going on trying to create a wrapped set
       of elements from an xml file loaded via jquery's xmlhttprequest.
       The
       xml has a number of entries with class attributes that have multiple
       values, ie span class=mycategory mychoice ../span

       When I use this selector:

         $('span[class*=mycategory],xml).length

       jquery returns zero.  Weirdly if I do exactly the same thing but use
       a
       different attribute name from class in the xml and the query, it
       works perfectly.

       If I use this method I get the expected result:

         $('span').attr('class')

       It returns mycategory mychoice

       Is there something special about the class attribute in xml that is
       causing this?

  graycol.gif
  1KViewDownload

  ecblank.gif
  1KViewDownload


[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread John Resig

I filed a bug and fixed the issue:
http://dev.jquery.com/ticket/4167

--John



On Mon, Feb 16, 2009 at 11:40 AM, ml1 tsummer...@gmail.com wrote:

 Tragically none of those quoting variations work.   (I've pretty much
 exhausted every quote variation in my desperate search to try to
 figure out what's going on.)

 Any other ideas?  Could this possibly be a jquery bug?

 On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote:
 I didn't notice the quotation discrepancy, good catch!  Also, I know
 they're not required, but it's good practice IMHO.
 cheers

 Michael Lawson
 Content Tools Developer, Global Solutions, ibm.com
 Phone:  1-919-517-1568 Tieline:  255-1568
 E-mail:  mjlaw...@us.ibm.com

 'Examine my teachings critically, as a gold assayer would test gold. If you
 find they make sense, conform to your experience, and don't harm yourself
 or others, only then should you accept them.'

   From:   Karl Swedberg k...@englishrules.com

   To: jquery-en@googlegroups.com

   Date:   02/16/2009 11:31 AM

   Subject:[jQuery] Re: class weirdness in loaded XML?!?

 The string does not need to be wrapped in single quotation marks. Also, why
 does the selector begin with a single quotation mark and end with a double?
 Are these just typos in the emails?

 Try this:

 $('span[class*=mycategory]',xml).length

 Just one set of single quotation marks, and the closing mark is to the
 right of the closing bracket.

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:

   You should wrap your string in '
   so your code would be
   $('span[class*='mycategory'],xml).length

   cheers

   Michael Lawson
   Content Tools Developer, Global Solutions, ibm.com
   Phone: 1-919-517-1568 Tieline: 255-1568
   E-mail: mjlaw...@us.ibm.com

   'Examine my teachings critically, as a gold assayer would test gold.
   If you find they make sense, conform to your experience, and don't
   harm yourself or others, only then should you accept them.'

   graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very
   strange going on trying to create a wrapped set

  ecblank.gifecblank.gif
  From:ml1 ?tsummer...@gmail.com

  ecblank.gifecblank.gif
  To:  jQuery (English) jquery-en@googlegroups.com

  ecblank.gifecblank.gif
  Date:02/16/2009 11:08 AM

  ecblank.gifecblank.gif
  Subject: [jQuery] class weirdness in loaded XML?!?

   I have something very strange going on trying to create a wrapped set
   of elements from an xml file loaded via jquery's xmlhttprequest.
   The
   xml has a number of entries with class attributes that have multiple
   values, ie span class=mycategory mychoice ../span

   When I use this selector:

 $('span[class*=mycategory],xml).length

   jquery returns zero.  Weirdly if I do exactly the same thing but use
   a
   different attribute name from class in the xml and the query, it
   works perfectly.

   If I use this method I get the expected result:

 $('span').attr('class')

   It returns mycategory mychoice

   Is there something special about the class attribute in xml that is
   causing this?

  graycol.gif
  1KViewDownload

  ecblank.gif
  1KViewDownload


[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread ml1

Holy cow, before I even submitted the bug report!

On Feb 16, 1:24 pm, John Resig jere...@gmail.com wrote:
 I filed a bug and fixed the issue:http://dev.jquery.com/ticket/4167

 --John



 On Mon, Feb 16, 2009 at 11:40 AM, ml1 tsummer...@gmail.com wrote:

  Tragically none of those quoting variations work.   (I've pretty much
  exhausted every quote variation in my desperate search to try to
  figure out what's going on.)

  Any other ideas?  Could this possibly be a jquery bug?

  On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote:
  I didn't notice the quotation discrepancy, good catch!  Also, I know
  they're not required, but it's good practice IMHO.
  cheers

  Michael Lawson
  Content Tools Developer, Global Solutions, ibm.com
  Phone:  1-919-517-1568 Tieline:  255-1568
  E-mail:  mjlaw...@us.ibm.com

  'Examine my teachings critically, as a gold assayer would test gold. If you
  find they make sense, conform to your experience, and don't harm yourself
  or others, only then should you accept them.'

    From:       Karl Swedberg k...@englishrules.com

    To:         jquery-en@googlegroups.com

    Date:       02/16/2009 11:31 AM

    Subject:    [jQuery] Re: class weirdness in loaded XML?!?

  The string does not need to be wrapped in single quotation marks. Also, why
  does the selector begin with a single quotation mark and end with a double?
  Are these just typos in the emails?

  Try this:

  $('span[class*=mycategory]',xml).length

  Just one set of single quotation marks, and the closing mark is to the
  right of the closing bracket.

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:

        You should wrap your string in '
        so your code would be
        $('span[class*='mycategory'],xml).length

        cheers

        Michael Lawson
        Content Tools Developer, Global Solutions, ibm.com
        Phone: 1-919-517-1568 Tieline: 255-1568
        E-mail: mjlaw...@us.ibm.com

        'Examine my teachings critically, as a gold assayer would test gold.
        If you find they make sense, conform to your experience, and don't
        harm yourself or others, only then should you accept them.'

        graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very
        strange going on trying to create a wrapped set

   ecblank.gif    ecblank.gif
   From:            ml1 ?tsummer...@gmail.com

   ecblank.gif    ecblank.gif
   To:              jQuery (English) jquery-en@googlegroups.com

   ecblank.gif    ecblank.gif
   Date:            02/16/2009 11:08 AM

   ecblank.gif    ecblank.gif
   Subject:         [jQuery] class weirdness in loaded XML?!?

        I have something very strange going on trying to create a wrapped set
        of elements from an xml file loaded via jquery's xmlhttprequest.
        The
        xml has a number of entries with class attributes that have multiple
        values, ie span class=mycategory mychoice ../span

        When I use this selector:

          $('span[class*=mycategory],xml).length

        jquery returns zero.  Weirdly if I do exactly the same thing but use
        a
        different attribute name from class in the xml and the query, it
        works perfectly.

        If I use this method I get the expected result:

          $('span').attr('class')

        It returns mycategory mychoice

        Is there something special about the class attribute in xml that is
        causing this?

   graycol.gif
   1KViewDownload

   ecblank.gif
   1KViewDownload


[jQuery] Re: class weirdness in loaded XML?!?

2009-02-16 Thread John Resig

No problem man. In the future feel free to bring issues like this up
on the jquery-dev list - we can diagnose or fix the problem quite
quickly. Thanks for spotting this!

--John

On 2/16/09, ml1 tsummer...@gmail.com wrote:

 Holy cow, before I even submitted the bug report!

 On Feb 16, 1:24 pm, John Resig jere...@gmail.com wrote:
 I filed a bug and fixed the issue:http://dev.jquery.com/ticket/4167

 --John



 On Mon, Feb 16, 2009 at 11:40 AM, ml1 tsummer...@gmail.com wrote:

  Tragically none of those quoting variations work.   (I've pretty much
  exhausted every quote variation in my desperate search to try to
  figure out what's going on.)

  Any other ideas?  Could this possibly be a jquery bug?

  On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote:
  I didn't notice the quotation discrepancy, good catch!  Also, I know
  they're not required, but it's good practice IMHO.
  cheers

  Michael Lawson
  Content Tools Developer, Global Solutions, ibm.com
  Phone:  1-919-517-1568 Tieline:  255-1568
  E-mail:  mjlaw...@us.ibm.com

  'Examine my teachings critically, as a gold assayer would test gold. If
  you
  find they make sense, conform to your experience, and don't harm
  yourself
  or others, only then should you accept them.'

From:   Karl Swedberg k...@englishrules.com

To: jquery-en@googlegroups.com

Date:   02/16/2009 11:31 AM

Subject:[jQuery] Re: class weirdness in loaded XML?!?

  The string does not need to be wrapped in single quotation marks. Also,
  why
  does the selector begin with a single quotation mark and end with a
  double?
  Are these just typos in the emails?

  Try this:

  $('span[class*=mycategory]',xml).length

  Just one set of single quotation marks, and the closing mark is to the
  right of the closing bracket.

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:

You should wrap your string in '
so your code would be
$('span[class*='mycategory'],xml).length

cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone: 1-919-517-1568 Tieline: 255-1568
E-mail: mjlaw...@us.ibm.com

'Examine my teachings critically, as a gold assayer would test
  gold.
If you find they make sense, conform to your experience, and
  don't
harm yourself or others, only then should you accept them.'

graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something
  very
strange going on trying to create a wrapped set

   ecblank.gifecblank.gif
   From:ml1 ?tsummer...@gmail.com

   ecblank.gifecblank.gif
   To:  jQuery (English) jquery-en@googlegroups.com

   ecblank.gifecblank.gif
   Date:02/16/2009 11:08 AM

   ecblank.gifecblank.gif
   Subject: [jQuery] class weirdness in loaded XML?!?

I have something very strange going on trying to create a wrapped
  set
of elements from an xml file loaded via jquery's xmlhttprequest.
The
xml has a number of entries with class attributes that have
  multiple
values, ie span class=mycategory mychoice ../span

When I use this selector:

  $('span[class*=mycategory],xml).length

jquery returns zero.  Weirdly if I do exactly the same thing but
  use
a
different attribute name from class in the xml and the query,
  it
works perfectly.

If I use this method I get the expected result:

  $('span').attr('class')

It returns mycategory mychoice

Is there something special about the class attribute in xml
  that is
causing this?

   graycol.gif
   1KViewDownload

   ecblank.gif
   1KViewDownload


-- 
--John