Fixes #2109. #2167

Merged
merged 2 commits into from Jan 8, 2012

2 participants

@ibolmo
MooTools member

IE < 9, getAttribute returns properties set via el.attribute = value.
Other browsers return null for such properties that are not part of the
specs (e.g. href, width, or title).

This tries to normalize the behavior and prevents unwanted "expando"
properties from being returned (e.g. inject and other Element
methods).

TL;DR: whitelist any setProperty, and getProperty checks in the
whitelist or if the attribute is an expando (not part of the known
specs).

Fixed a spec with maxlenght property, when it needed to be maxlength.

PASSED: IE6-9; FFx 3-5, 8, 10, Opera 11, Chrome latest, Safari 5

@ibolmo ibolmo Fixes #2109.
IE < 9, getAttribute returns properties set via `el.attribute = value`.
Other browsers return null for such properties that are not part of the
specs (e.g. `href`, `width`, or `title`).

This tries to normalize the behavior and prevents unwanted "expando"
properties from being returned (e.g. `inject` and other Element
methods).

TL;DR: whitelist any setProperty, and getProperty checks in the
whitelist or if the attribute is an expando (not part of the known
specs).

Fixed a spec with maxlenght property, when it needed to be maxlength.

PASSED: IE6-9; FFx 3-5, 8, 10, Opera 11, Chrome latest, Safari 5
8715836
@ibolmo
MooTools member

Fixes #2109.

@arian arian and 1 other commented on an outdated diff Dec 12, 2011
Source/Element/Element.js
@@ -590,6 +590,17 @@ if (el.type != 'button') propertySetters.type = function(node, value){
/* getProperty, setProperty */
+/* <ltIE9> */
+var pollutesGetAttribute = (function(div){
+ div.random = 'attribute';
+ return (div.getAttribute('random') == 'attribute');
+})(document.createElement('div'));
+
+alert(pollutesGetAttribute);
@arian
MooTools member
arian added a line comment Dec 12, 2011

alert

@ibolmo
MooTools member
ibolmo added a line comment Dec 12, 2011

haha thanks, fixing

@ibolmo
MooTools member
ibolmo added a line comment Dec 12, 2011

done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arian
MooTools member

👍 i can push this any time you want ;)

@ibolmo ibolmo merged commit 70b402e into mootools:master Jan 8, 2012
@ibolmo
MooTools member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment