Skip to content

Commit

Permalink
defaultValue can't use setAttribute for assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed Jun 10, 2009
1 parent 9931ac9 commit 5867844
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Source/Element/Element.js
Expand Up @@ -259,6 +259,7 @@ var attributes = {
'html': 'innerHTML',
'class': 'className',
'for': 'htmlFor',
'defaultValue': 'defaultValue',
'text': (Browser.Engine.trident || (Browser.Engine.webkit && Browser.Engine.version < 420)) ? 'innerText' : 'textContent'
};
var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'];
Expand Down

2 comments on commit 5867844

@fabiomcosta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anutron, thats why i've put that toLowerCase() on the set/get/remove property.
using

setProperty('defaultvalue', 123)

will work ok, but

setProperty('defaultValue', 123)

Wont work... that is the same case as some other properties... ill make some test cases here to analyze this.

@fabiomcosta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because if you use 'readOnly' for example it will use setAttribute, and if you use 'readonly' it uses element.readOnly = ''.
If the toLowerCase() function is used they both (camelCased and lowercased) will work the same (element.property = '').
readOnly is the same case as defaultValue, you would have to add it to this attributes object... (if toLowerCase is not there).
Still doing some tests here, will commit soon... (ill test all the camel cased properties on all major browsers on the set and get property method).

Please sign in to comment.