selectors bug?

General Discussion about Mootools 1.2

Moderator: 1.2 Moderators

selectors bug?

Postby lax4mike on Wed Mar 18, 2009 6:57 pm

see http://lax4mike.myftp.org:2580/moo/selectors.htm
  1. <html>
  2. <head>
  3.     <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  4.     <title>selectors</title>
  5.    
  6.     <script src="mootools-1.2.1-core-nc.js" type="text/javascript" charset="utf-8"></script>
  7.     <script src="mootools-1.2-more.js" type="text/javascript" charset="utf-8"></script>
  8.  
  9.     <style type="text/css" media="screen">
  10.         .head {
  11.             padding: 5px;
  12.             width: 100px;
  13.             height: 100px;
  14.             margin: 5px;
  15.             border: 3px solid black;
  16.         }
  17.         .head[hair="yellow"] {
  18.             background: yellow;        
  19.         }
  20.         .head[hair="forest green"] {
  21.             background: #869B27;
  22.         }
  23.  
  24.     </style>
  25.    
  26.     <script type="text/javascript" charset="utf-8">
  27.        
  28.         window.addEvent('domready', function(){
  29.             $$('.head[hair="forest green"]').each(function(item){
  30.                 item.set('text', "i have forest green hair!");
  31.             });
  32.             $$('.head[hair="yellow"]').each(function(item){
  33.                 item.set('text', "i have yellow hair!");
  34.             });
  35.         });
  36.        
  37.     </script>
  38. </head>
  39.  
  40.  
  41. <body>
  42.  
  43.     <div class="head" hair="yellow"></div> 
  44.    
  45.     <div class="head" hair="forest green"></div>   
  46.  
  47. </body>
  48.  
  49. </html>


So there seems to be a bug with selectors when there is a space in the attribute value. the color is filled in by the css and the words are filled in by mootools. As you can see, they both have color, but the "forest green" one doesn't have the text. I'm using the same exact selector for mootools as I am css.

QUE??
lax4mike
mootools fan
 
Posts: 50
Joined: Fri Dec 12, 2008 8:19 pm

Re: selectors bug?

Postby БОШ on Thu Mar 19, 2009 2:28 pm

I think the cause of it is absent such attribute in specification...Use 'class' instead of 'hair'
<div class="head yellow"></div>
БОШ
 
Posts: 12
Joined: Thu Feb 12, 2009 12:36 pm
Location: Russia

Re: selectors bug?

Postby lax4mike on Thu Mar 19, 2009 4:41 pm

the yellow one works fine, it's the "forest green" that doens't work. and that wouldn't work in the class because it would think they are 2 separate classes, 'forest', and 'green'.
lax4mike
mootools fan
 
Posts: 50
Joined: Fri Dec 12, 2008 8:19 pm

Re: selectors bug?

Postby zilenCe on Sat Mar 21, 2009 4:48 am

this will be fixed in the next major release of mootools ;) Also, "hair" is not a valid html attribute, don't use it :)
User avatar
zilenCe
 
Posts: 11
Joined: Thu Aug 14, 2008 8:22 pm


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest