eggie5
2007-May-01 02:06 UTC
IE "Object doesn''t support this property or method" when using prototype Element.addClassName
When ever I use any prototype methods from within internet explorer I get an "Object doesn''t support this property or method". Does any body know what''s going on? function SetupListFilters() { Sortable.create("filters-list"); var filters=$$(''ul.use-filters li.use-filter a''); for(i=0; i<filters.length; i++) { Event.observe(filters[i], ''click'', function(event) { try { var e=Event.element(event); var filters=$(''filters-list''); var filter=document.createElement(''li''); filter.addClassName(''filter''); var a=document.createElement(''a''); a.appendChild(document.createTextNode(e.innerHTML)); filter.appendChild(a) filters.appendChild(filter); a.observe(''dblclick'', RemoveFilter); Sortable.create("filters-list"); } catch(e) { alert(e.message); } }); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-May-01 02:17 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
Uh, what does that mean. Can you clarify? The first error is thrown when addClassName is called. On Apr 30, 7:06 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When ever I use any prototype methods from within internet explorer I > get an "Objectdoesn''tsupportthispropertyormethod". > > Does any body know what''s going on? > > function SetupListFilters() > { > > Sortable.create("filters-list"); > > var filters=$$(''ul.use-filters li.use-filter a''); > > for(i=0; i<filters.length; i++) > { > Event.observe(filters[i], ''click'', function(event) > { > try > { > var e=Event.element(event); > > var filters=$(''filters-list''); > > var filter=document.createElement(''li''); > filter.addClassName(''filter''); > var a=document.createElement(''a''); > a.appendChild(document.createTextNode(e.innerHTML)); > filter.appendChild(a) > > filters.appendChild(filter); > > a.observe(''dblclick'', RemoveFilter); > > Sortable.create("filters-list"); > } > catch(e) > { > alert(e.message); > } > }); > } > > }--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Gareth Evans
2007-May-01 02:19 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
IE doesn''t automatically extend the elements. var filter=document.createElement(''li''); filter = $(filter) filter.addClassName(''filter''); should fix your prob. On 5/1/07, eggie5 <eggie5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > When ever I use any prototype methods from within internet explorer I > get an "Object doesn''t support this property or method". > > Does any body know what''s going on? > > function SetupListFilters() > { > > > > Sortable.create("filters-list"); > > var filters=$$(''ul.use-filters li.use-filter a''); > > for(i=0; i<filters.length; i++) > { > Event.observe(filters[i], ''click'', function(event) > { > try > { > var e=Event.element(event); > > > var filters=$(''filters-list''); > > var filter=document.createElement(''li''); > filter.addClassName(''filter''); > var a=document.createElement(''a''); > a.appendChild(document.createTextNode(e.innerHTML)); > filter.appendChild(a) > > filters.appendChild(filter); > > a.observe(''dblclick'', RemoveFilter); > > Sortable.create("filters-list"); > } > catch(e) > { > alert(e.message); > } > }); > } > > > > > > } > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-May-01 02:19 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
Here''s my source. an error is thrown in IE on every prototype call starting at addClassName! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type="text/javascript" src="assets/scripts/prototype.js"></ script> </head> <body> <div> Filters: <ul class="use-filters"> <li class="use-filter"><a href="#">Status</a></li> <li class="use-filter"><a href="#">Age</a></li> <li class="use-filter"><a href="#">Category</a></li> <li class="use-filter"><a href="#">Campaign</a></li> </ul> </div> <div> Sorting by: <ol id="filters-list"> </ol> </div> <script type="text/javascript"> var filters=$$(''ul.use-filters li.use-filter a''); for(i=0; i<filters.length; i+ +) { Event.observe(filters[i], ''click'', function(event) { try { var e=Event.element(event); var filters=$ (''filters-list''); var filter=document.createElement(''li''); filter.addClassName(''filter''); var a=document.createElement(''a''); a.appendChild(document.createTextNode(e.innerHTML)); filter.appendChild(a) filters.appendChild(filter); a.observe(''dblclick'', RemoveFilter); // Sortable.create("filters-list"); } catch(e) { alert(e.message); } }); } function RemoveFilter(event) { var e=Event.element(event); var parent=e.up(''ol#filters- list''); var filter=e.up(''li.filter''); parent.removeChild(filter); } </script> </body> </html> On Apr 30, 7:06 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When ever I use any prototype methods from within internet explorer I > get an "Object doesn''t support this property or method". > > Does any body know what''s going on? > > function SetupListFilters() > { > > Sortable.create("filters-list"); > > var filters=$$(''ul.use-filters li.use-filter a''); > > for(i=0; i<filters.length; i++) > { > Event.observe(filters[i], ''click'', function(event) > { > try > { > var e=Event.element(event); > > var filters=$(''filters-list''); > > var filter=document.createElement(''li''); > filter.addClassName(''filter''); > var a=document.createElement(''a''); > a.appendChild(document.createTextNode(e.innerHTML)); > filter.appendChild(a) > > filters.appendChild(filter); > > a.observe(''dblclick'', RemoveFilter); > > Sortable.create("filters-list"); > } > catch(e) > { > alert(e.message); > } > }); > } > > }--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-May-01 02:26 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
It seems to be working for the most part. This is a big issue, why haven''t I seen this documented anywhere? Where is it documented? On Apr 30, 7:19 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> IE doesn''t automatically extend the elements. > > var filter=document.createElement(''li''); > filter = $(filter) > filter.addClassName(''filter''); > > should fix your prob. > > On 5/1/07, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > When ever I use any prototype methods from within internet explorer I > > get an "Object doesn''t support this property or method". > > > Does any body know what''s going on? > > > function SetupListFilters() > > { > > > Sortable.create("filters-list"); > > > var filters=$$(''ul.use-filters li.use-filter a''); > > > for(i=0; i<filters.length; i++) > > { > > Event.observe(filters[i], ''click'', function(event) > > { > > try > > { > > var e=Event.element(event); > > > var filters=$(''filters-list''); > > > var filter=document.createElement(''li''); > > filter.addClassName(''filter''); > > var a=document.createElement(''a''); > > a.appendChild(document.createTextNode(e.innerHTML)); > > filter.appendChild(a) > > > filters.appendChild(filter); > > > a.observe(''dblclick'', RemoveFilter); > > > Sortable.create("filters-list"); > > } > > catch(e) > > { > > alert(e.message); > > } > > }); > > } > > > }--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-May-01 02:29 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
HI, Now I seem to be getting the error on Sortable.create, any ideas? var e=Event.element(event); var filters=$(''filters-list''); var filter=document.createElement(''li''); filter=$(filter); filter.addClassName(''filter''); var a=document.createElement(''a''); a.href="#"; a=$(a); a.appendChild(document.createTextNode(e.innerHTML)); filter.appendChild(a) filters.appendChild(filter); a.observe(''dblclick'', RemoveFilter); Sortable.create(filter); On Apr 30, 7:19 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> IE doesn''t automatically extend the elements. > > var filter=document.createElement(''li''); > filter = $(filter) > filter.addClassName(''filter''); > > should fix your prob. > > On 5/1/07, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > When ever I use any prototype methods from within internet explorer I > > get an "Object doesn''t support this property or method". > > > Does any body know what''s going on? > > > function SetupListFilters() > > { > > > Sortable.create("filters-list"); > > > var filters=$$(''ul.use-filters li.use-filter a''); > > > for(i=0; i<filters.length; i++) > > { > > Event.observe(filters[i], ''click'', function(event) > > { > > try > > { > > var e=Event.element(event); > > > var filters=$(''filters-list''); > > > var filter=document.createElement(''li''); > > filter.addClassName(''filter''); > > var a=document.createElement(''a''); > > a.appendChild(document.createTextNode(e.innerHTML)); > > filter.appendChild(a) > > > filters.appendChild(filter); > > > a.observe(''dblclick'', RemoveFilter); > > > Sortable.create("filters-list"); > > } > > catch(e) > > { > > alert(e.message); > > } > > }); > > } > > > }--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-May-01 16:14 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
You can read up on how prototype extends the DOM and why IE is different from everyone else here: http://prototypejs.org/learn/extensions. -- Dash -- eggie5 wrote:> It seems to be working for the most part. This is a big issue, why > haven''t I seen this documented anywhere? Where is it documented? > > On Apr 30, 7:19 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> IE doesn''t automatically extend the elements. >> >> var filter=document.createElement(''li''); >> filter = $(filter) >> filter.addClassName(''filter''); >> >> should fix your prob. >> >> On 5/1/07, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >> >>> When ever I use any prototype methods from within internet explorer I >>> get an "Object doesn''t support this property or method". >>> >>> Does any body know what''s going on? >>> >>> function SetupListFilters() >>> { >>> >>> Sortable.create("filters-list"); >>> >>> var filters=$$(''ul.use-filters li.use-filter a''); >>> >>> for(i=0; i<filters.length; i++) >>> { >>> Event.observe(filters[i], ''click'', function(event) >>> { >>> try >>> { >>> var e=Event.element(event); >>> >>> var filters=$(''filters-list''); >>> >>> var filter=document.createElement(''li''); >>> filter.addClassName(''filter''); >>> var a=document.createElement(''a''); >>> a.appendChild(document.createTextNode(e.innerHTML)); >>> filter.appendChild(a) >>> >>> filters.appendChild(filter); >>> >>> a.observe(''dblclick'', RemoveFilter); >>> >>> Sortable.create("filters-list"); >>> } >>> catch(e) >>> { >>> alert(e.message); >>> } >>> }); >>> } >>> >>> } >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Keith Pitt
2007-May-02 12:06 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
Gday eggie5, I think I know where your problem is. These lines here: var filter=document.createElement(''li''); filter.addClassName(''filter''); Your creating an ''li'' then trying to add a class name to it by using the "addClassName" function. That function only gets applied to elements when you grab the element via the "$" function. By default, DOM elements dont have that method. So I guess you have a few options: var filter = $(document.createElement(''li'')); filter.addClassName(''filter''); or var filter=document.createElement(''li''); filter.className = ''filter''; You''ve also done this with the "a.observe" bit. I can also see a few other issues you might run into. var filters=$$(''ul.use-filters li.use-filter a''); var filters=$(''filters-list''); You are using the same variable name twice. This could potentially break you for loop. You are also not destroying your original sortable, before making a new one. This could cause some ugly memory leaks. Seeing as your using prototype, you can use .each to loop through your filters. Here is some pseudo code on how it should look. function SetupListFilters() { var filtersList = $(''filters-list''); Sortable.destory(filtersList); $$(''ul.use-filters li.use-filter a'').each(function(a, idx) { Event.observe(a, ''click'', function(e) { //e usually stands for event. //el ussually stands for element. var el = Event.element(e); var newFilter = document.createElement(''li''); newFilter.className = ''filter''; var newFilterLink = document.createElement(''a''); newFilterLink.appendChild(document.createTextNode(el.innerHTML)); newFilterLink.appendChild(a); newFilter.appendChild(newFilterLink); filtersList.appendChild(newFilter); //Because a hasnt been called through the $ function yet, // you cannot use .observe. Event.observe(a, ''dblclick'', RemoveFilter); }); } Sortable.create(filtersList); Sorry for the long response. Hope this helps, Keith. eggie5 wrote:> When ever I use any prototype methods from within internet explorer I > get an "Object doesn''t support this property or method". > > Does any body know what''s going on? > > function SetupListFilters() > { > > > > Sortable.create("filters-list"); > > var filters=$$(''ul.use-filters li.use-filter a''); > > for(i=0; i<filters.length; i++) > { > Event.observe(filters[i], ''click'', function(event) > { > try > { > var e=Event.element(event); > > > var filters=$(''filters-list''); > > var filter=document.createElement(''li''); > filter.addClassName(''filter''); > var a=document.createElement(''a''); > a.appendChild(document.createTextNode(e.innerHTML)); > filter.appendChild(a) > > filters.appendChild(filter); > > a.observe(''dblclick'', RemoveFilter); > > Sortable.create("filters-list"); > } > catch(e) > { > alert(e.message); > } > }); > } > > > > > > } > > > > >-- MindVision Interactive Ph: (08) 8212 9544 Fax: (08) 8212 9644 E-Mail: keith-ildoxR50Kj+k+/BmZukYBiV4CK0nxESZKQEueVp/e6I@public.gmane.org Web: www.mindvision.com.au --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
kaydub
2007-Jun-07 03:08 UTC
Re: IE "Object doesn''t support this property or method" when using prototype Element.addClassName
Keith; Thanks alot for this solution. It fixed my problem of getting the ''Object doesn''t support this property or method..'' message. I was calling var.readAttribute instead of the correct $ (var).readAttribute, looks like it happens quite a bit but this is definetely the solution. Cheers. On May 2, 10:06 pm, Keith Pitt <k...-ve2Fw/1u49m1JilXf3s4iIdd74u8MsAO@public.gmane.org> wrote:> Gday eggie5, > > I think I know where your problem is. These lines here: > > var filter=document.createElement(''li''); > filter.addClassName(''filter''); > > Your creating an ''li'' then trying to add a class name to it by using the > "addClassName" function. > That function only gets applied to elements when you grab the element > via the "$" function. By > default, DOM elements dont have that method. So I guess you have a few > options: > > var filter = $(document.createElement(''li'')); > filter.addClassName(''filter'');--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---