mootools/mootools-core — Issue #2269: Element.get() method returns "null" in IE7 for data-attributes
Author: ChristianEhlscheid
Created: 2012-02-02 08:50:51+00:00
State: open

Hi there,

first of all, great framework!
I'm using a Mootools heavily in my projects.

While testing some stuff in IE7 lately I discoverted that "element.get('data-foo')" returns "null", even though the
element had this data attribute set.

The cause of this behaviour is a recent patch:
if (!attr | attr.expando) return null;

In IE7 all data-attributes have the expando property set to true.

This patch breaks alot of code, Mootools More Form.Validator for example when used with the data-validators attribute.
And there are probably more classes out there that just do element.get('data-XXX').

I don't know why this change was made, but I think there were proper reasons to implement it ...
So probably the whole codebase has to be checked against "element.get('data-XXX') calls and patched to
element.getAttribute('data-XXX').

Christian