Im trying to find the best solution for this. getProperty is a very hard thing to do, some properties works different on different browsers. Using user agent to do this kind of thing is not the best way. Thanks for this info, it will help on the improvement of this function.
Fábio Miranda Costa Engenheiro de Computação http://meiocodigo.com On Tue, Jun 23, 2009 at 11:02 AM, [email protected] <[email protected]> wrote: > > Dear everybody, > > I encountered the same problem and I might have a solution! After a > day of searching for the problem, I stumbled upon QuirksMode (again) > and there I found some valuable info on attributes and the way to > approach them. See http://www.quirksmode.org/dom/w3c_core.html#attributes > for more info. > > On Internet Explorer the Element.getProperty method in Mootools 1.11 > gets an element's attribute's value directly using: > > elm.attributes['title'].nodeValue; > > This is highly discouraged by QuirksMode, but seems to work fine for > <MSIE8. > > So my solution is to check if the useragent is >MSIE7 and then use the > next code to retrieve the attributes value: > > elm.getAttribute('title'); > > I slightly modified the Element.getProperty method and attached it to > the Element-object using the extend method. Place the following code > somewhere on your page after loading MooTools and before using the > getProperty method. Works fine for me! > > Element.extend({ > getProperty: function(property){ > var index = Element.Properties[property]; > if (index) return this[index]; > var flag = Element.PropertiesIFlag[property] || 0; > > // Commented old line > // if (!window.ie || flag) return this.getAttribute(property, > flag); > > // Two new lines: put MSIE version number in var msie and > check if > this is 8 or higher > var msie = > navigator.userAgent.toLowerCase().match(/msie\s+(\d)/); > if (!window.ie || flag || msie && msie[1]>=8) return > this.getAttribute(property, flag); > > var node = this.attributes[property]; > return (node) ? node.nodeValue : null; > } > }); > > Best of luck, > Laurens Meurs (Rotterdam, the Netherlands)
