This project is archived and is in readonly mode.

#747 ✓resolved
Fábio M. Costa

set/get/remove Property bugs

Reported by Fábio M. Costa | September 14th, 2009 @ 09:27 PM | in 1.3.0 rc2 (closed)

Here are some points about the set/get/remove property methods.

Camelcased properties

All the camelcased attributes should be used with theyre's camelCased sintax, so there should be a normalization before setting/getting these attributes.

at 1.2.3 what happens is that using el.getProperty('maxLength'), for example, returns el.maxLength. el.getProperty('maxlength') returns el.getAttribute('maxlength', 2).
They should both work the same way.

Form methods crash with input names

On a form, there should be special treatment:

  var z = document.createAttribute('title');
  z.value = 'Test title';

This would make possible to have inputs with the same names as form methods.

related links:

Inline events

Some attributes should be set/get as an element property. They include all the boolean attributes and some other (till now they are ['value', 'defaultValue'] and all the inline events).

  el.prop = 'new value'

Mootools does it with value and defaultValue, but doesnt with events (like onclick). Inline events should be accepted in my opinion, and will work if you set like the way showed (the problem is to detect if its an inline event or a normal attribute).

Type property

The type property is buggy while setting it on safari:


related links:

Maxlength Property

maxLength attribute will return (on get) a big number on IE browsers (2147483647). Still it will break the element (wont allow any input) if you set maxlength to ''.
Look at the related links there is more text about this problem and some tests.

Just to show how the code should be so maxLength would return the value for every browser i made this maxlength Element.Properties:

  Element.Properties.maxLength = Element.Properties.maxlength = {
        set: function(value){
            this.setAttribute('maxLength', value);
            return this;
        get: function(){
            var ml = this.getAttribute('maxLength', 2);
            return (ml === 2147483647)? null: ml;
        erase: function(){
            return this;

Note: im absolutely not telling you guys to include this into mootools-core!!

related links:
Don't look at my code in there, they are very old links :O

Name Property

name el.getAttribute('name', 2) doenst work on ie6/7.

related links:

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by